topic.html 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161
  1. {% extends theme("layout.html") %}
  2. {% set page_title = topic.title ~ " - Topic" %}
  3. {% set active_forum_nav=True %}
  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="{{ topic.forum.category.url }}">{{ topic.forum.category.title }}</a></li>
  9. <li><a href="{{ topic.forum.url }}">{{ topic.forum.title }}</a></li>
  10. <li class="active">{{ topic.title }}</li>
  11. </ol>
  12. {% include 'forum/topic_controls.html' %}
  13. <table class="table table-bordered">
  14. <tbody>
  15. {% for post in posts.items %}
  16. <tr>
  17. <td >
  18. <span class="pull-right">
  19. <strong>#{%- if posts.page == 1 -%} {{ loop.index }} {%- else -%} {{ loop.index + (posts.page - 1) * flaskbb_config["POSTS_PER_PAGE"] }} {%- endif -%}</strong>
  20. </span>
  21. <span class="pull-left">
  22. <a href="
  23. {%- if posts.page > 1 -%}
  24. {{ topic.url }}?page={{ posts.page }}#pid{{ post.id }}
  25. {%- else -%}
  26. {{ topic.url }}#pid{{ post.id }}
  27. {%- endif -%}
  28. ">{{ post.date_created|format_date('%d %B %Y') }}</a>
  29. {% if post.user_id and post.date_modified %}
  30. <small>
  31. (Last modified: {{ post.date_modified|format_date }} by
  32. <a href="{{ url_for('user.profile', username=post.modified_by) }}">
  33. {{ post.modified_by }}
  34. </a>.)
  35. </small>
  36. {% endif %}
  37. </span>
  38. </td>
  39. </tr>
  40. <tr>
  41. <td>
  42. <table class="table table-borderless">
  43. <tr>
  44. {% if post.user_id %}
  45. {% if post.user.avatar %}
  46. <td width="1">
  47. <img src="{{ post.user.avatar }}" alt="Avatar" height="100" width="100">
  48. </td>
  49. {% endif %}
  50. <td>
  51. <a href="{{ post.user.url }}">
  52. <span style="font-weight:bold">{{ post.user.username }}</span> <!-- TODO: Implement userstyles -->
  53. </a>
  54. {%- if post.user|is_online %}
  55. <span class="label label-success">Online</span>
  56. {%- else %}
  57. <span class="label label-default">Offline</span>
  58. {%- endif %}
  59. <div class="profile primary-group">
  60. {{ post.user.primary_group.name }}
  61. </div>
  62. </td>
  63. <td class="pull-right">
  64. Posts: {{ post.user.post_count }}<br />
  65. Registered since: {{ post.user.date_joined|format_date('%b %d %Y') }}<br />
  66. </td>
  67. {% else %}
  68. <td>
  69. <strong>{{ post.username }}</strong>
  70. <br />
  71. Guest
  72. </td>
  73. {% endif %}
  74. </tr>
  75. </table>
  76. </td>
  77. </tr>
  78. <tr>
  79. <td>
  80. <div class="post_body" id="pid{{ post.id }}">
  81. {% autoescape false %}
  82. {{ post.content|markup }}
  83. <!-- Signature Begin -->
  84. {% if post.user_id and post.user.signature %}
  85. <div class="signature">
  86. <hr>
  87. {{ post.user.signature|markup }}
  88. </div>
  89. {% endif %}
  90. <!-- Signature End -->
  91. {% endautoescape %}
  92. </div>
  93. </td>
  94. </tr>
  95. <tr>
  96. <td>
  97. <span class="pull-left">
  98. {% if current_user.is_authenticated() and post.user_id and post.user_id != current_user.id %}
  99. <a href="{{ url_for('user.new_message', to_user=post.user.username) }}">PM</a>
  100. {% endif %}
  101. {% if post.user.website %}
  102. {% if current_user.is_authenticated() %}| {% endif %}<a href="{{post.user.website}}">Website</a>
  103. {% endif %}
  104. </span>
  105. <span class="pull-right">
  106. {% if current_user.is_authenticated() %}
  107. <a href="{{ url_for('forum.report_post', post_id=post.id) }}" onclick="window.open(this.href, 'wio_window','width=500,height=500'); return false;">
  108. Report
  109. </a> |
  110. {% endif %}
  111. {% if current_user|edit_post(post) %}
  112. <a href="{{ url_for('forum.edit_post', post_id=post.id) }}">Edit</a> |
  113. {% endif %}
  114. {% if topic.first_post_id == post.id %}
  115. {% if current_user|delete_topic(topic.first_post.user_id, topic.forum) %}
  116. <a href="{{ url_for('forum.delete_topic', topic_id=topic.id, slug=topic.slug) }}">Delete</a> |
  117. {% endif %}
  118. {% else %}
  119. {% if current_user|delete_post(post.user_id, topic.forum) %}
  120. <a href="{{ url_for('forum.delete_post', post_id=post.id) }}">Delete</a> |
  121. {% endif %}
  122. {% endif %}
  123. {% if current_user|post_reply(topic) %}
  124. <!-- Quick quote -->
  125. <a href="#" class="quote_btn" data-post-id="{{ post.id }}">Quote</a> |
  126. <!-- Full quote/reply -->
  127. <a href="{{ url_for('forum.reply_post', topic_id=topic.id, post_id=post.id) }}">Reply</a>
  128. {% endif %}
  129. </span>
  130. </td>
  131. </tr>
  132. {% endfor %}
  133. </tbody>
  134. </table>
  135. {% include 'forum/topic_controls.html' %}
  136. {% if form %}
  137. {% from "macros.html" import render_field %}
  138. <form class="form" action="#" method="post">
  139. {{ form.hidden_tag() }}
  140. {{ render_field(form.content, div_class="col-sm-12 reply-content", rows=5) }}
  141. <button type="submit" class="btn btn-success">Reply!</button>
  142. </form>
  143. {% endif %}
  144. {% endblock %}
  145. {% block scripts %}
  146. <script type="text/javascript" src="{{ url_for('static', filename='js/topic.js') }}"></script>
  147. {% endblock %}