topic.html 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191
  1. {% set page_title = topic.title ~ " - Topic" %}
  2. {% set active_forum_nav=True %}
  3. {% extends theme("layout.html") %}
  4. {% block content %}
  5. {% from theme('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_id=topic.forum.category.id) }}">{{ topic.forum.category.title }}</a></li>
  9. <li><a href="{{ url_for('forum.view_forum', forum_id=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_id=topic.id)) }}
  14. </div> <!-- end span pagination -->
  15. <div class="pull-right" style="padding-bottom: 10px">
  16. <div class="btn btn-group">
  17. {% if current_user|delete_topic(topic.first_post.user_id, topic.forum) %}
  18. <a href="{{ url_for('forum.delete_topic', topic_id=topic.id) }}" class="btn btn-danger">
  19. <span class="fa fa-trash-o"></span> Delete Topic
  20. </a>
  21. {% endif %}
  22. {% if current_user|lock_topic(topic.forum) %}
  23. {% if not topic.locked %}
  24. <a href="{{ url_for('forum.lock_topic', topic_id=topic.id) }}" class="btn btn-warning">
  25. <span class="fa fa-lock"></span> Lock Topic
  26. </a>
  27. {% else %}
  28. <a href="{{ url_for('forum.unlock_topic', topic_id=topic.id) }}" class="btn btn-warning">
  29. <span class="fa fa-unlock"></span> Unlock Topic
  30. </a>
  31. {% endif %}
  32. {% endif %}
  33. </div>
  34. {% if current_user.is_authenticated() %}
  35. <div class="btn btn-group">
  36. {% if current_user.is_tracking_topic(topic) %}
  37. <a href="{{ url_for('forum.untrack_topic', topic_id=topic.id) }}" class="btn btn-default"><span class="fa fa-star">
  38. </span> Untrack Topic
  39. </a>
  40. {% else %}
  41. <a href="{{ url_for('forum.track_topic', topic_id=topic.id) }}" class="btn btn-default">
  42. <span class="fa fa-star"></span> Track Topic
  43. </a>
  44. {% endif %}
  45. {% if current_user|post_reply(topic.forum) and not (topic.locked or topic.forum.locked) %}
  46. <a href="{{ url_for('forum.new_post', topic_id=topic.id) }}" class="btn btn-primary">
  47. <span class="fa fa-pencil"></span> Reply
  48. </a>
  49. {% endif %}
  50. </div>
  51. {% endif %}
  52. </div>
  53. <table class="table table-bordered">
  54. <tbody>
  55. {% for post in posts.items %}
  56. <tr>
  57. <td >
  58. <span class="pull-right">
  59. <strong>#{%- if posts.page == 1 -%} {{ loop.index }} {%- else -%} {{ loop.index + (posts.page - 1) * config["POSTS_PER_PAGE"] }} {%- endif -%}</strong>
  60. </span>
  61. <span class="pull-left">
  62. <a href="
  63. {%- if posts.page > 1 -%}
  64. {{ url_for('forum.view_topic', topic_id=topic.id) }}?page={{ posts.page }}#pid{{ post.id }}
  65. {%- else -%}
  66. {{ url_for('forum.view_topic', topic_id=topic.id) }}#pid{{ post.id }}
  67. {%- endif -%}
  68. ">{{ post.date_created|format_date('%d %B %Y') }}</a>
  69. {% if post.user_id and post.date_modified %}
  70. <small>
  71. (Last modified: {{ post.date_modified|format_date }} by
  72. <a href="{{ url_for('user.profile', username=post.user.username) }}">
  73. {{ post.modified_by }}
  74. </a>.)
  75. </small>
  76. {% endif %}
  77. </span>
  78. </td>
  79. </tr>
  80. <tr>
  81. <td>
  82. <table class="table table-borderless">
  83. <tr>
  84. {% if post.user_id %}
  85. {% if post.user.avatar %}
  86. <td width="1">
  87. <img src="{{ post.user.avatar }}" alt="Avatar" height="100" width="100">
  88. </td>
  89. {% endif %}
  90. <td>
  91. <a href="{{ url_for('user.profile', username=post.user.username) }}">
  92. <span style="font-weight:bold">{{ post.user.username }}</span> <!-- TODO: Implement userstyles -->
  93. </a>
  94. {%- if post.user|is_online %}
  95. <span class="label label-success">Online</span>
  96. {%- else %}
  97. <span class="label label-default">Offline</span>
  98. {%- endif %}
  99. <div class="profile primary-group">
  100. {{ post.user.primary_group.name }}
  101. </div>
  102. </td>
  103. <td class="pull-right">
  104. Posts: {{ post.user.post_count }}<br />
  105. Registered since: {{ post.user.date_joined|format_date('%b %d %Y') }}<br />
  106. </td>
  107. {% else %}
  108. <td>
  109. <strong>{{ post.username }}</strong>
  110. <br />
  111. Guest
  112. </td>
  113. {% endif %}
  114. </tr>
  115. </table>
  116. </td>
  117. </tr>
  118. <tr>
  119. <td>
  120. <div class="post_body" id="pid{{ post.id }}">
  121. {% autoescape false %}
  122. {{ post.content|markup }}
  123. <!-- Signaure Begin -->
  124. {% if post.user_id and post.user.signature %}
  125. <hr>
  126. {{ post.user.signature|markup }}
  127. {% endif %}
  128. <!-- Signaure End -->
  129. {% endautoescape %}
  130. </div>
  131. </td>
  132. </tr>
  133. <tr>
  134. <td>
  135. <span class="pull-left">
  136. {% if current_user.is_authenticated and post.user_id %}
  137. <a href="{{ url_for('user.new_message') }}?to_user={{ post.user.username }}">PM</a>
  138. {% endif %}
  139. {% if post.user.website %}
  140. | <a href="{{post.user.website}}">Website</a>
  141. {% endif %}
  142. </span>
  143. <span class="pull-right">
  144. <a href="{{ url_for('forum.report_post', post_id=post.id) }}" onclick="window.open(this.href, 'wio_window','width=500,height=500'); return false;">
  145. Report
  146. </a> |
  147. {% if current_user|edit_post(post.user_id, topic.forum) %}
  148. <a href="{{ url_for('forum.edit_post', post_id=post.id) }}">Edit</a> |
  149. {% endif %}
  150. {% if topic.first_post_id == post.id %}
  151. {% if current_user|delete_topic(topic.first_post.user_id, topic.forum) %}
  152. <a href="{{ url_for('forum.delete_topic', topic_id=topic.id) }}">Delete</a> |
  153. {% endif %}
  154. {% else %}
  155. {% if current_user|delete_post(post.user_id, topic.forum) %}
  156. <a href="{{ url_for('forum.delete_post', post_id=post.id) }}">Delete</a> |
  157. {% endif %}
  158. {% endif %}
  159. <a href="#">Quote</a>
  160. </span>
  161. </td>
  162. </tr>
  163. {% endfor %}
  164. </tbody>
  165. </table>
  166. {% if form %}
  167. {% from "macros.html" import render_field %}
  168. <form class="form" action="#" method="post">
  169. {{ form.hidden_tag() }}
  170. {{ render_field(form.content, div_class="col-sm-12", rows=5) }}
  171. <button type="submit" class="btn btn-success">Reply!</button>
  172. </form>
  173. {% endif %}
  174. {% endblock %}