topic.html 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  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. <li><a href="{{ url_for('forum.view_category', category_id=topic.forum.category.id) }}">{{ topic.forum.category.title }}</a></li>
  9. <li><a href="{{ url_for('forum.view_forum', forum_id=topic.forum_id) }}">{{ topic.forum.title }}</a></li>
  10. <li class="active">{{ topic.title }}</li>
  11. </ol>
  12. <div class="pull-left" style="padding-bottom: 10px">
  13. {{ render_pagination(posts, url_for('forum.view_topic', topic_id=topic.id)) }}
  14. </div> <!-- end span pagination -->
  15. <div class="pull-right" style="padding-bottom: 10px">
  16. {% if current_user|post_reply() %}
  17. <a href="{{ url_for('forum.new_post', topic_id=topic.id) }}" class="btn btn-primary">Reply</a>
  18. {% endif %}
  19. {% if current_user|delete_topic(topic) %}
  20. <a href="{{ url_for('forum.delete_topic', topic_id=topic.id) }}" class="btn btn-primary">Delete Topic</a>
  21. {% endif %}
  22. </div>
  23. <table class="table table-bordered">
  24. <tbody>
  25. {% for post in posts.items %}
  26. <tr>
  27. <td >
  28. <span class="pull-right">
  29. <strong>#{%- if posts.page == 1 -%} {{ loop.index }} {%- else -%} {{ loop.index + posts.page * per_page }} {%- endif -%}</strong>
  30. </span>
  31. <span class="pull-left">
  32. <a href="
  33. {% if posts.page > 1 %}
  34. {{ url_for('forum.view_topic', topic_id=topic.id) }}?page={{ posts.page }}#pid{{ post.id }}
  35. {% else %}
  36. {{ url_for('forum.view_topic', topic_id=topic.id) }}#pid{{ post.id }}
  37. {% endif %}
  38. ">{{ post.date_created|format_date('%d %B %Y') }}</a>
  39. {% if post.date_modified %}
  40. <small>
  41. (Last modified: {{ post.date_modified|format_date }} by <a href="{{ url_for('user.profile', username=post.user.username) }}">{{ post.user.username }}</a>.)
  42. </small>
  43. {% endif %}
  44. </span>
  45. </td>
  46. </tr>
  47. <tr>
  48. <td>
  49. <table class="table table-borderless">
  50. <tr>
  51. {% if post.user.avatar %}
  52. <td width="1">
  53. <img src="{{ post.user.avatar }}" alt="Avatar" height="100" width="100">
  54. </td>
  55. {% endif %}
  56. <td>
  57. <a href="{{ url_for('user.profile', username=post.user.username) }}"><span style="color: green;"><strong><em>{{ post.user.username }}</em></strong></span></a>
  58. {% if post.user|is_online %}
  59. <span class="label label-success">Online</span>
  60. {% else %}
  61. <span class="label label-default">Offline</span>
  62. {% endif %}
  63. <br />
  64. {{ post.user.primary_group.name }}<br />
  65. </td>
  66. <td class="pull-right">
  67. Posts: {{ post.user.post_count }}<br />
  68. Registered since: {{ post.user.date_joined|format_date('%b %d %Y') }}<br />
  69. </td>
  70. </tr>
  71. </table>
  72. </td>
  73. </tr>
  74. <tr>
  75. <td>
  76. <div class="post_body" id="pid{{ post.id }}">
  77. {{ post.content }}
  78. <!-- Signaure Begin -->
  79. {% if post.user.signature %}
  80. <hr>
  81. {{ post.user.signature }}
  82. {% endif %}
  83. <!-- Signaure End -->
  84. </div>
  85. </td>
  86. </tr>
  87. <tr>
  88. <td>
  89. <span class="pull-left">
  90. <a href="{{ url_for('pms.new_message') }}?to_user={{ post.user.username }}">PM</a>
  91. {% if post.user.website %}| <a href="{{post.user.website}}">Website</a>{% endif %}
  92. </span>
  93. <span class="pull-right">
  94. {% if current_user|edit_post(post) %}
  95. <a href="{{ url_for('forum.edit_post', post_id=post.id) }}">Edit</a> |
  96. {% endif %}
  97. {% if current_user|delete_post(post) %}
  98. <a href="{{ url_for('forum.delete_post', post_id=post.id) }}">Delete</a> |
  99. {% endif %}
  100. <a href="#">Quote</a>
  101. </span>
  102. </td>
  103. </tr>
  104. {% endfor %}
  105. </tbody>
  106. </table>
  107. {% if current_user|post_reply() %}
  108. <form class="form" action="#" method="post">
  109. {{ form.hidden_tag() }}
  110. <div class="form-group">
  111. {{ form.content(rows="6", class="form-control") }}
  112. </div>
  113. <button type="submit" class="btn btn-success">Reply!</button>
  114. </form>
  115. {% endif %}
  116. {% endblock %}