forum.html 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  1. {% set page_title = forum.title ~ " - Forum" %}
  2. {% set active_forum_nav=True %}
  3. {% extends "layout.html" %}
  4. {% block content %}
  5. {% from 'macros.html' import render_pagination %}
  6. <ol class="breadcrumb">
  7. <li><a href="{{ url_for('forum.index') }}">Forum</a></li>
  8. {% for breadcrumb_item in 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 class="active">{{ forum.title }}</li>
  12. </ol>
  13. <div class="pull-left" style="padding-bottom: 10px">
  14. {{ render_pagination(topics, url_for('forum.view_forum', forum_id=forum.id)) }}
  15. </div> <!-- end span pagination -->
  16. {% if current_user|post_topic(forum) and not forum.is_category %}
  17. <div class="pull-right" style="padding-bottom: 10px">
  18. <a href="{{ url_for('forum.new_topic', forum_id=forum.id) }}" class="btn btn-primary">New Topic</a>
  19. </div>
  20. {% endif %}
  21. {% if forum.children|length %}
  22. <table class="table table-bordered">
  23. <thead>
  24. <tr>
  25. <th colspan="5">
  26. Subforums
  27. </th>
  28. </tr>
  29. <tr>
  30. <th colspan="2">Forum</th>
  31. <th width="85" align="center" style="white-space: nowrap">Topics</th>
  32. <th width="85" align="center" style="white-space: nowrap">Posts</th>
  33. <th width="200" align="center" style="white-space: nowrap">Last Post</th>
  34. </tr>
  35. </thead>
  36. <tbody>
  37. {% for subforum in forum.children %}
  38. <tr>
  39. <td align="center" valign="center" width="1">
  40. New </br> Posts
  41. </td>
  42. <td valign="top">
  43. <strong><a href="{{ url_for('forum.view_forum', forum_id=subforum.id) }}">{{ subforum.title }}</a></strong>
  44. <div class="forum-description">
  45. {% autoescape false %}
  46. {{ subforum.description|markup }}
  47. {% endautoescape %}
  48. </div>
  49. {% if subforum.children|length %}
  50. <div class="forum-subforums">
  51. <ul class="list-inline">
  52. <li><strong>Subforums:</strong></li>
  53. {% for subforum2 in subforum.children %}
  54. <li>
  55. <a href="{{ url_for('forum.view_forum', forum_id=subforum2.id) }}">{{ subforum2.title }}</a>
  56. </li>
  57. {% endfor %}
  58. </ul>
  59. </div>
  60. {% endif %}
  61. </td>
  62. <td valign="top" align="center" style="white-space: nowrap">{{ subforum.topic_count }}</td>
  63. <td valign="top" align="center" style="white-space: nowrap">{{ subforum.post_count }}</td>
  64. <td valign="top" align="right" style="white-space: nowrap">
  65. {% if subforum.last_post %}
  66. <a href="{{ url_for('forum.view_post', post_id=subforum.last_post.id) }}" title="{{ subforum.last_post.topic.title }}">
  67. <strong>{{ subforum.last_post.topic.title|crop_title }}</strong>
  68. </a>
  69. <br />
  70. {{ subforum.last_post.date_created|time_since }}<br />
  71. by <a href="{{ url_for('user.profile', username=subforum.last_post.user.username) }}">{{ subforum.last_post.user.username }}</a>
  72. {% else %}
  73. No posts
  74. {% endif %}
  75. </td>
  76. </tr>
  77. {% endfor %}
  78. </tbody>
  79. </table>
  80. {% endif %}
  81. {% if not forum.is_category %}
  82. <table class="table table-bordered">
  83. <thead>
  84. <tr>
  85. <th colspan="5">
  86. {{ forum.title }}
  87. </th>
  88. </tr>
  89. </thead>
  90. <tbody>
  91. <tr>
  92. <td colspan="2">Thread</td>
  93. <td>Posts</td>
  94. <td>Views</td>
  95. <td>Last Post</td>
  96. </tr>
  97. {% for topic in topics.items %}
  98. <tr>
  99. <td width="4%"></td>
  100. <td>
  101. <div>
  102. <a href="{{ url_for('forum.view_topic', topic_id=topic.id) }}">{{ topic.title }}</a> <br />
  103. <small>by <a href="{{ url_for('user.profile', username=topic.user.username) }}">{{ topic.user.username }}</a></small>
  104. </div>
  105. </td>
  106. <td>
  107. {{ topic.post_count }}
  108. </td>
  109. <td>
  110. {{ topic.views }}
  111. </td>
  112. <td>
  113. <a href="{{ url_for('forum.view_post', post_id=topic.last_post.id) }}">{{ topic.last_post.date_created|time_since }}</a><br />
  114. <small>by <a href="{{ url_for('user.profile', username=topic.last_post.user.username) }}">{{ topic.last_post.user.username }}</a></small>
  115. </td>
  116. </tr>
  117. {% else %}
  118. <tr>
  119. <td colspan="5">
  120. No Topics so far.
  121. </td>
  122. </tr>
  123. {% endfor %}
  124. </tbody>
  125. </table>
  126. {% endif %}
  127. {% endblock %}