topic.html 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155
  1. {% set page_title = topic.title ~ " - Topic" %}
  2. {% set active_forum_nav=True %}
  3. {% extends "layout.html" %}
  4. {% block content %}
  5. {% from 'macros.html' import render_pagination, form_field %}
  6. <ol class="breadcrumb">
  7. <li><a href="{{ url_for('forum.index') }}">Forum</a></li>
  8. {% for breadcrumb_item in topic.forum.get_breadcrumbs() %}
  9. <li><a href="{{ url_for('forum.view_forum', forum_id=breadcrumb_item.id) }}">{{ breadcrumb_item.title }}</a></li>
  10. {% endfor %}
  11. <li><a href="{{ url_for('forum.view_forum', forum_id=topic.forum.id) }}">{{ topic.forum.title }}</a></li>
  12. <li class="active">{{ topic.title }}</li>
  13. </ol>
  14. <div class="pull-left" style="padding-bottom: 10px">
  15. {{ render_pagination(posts, url_for('forum.view_topic', topic_id=topic.id)) }}
  16. </div> <!-- end span pagination -->
  17. <div class="pull-right" style="padding-bottom: 10px">
  18. {% if current_user|post_reply(topic.forum) and not topic.locked %}
  19. <a href="{{ url_for('forum.new_post', topic_id=topic.id) }}" class="btn btn-primary">Reply</a>
  20. {% endif %}
  21. {% if current_user|delete_topic(topic.first_post.user_id, topic.forum) %}
  22. <a href="{{ url_for('forum.delete_topic', topic_id=topic.id) }}" class="btn btn-primary">Delete Topic</a>
  23. {% endif %}
  24. {% if current_user.is_authenticated() %}
  25. {% if current_user.is_tracking_topic(topic) %}
  26. <a href="{{ url_for('forum.untrack_topic', topic_id=topic.id) }}" class="btn btn-primary">Untrack Topic</a>
  27. {% else %}
  28. <a href="{{ url_for('forum.track_topic', topic_id=topic.id) }}" class="btn btn-primary">Track Topic</a>
  29. {% endif %}
  30. {% endif %}
  31. </div>
  32. <table class="table table-bordered">
  33. <tbody>
  34. {% for post in posts.items %}
  35. <tr>
  36. <td >
  37. <span class="pull-right">
  38. <strong>#{%- if posts.page == 1 -%} {{ loop.index }} {%- else -%} {{ loop.index + (posts.page - 1) * per_page }} {%- endif -%}</strong>
  39. </span>
  40. <span class="pull-left">
  41. <a href="
  42. {% if posts.page > 1 %}
  43. {{ url_for('forum.view_topic', topic_id=topic.id) }}?page={{ posts.page }}#pid{{ post.id }}
  44. {% else %}
  45. {{ url_for('forum.view_topic', topic_id=topic.id) }}#pid{{ post.id }}
  46. {% endif %}
  47. ">{{ post.date_created|format_date('%d %B %Y') }}</a>
  48. {% if post.date_modified %}
  49. <small>
  50. (Last modified: {{ post.date_modified|format_date }} by <a href="{{ url_for('user.profile', username=post.user.username) }}">{{ post.user.username }}</a>.)
  51. </small>
  52. {% endif %}
  53. </span>
  54. </td>
  55. </tr>
  56. <tr>
  57. <td>
  58. <table class="table table-borderless">
  59. <tr>
  60. {% if post.user.avatar %}
  61. <td width="1">
  62. <img src="{{ post.user.avatar }}" alt="Avatar" height="100" width="100">
  63. </td>
  64. {% endif %}
  65. <td>
  66. <a href="{{ url_for('user.profile', username=post.user.username) }}"><span style="color: green;"><strong><em>{{ post.user.username }}</em></strong></span></a>
  67. {% if post.user|is_online %}
  68. <span class="label label-success">Online</span>
  69. {% else %}
  70. <span class="label label-default">Offline</span>
  71. {% endif %}
  72. <br />
  73. {{ post.user.primary_group.name }}<br />
  74. </td>
  75. <td class="pull-right">
  76. Posts: {{ post.user.post_count }}<br />
  77. Registered since: {{ post.user.date_joined|format_date('%b %d %Y') }}<br />
  78. </td>
  79. </tr>
  80. </table>
  81. </td>
  82. </tr>
  83. <tr>
  84. <td>
  85. <div class="post_body" id="pid{{ post.id }}">
  86. {% autoescape false %}
  87. {{ post.content|markup }}
  88. <!-- Signaure Begin -->
  89. {% if post.user.signature %}
  90. <hr>
  91. {{ post.user.signature|markup }}
  92. {% endif %}
  93. <!-- Signaure End -->
  94. {% endautoescape %}
  95. </div>
  96. </td>
  97. </tr>
  98. <tr>
  99. <td>
  100. <span class="pull-left">
  101. {% if current_user.is_authenticated %}
  102. <a href="{{ url_for('user.new_message') }}?to_user={{ post.user.username }}">PM</a>
  103. {% endif %}
  104. {% if post.user.website %}
  105. | <a href="{{post.user.website}}">Website</a>
  106. {% endif %}
  107. </span>
  108. <span class="pull-right">
  109. {% if current_user|edit_post(post.user_id, topic.forum) %}
  110. <a href="{{ url_for('forum.edit_post', post_id=post.id) }}">Edit</a> |
  111. {% endif %}
  112. {% if topic.first_post_id == post.id %}
  113. {% if current_user|delete_topic(topic.first_post.user_id, topic.forum) %}
  114. <a href="{{ url_for('forum.delete_topic', topic_id=topic.id) }}">Delete</a> |
  115. {% endif %}
  116. {% else %}
  117. {% if current_user|delete_post(post.user_id, topic.forum) %}
  118. <a href="{{ url_for('forum.delete_post', post_id=post.id) }}">Delete</a> |
  119. {% endif %}
  120. {% endif %}
  121. <a href="#">Quote</a>
  122. </span>
  123. </td>
  124. </tr>
  125. {% endfor %}
  126. </tbody>
  127. </table>
  128. {% if form %}
  129. {% from "macros.html" import render_field %}
  130. <form class="form" action="#" method="post">
  131. {{ form.hidden_tag() }}
  132. {{ render_field(form.content, div_class="col-sm-12", rows=5) }}
  133. <button type="submit" class="btn btn-success">Reply!</button>
  134. </form>
  135. {% endif %}
  136. {% endblock %}