topic.html 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205
  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. {{ run_hook("flaskbb_tpl_before_post_author_info", user=user, post=post) }}
  39. {% if user.avatar %}
  40. <div class="author-avatar"><img src="{{ user.avatar }}" alt="avatar"></div>
  41. {% endif %}
  42. <div class="author-registered">{% trans %}Joined{% endtrans %}: {{ user.date_joined|format_date('%b %d %Y') }}</div>
  43. <div class="author-posts">{% trans %}Posts{% endtrans %}: {{ user.post_count }}</div>
  44. {{ run_hook("flaskbb_tpl_after_post_author_info", user=user, post=post) }}
  45. {% else %}
  46. <!-- user deleted or guest -->
  47. <div class="author-name"><h4>{{ post.username }}</h4></div>
  48. <div class="author-title"><h5>{% trans %}Guest{% endtrans %}</h5></div>
  49. {% endif %}
  50. </div>
  51. <div class="post-box col-md-10 col-sm-9 col-xs-12">
  52. <div class="post-meta clearfix">
  53. <div class="pull-left">
  54. <!-- Creation date / Date modified -->
  55. <a href="{{ post.url }}">
  56. {{ post.date_created|format_date('%d %B %Y - %H:%M') }}
  57. </a>
  58. {% if post.user_id and post.date_modified %}
  59. <small>
  60. (Last modified: {{ post.date_modified|format_date('%d %B %Y - %H:%M') }} by
  61. <a href="{{ url_for('user.profile', username=post.modified_by) }}">{{ post.modified_by }}</a>.)
  62. </small>
  63. {% endif %}
  64. </div>
  65. <!-- Post number -->
  66. <div class="pull-right">
  67. <strong>#{{ generate_obj_id(posts, loop.index, flaskbb_config["POSTS_PER_PAGE"]) }}</strong>
  68. </div>
  69. </div>
  70. <div class="post-content clearfix" id="pid{{ post.id }}">
  71. {% if post.hidden %}
  72. <div class="alert alert-warning">
  73. <span class="fa fa-user-secret"></span>
  74. {{ gettext("This post is hidden (%(when)s by %(who)s)", who=post.hidden_by.username, when=format_date(post.hidden_at, '%b %d %Y'))}}
  75. </div>
  76. {% endif %}
  77. {{ post.content|markup }}
  78. <!-- Signature Begin -->
  79. {% if flaskbb_config["SIGNATURE_ENABLED"] and post.user_id and user.signature %}
  80. <div class="post-signature hidden-xs">
  81. <hr />
  82. {{ user.signature|markup }}
  83. </div>
  84. {% endif %}
  85. <!-- Signature End -->
  86. </div>
  87. <div class="post-footer clearfix">
  88. <!-- Report/Edit/Delete/Quote Post-->
  89. <div class="post-menu pull-right">
  90. {% if current_user|post_reply(topic) %}
  91. <!-- Quick quote -->
  92. <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>
  93. <!-- Full quote/reply -->
  94. <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>
  95. {% endif %}
  96. {% if current_user|edit_post(post) %}
  97. <!-- Edit Post -->
  98. <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>
  99. {% endif %}
  100. {% if topic.first_post_id == post.id %}
  101. {% if current_user|delete_topic(topic) %}
  102. <form class="inline-form" method="post" action="{{ url_for('forum.delete_topic', topic_id=topic.id, slug=topic.slug) }}">
  103. <input type="hidden" name="csrf_token" value="{{ csrf_token() }}" />
  104. <button class="btn btn-icon icon-delete" name="confirmDialog" data-toggle="tooltip" data-placement="top" title="Delete this topic"></button>
  105. </form>
  106. {% endif %}
  107. {% else %}
  108. {% if current_user|delete_post(post) %}
  109. <!-- Delete Post -->
  110. <form class="inline-form" method="post" action="{{ url_for('forum.delete_post', post_id=post.id) }}">
  111. <input type="hidden" name="csrf_token" value="{{ csrf_token() }}" />
  112. <button class="btn btn-icon icon-delete" name="confirmDialog" data-toggle="tooltip" data-placement="top" title="Delete this post"></button>
  113. </form>
  114. {% endif %}
  115. {% endif %}
  116. {% if current_user.is_authenticated %}
  117. <!-- Report post -->
  118. <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>
  119. {% endif %}
  120. {% if current_user.permissions.get('makehidden') %}
  121. {% if topic.first_post_id == post.id %}
  122. {% if topic.hidden %}
  123. <form class="inline-form" method="post" action="{{ url_for('forum.unhide_topic', topic_id=topic.id) }}">
  124. <input type="hidden" name="csrf_token" value="{{ csrf_token() }}" />
  125. <button class="btn btn-icon fa fa-user" name="unhide" data-toggle="tooltip" data-placement="top" title="Unhide this topic"></button>
  126. </form>
  127. {% else %}
  128. <form class="inline-form" method="post" action="{{ url_for('forum.hide_topic', topic_id=topic.id) }}">
  129. <input type="hidden" name="csrf_token" value="{{ csrf_token() }}" />
  130. <button class="btn btn-icon fa fa-user-secret" name="hide" data-toggle="tooltip" data-placement="top" title="Hide this topic"></button>
  131. </form>
  132. {% endif %}
  133. {% else %}
  134. {% if post.hidden %}
  135. <form class="inline-form" method="post" action="{{ url_for('forum.unhide_post', post_id=post.id) }}">
  136. <input type="hidden" name="csrf_token" value="{{ csrf_token() }}" />
  137. <button class="btn btn-icon fa fa-user" name="unhide" data-toggle="tooltip" data-placement="top" title="Unhide this post"></button>
  138. </form>
  139. {% else %}
  140. <form class="inline-form" method="post" action="{{ url_for('forum.hide_post', post_id=post.id) }}">
  141. <input type="hidden" name="csrf_token" value="{{ csrf_token() }}" />
  142. <button class="btn btn-icon fa fa-user-secret" name="hide" data-toggle="tooltip" data-placement="top" title="Hide this post"></button>
  143. </form>
  144. {% endif %}
  145. {% endif %}
  146. {% endif %}
  147. </div> <!-- end post-menu -->
  148. </div> <!-- end footer -->
  149. </div>
  150. </div>
  151. {% endfor %}
  152. </div> <!-- end topic-body -->
  153. </div> <!-- end topic-panel -->
  154. {% include theme('forum/topic_controls.html') %}
  155. {% from theme("macros.html") import render_field, render_quickreply, render_submit_field %}
  156. {% if form %}
  157. <form class="form" action="#" method="post">
  158. {{ form.hidden_tag() }}
  159. <div class="row">
  160. <div class="col-md-offset-2 col-sm-offset-3 col-md-10 col-sm-9 col-xs-12">
  161. <div class="editor-box">
  162. <div class="editor quickreply">
  163. {{ render_quickreply(form.content, div_class="new-message", rows=7, cols=75, placeholder="", **{'data-provide': 'markdown', 'data-autofocus': 'false', 'class': 'flaskbb-editor'}) }}
  164. </div>
  165. <div class="editor-submit">
  166. {{ render_submit_field(form.submit, input_class="btn btn-success pull-right") }}
  167. </div>
  168. </div>
  169. </div>
  170. </div>
  171. </form>
  172. {% include theme('editor_help.html') %}
  173. {% endif %}
  174. </div>
  175. {% include theme('confirm_dialog.html') %}
  176. {% endblock %}