topic_horizontal.html 12 KB

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