topic.html 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. {% set page_title = topic.title ~ " - Topic" %}
  2. {% set active_forum_nav=True %}
  3. {% extends "layout.html" %}
  4. {% block content %}
  5. {% from 'macros.html' import render_pagination, form_field %}
  6. <ol class="breadcrumb">
  7. <li><a href="{{ url_for('forum.index') }}">Forum</a></li>
  8. <li><a href="{{ url_for('forum.view_category', category=topic.forum.category.id) }}">{{ topic.forum.category.title }}</a></li>
  9. <li><a href="{{ url_for('forum.view_forum', forum=topic.forum_id) }}">{{ topic.forum.title }}</a></li>
  10. <li class="active">{{ topic.title }}</li>
  11. </ol>
  12. <div class="pull-left" style="padding-bottom: 10px">
  13. {{ render_pagination(posts, url_for('forum.view_topic', topic=topic.id)) }}
  14. </div> <!-- end span pagination -->
  15. {% if current_user.is_authenticated() %}
  16. <div class="pull-right" style="padding-bottom: 10px">
  17. <a href="{{ url_for('forum.new_post', topic=topic.id) }}" class="btn btn-primary">Reply</a>
  18. {% if current_user.id == topic.user_id %}
  19. <a href="{{ url_for('forum.delete_topic', topic=topic.id) }}" class="btn btn-primary">Delete Topic</a>
  20. {% endif %}
  21. </div>
  22. {% endif %}
  23. <table class="table table-bordered">
  24. <tbody>
  25. {% for post in posts.items %}
  26. <tr>
  27. <td >
  28. <span class="pull-right">
  29. <strong>#{%- if posts.page == 1 -%} {{ loop.index }} {%- else -%} {{ loop.index + posts.page * per_page }} {%- endif -%}</strong>
  30. </span>
  31. <span class="pull-left">
  32. <a href="
  33. {% if posts.page > 1 %}
  34. {{ url_for('forum.view_topic', topic=topic.id) }}?page={{ posts.page }}#pid{{ post.id }}
  35. {% else %}
  36. {{ url_for('forum.view_topic', topic=topic.id) }}#pid{{ post.id }}
  37. {% endif %}
  38. ">{{ post.date_created|format_date('%d %B %Y') }}</a>
  39. {% if post.date_modified %}
  40. <small>
  41. (Last modified: {{ post.date_modified|format_date }} by <a href="{{ url_for('user.profile', username=post.user.username) }}">{{ post.user.username }}</a>.)
  42. </small>
  43. {% endif %}
  44. </span>
  45. </td>
  46. </tr>
  47. <tr>
  48. <td>
  49. <table class="table table-borderless">
  50. <tr>
  51. <td width="1">
  52. <img src="{{ post.user.avatar }}" alt="Avatar" height="100" width="100">
  53. </td>
  54. <td>
  55. <a href="{{ url_for('user.profile', username=post.user.username) }}"><span style="color: green;"><strong><em>{{ post.user.username }}</em></strong></span></a>
  56. <!-- TODO: Implement online status and groups -->
  57. <span class="label label-success">Online</span><br />
  58. Administrator<br />
  59. </td>
  60. <td class="pull-right">
  61. Posts: {{ post.user.post_count }}<br />
  62. Registered since: {{ post.user.date_joined|format_date('%b %d %Y') }}<br />
  63. <!-- TODO: Implement Karma functionality -->
  64. Karma: <a href="#">124</a>
  65. </td>
  66. </tr>
  67. </table>
  68. </td>
  69. </tr>
  70. <tr>
  71. <td>
  72. <div class="post_body" id="pid{{ post.id }}">
  73. {{ post.content }}
  74. <!-- Signaure Begin -->
  75. {% if post.user.signature %}
  76. <hr>
  77. {{ post.user.signature }}
  78. {% endif %}
  79. <!-- Signaure End -->
  80. </div>
  81. </td>
  82. </tr>
  83. <tr>
  84. <td>
  85. <span class="pull-left">
  86. <a href="{{ url_for('pms.new_message') }}?to_user={{ post.user.username }}">PM</a> | <a href="#">Website</a>
  87. </span>
  88. <span class="pull-right">
  89. {% if current_user.is_authenticated() and current_user.id == post.user_id %}
  90. <a href="{{ url_for('forum.edit_post', post=post.id) }}">Edit</a> |
  91. <a href="{{ url_for('forum.delete_post', post=post.id) }}">Delete</a> |
  92. {% endif %}
  93. <a href="#">Quote</a> |
  94. <a href="#">Report</a> |
  95. <a href="#">+1</a>
  96. </span>
  97. </td>
  98. </tr>
  99. {% endfor %}
  100. </tbody>
  101. </table>
  102. {% if current_user.is_authenticated() %}
  103. <form class="form" action="#" method="post">
  104. {{ form.hidden_tag() }}
  105. <div class="form-group">
  106. {{ form.content(rows="6", class="form-control") }}
  107. </div>
  108. <button type="submit" class="btn btn-success">Reply!</button>
  109. </form>
  110. {% endif %}
  111. {% endblock %}