topic.html 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218
  1. {% extends theme("layout.html") %}
  2. {% set page_title = _("%(title)s - Topic", title=topic.title) %}
  3. {% set active_forum_nav=True %}
  4. {% block content %}
  5. {% from theme('macros.html') import render_pagination, form_field, generate_obj_id, generate_post_url %}
  6. <div class="topic-view">
  7. <ol class="breadcrumb flaskbb-breadcrumb">
  8. <li><a href="{{ url_for('forum.index') }}">{% trans %}Forum{% endtrans %}</a></li>
  9. <li><a href="{{ topic.forum.category.url }}">{{ topic.forum.category.title }}</a></li>
  10. <li><a href="{{ topic.forum.url }}">{{ topic.forum.title }}</a></li>
  11. <li class="active">{{ topic.title }}</li>
  12. </ol>
  13. {% include theme('forum/topic_controls.html') %}
  14. {% if topic.hidden %}
  15. <div class="alert alert-warning">
  16. <span class="fa fa-user-secret"></span>
  17. {{ gettext("This topic is hidden (%(when)s by %(who)s)", who=topic.hidden_by.username, when=format_date(topic.hidden_at, '%b %d %Y'))}}
  18. </div>
  19. {% endif %}
  20. <div class="panel topic-panel">
  21. <div class="panel-heading topic-head">
  22. <a href="{{ topic.url }}">{{ topic.title }}</a>
  23. </div>
  24. <div class="panel-body topic-body">
  25. {% for post, user in posts.items %}
  26. <div id="{{ post.id }}" class="row post-row clearfix">
  27. <div class="author col-md-2 col-sm-3 col-xs-12">
  28. <!-- Registered User -->
  29. {% if post.user_id %}
  30. <div class="author-name"><h4><a href="{{ user.url }}">{{ user.username }}</a></h4></div>
  31. <!-- check if user is online or not -->
  32. {% if user|is_online %}
  33. <div class="author-online" data-toggle="tooltip" data-placement="top" title="online"></div>
  34. {% else %}
  35. <div class="author-offline" data-toggle="tooltip" data-placement="top" title="offline"></div>
  36. {% endif %}
  37. <div class="author-title"><h5>{{ user.primary_group.name }}</h5></div>
  38. {% if user.avatar %}
  39. <div class="author-avatar"><img src="{{ user.avatar }}" alt="avatar"></div>
  40. {% endif %}
  41. <div class="author-registered">{% trans %}Joined{% endtrans %}: {{ user.date_joined|format_date('%b %d %Y') }}</div>
  42. <div class="author-posts">{% trans %}Posts{% endtrans %}: {{ user.post_count }}</div>
  43. <div class="author-pm">
  44. {% if current_user.is_authenticated and post.user_id %}
  45. <a href="{{ url_for('message.new_conversation') }}?to_user={{ user.username }}">{% trans %}Message{% endtrans %}</a>
  46. {% endif %}
  47. </div>
  48. {% if user.website %}
  49. <div class="author-website"><a href="{{ user.website }}" rel="nofollow">{% trans %}Website{% endtrans %}</a></div>
  50. {% endif %}
  51. {% else %}
  52. <!-- user deleted or guest -->
  53. <div class="author-name"><h4>{{ post.username }}</h4></div>
  54. <div class="author-title"><h5>{% trans %}Guest{% endtrans %}</h5></div>
  55. {% endif %}
  56. </div>
  57. <div class="post-box col-md-10 col-sm-9 col-xs-12">
  58. <div class="post-meta clearfix">
  59. <div class="pull-left">
  60. <!-- Creation date / Date modified -->
  61. <a href="{{ post.url }}">
  62. {{ post.date_created|format_date('%d %B %Y - %H:%M') }}
  63. </a>
  64. {% if post.user_id and post.date_modified %}
  65. <small>
  66. (Last modified: {{ post.date_modified|format_date('%d %B %Y - %H:%M') }} by
  67. <a href="{{ url_for('user.profile', username=post.modified_by) }}">{{ post.modified_by }}</a>.)
  68. </small>
  69. {% endif %}
  70. </div>
  71. <!-- Post number -->
  72. <div class="pull-right">
  73. <strong>#{{ generate_obj_id(posts, loop.index, flaskbb_config["POSTS_PER_PAGE"]) }}</strong>
  74. </div>
  75. </div>
  76. <div class="post-content clearfix" id="pid{{ post.id }}">
  77. {% if post.hidden %}
  78. <div class="alert alert-warning">
  79. <span class="fa fa-user-secret"></span>
  80. {{ gettext("This post is hidden (%(when)s by %(who)s)", who=post.hidden_by.username, when=format_date(post.hidden_at, '%b %d %Y'))}}
  81. </div>
  82. {% endif %}
  83. {{ post.content|markup }}
  84. <!-- Signature Begin -->
  85. {% if flaskbb_config["SIGNATURE_ENABLED"] and post.user_id and user.signature %}
  86. <div class="post-signature hidden-xs">
  87. <hr />
  88. {{ user.signature|markup }}
  89. </div>
  90. {% endif %}
  91. <!-- Signature End -->
  92. </div>
  93. <div class="post-footer clearfix">
  94. <!-- Report/Edit/Delete/Quote Post-->
  95. <div class="post-menu pull-right">
  96. {% if current_user|post_reply(topic) %}
  97. <!-- Quick quote -->
  98. <a href="#" class="btn btn-icon icon-reply quote-btn" data-post-id="{{ post.id }}" data-toggle="tooltip" data-placement="top" title="Quote this post"></a>
  99. <!-- Full quote/reply -->
  100. <a href="{{ url_for('forum.reply_post', topic_id=topic.id, post_id=post.id) }}" class="btn btn-icon icon-replyall" data-toggle="tooltip" data-placement="top" title="Full Reply"></a>
  101. {% endif %}
  102. {% if current_user|edit_post(post) %}
  103. <!-- Edit Post -->
  104. <a href="{{ url_for('forum.edit_post', post_id=post.id) }}" class="btn btn-icon icon-edit" data-toggle="tooltip" data-placement="top" title="Edit this post"></a>
  105. {% endif %}
  106. {% if topic.first_post == post %}
  107. {% if current_user|delete_topic(topic) %}
  108. <form class="inline-form" method="post" action="{{ url_for('forum.delete_topic', topic_id=topic.id, slug=topic.slug) }}">
  109. <input type="hidden" name="csrf_token" value="{{ csrf_token() }}" />
  110. <button class="btn btn-icon icon-delete" name="confirmDialog" data-toggle="tooltip" data-placement="top" title="Delete this topic"></button>
  111. </form>
  112. {% endif %}
  113. {% else %}
  114. {% if current_user|delete_post(post) %}
  115. <!-- Delete Post -->
  116. <form class="inline-form" method="post" action="{{ url_for('forum.delete_post', post_id=post.id) }}">
  117. <input type="hidden" name="csrf_token" value="{{ csrf_token() }}" />
  118. <button class="btn btn-icon icon-delete" name="confirmDialog" data-toggle="tooltip" data-placement="top" title="Delete this post"></button>
  119. </form>
  120. {% endif %}
  121. {% endif %}
  122. {% if current_user.is_authenticated %}
  123. <!-- Report post -->
  124. <a href="{{ url_for('forum.report_post', post_id=post.id) }}" onclick="window.open(this.href, 'wio_window','width=500,height=500'); return false;" class="btn btn-icon icon-report" data-toggle="tooltip" data-placement="top" title="Report this post"></a>
  125. {% endif %}
  126. {% if current_user.permissions.get('makehidden') %}
  127. {% if post.first_post %}
  128. {% if topic.hidden %}
  129. <form class="inline-form" method="post" action="{{ url_for('forum.unhide_topic', topic_id=post.topic.id) }}">
  130. <input type="hidden" name="csrf_token" value="{{ csrf_token() }}" />
  131. <button class="btn btn-icon fa fa-user" name="unhide" data-toggle="tooltip" data-placement="top" title="Unhide this topic"></button>
  132. </form>
  133. {% else %}
  134. <form class="inline-form" method="post" action="{{ url_for('forum.hide_topic', topic_id=post.topic.id) }}">
  135. <input type="hidden" name="csrf_token" value="{{ csrf_token() }}" />
  136. <button class="btn btn-icon fa fa-user-secret" name="hide" data-toggle="tooltip" data-placement="top" title="Hide this topic"></button>
  137. </form>
  138. {% endif %}
  139. {% else %}
  140. {% if post.hidden %}
  141. <form class="inline-form" method="post" action="{{ url_for('forum.unhide_post', post_id=post.id) }}">
  142. <input type="hidden" name="csrf_token" value="{{ csrf_token() }}" />
  143. <button class="btn btn-icon fa fa-user" name="unhide" data-toggle="tooltip" data-placement="top" title="Unhide this post"></button>
  144. </form>
  145. {% else %}
  146. <form class="inline-form" method="post" action="{{ url_for('forum.hide_post', post_id=post.id) }}">
  147. <input type="hidden" name="csrf_token" value="{{ csrf_token() }}" />
  148. <button class="btn btn-icon fa fa-user-secret" name="hide" data-toggle="tooltip" data-placement="top" title="Hide this post"></button>
  149. </form>
  150. {% endif %}
  151. {% endif %}
  152. {% endif %}
  153. </div> <!-- end post-menu -->
  154. </div> <!-- end footer -->
  155. </div>
  156. </div>
  157. {% endfor %}
  158. </div> <!-- end topic-body -->
  159. </div> <!-- end topic-panel -->
  160. {% include theme('forum/topic_controls.html') %}
  161. {% from theme("macros.html") import render_field, render_quickreply, render_submit_field %}
  162. {% if form %}
  163. <form class="form" action="#" method="post">
  164. {{ form.hidden_tag() }}
  165. <div class="row">
  166. <div class="col-md-offset-2 col-sm-offset-3 col-md-10 col-sm-9 col-xs-12">
  167. <div class="editor-box">
  168. <div class="editor quickreply">
  169. {{ render_quickreply(form.content, div_class="new-message", rows=7, cols=75, placeholder="", **{'data-provide': 'markdown', 'data-autofocus': 'false', 'class': 'flaskbb-editor'}) }}
  170. </div>
  171. <div class="editor-submit">
  172. {{ render_submit_field(form.submit, input_class="btn btn-success pull-right") }}
  173. </div>
  174. </div>
  175. </div>
  176. </div>
  177. </form>
  178. {% include theme('editor_help.html') %}
  179. {% endif %}
  180. </div>
  181. {% include theme('confirm_dialog.html') %}
  182. {% endblock %}
  183. {% block scripts %}
  184. <script>
  185. $(function () {
  186. $('[data-toggle="tooltip"]').tooltip()
  187. })
  188. </script>
  189. {% endblock %}