forum.html 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. {% set page_title = forum[0].title %}
  2. {% set active_forum_nav=True %}
  3. {% extends theme("layout.html") %}
  4. {% block content %}
  5. {% from theme('macros.html') import render_pagination, topic_pages %}
  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=forum[0].category.id) }}">{{ forum[0].category.title }}</a></li>
  9. <li class="active">{{ forum[0].title }}</li>
  10. </ol>
  11. <div class="pull-left" style="padding-bottom: 10px">
  12. {{ render_pagination(topics, url_for('forum.view_forum', forum_id=forum[0].id)) }}
  13. </div> <!-- end span pagination -->
  14. {% if current_user|post_topic(forum[0]) %}
  15. <div class="pull-right" style="padding-bottom: 10px">
  16. <div class="btn-group">
  17. <a href="{{ url_for('forum.markread', forum_id=forum[0].id) }}" class="btn btn-default">
  18. <span class="fa fa-check"></span> Mark as Read
  19. </a>
  20. {% if forum[0].locked %}
  21. <span class="btn btn-primary">
  22. <span class="fa fa-lock"></span> Locked
  23. </span>
  24. {% else %}
  25. <a href="{{ url_for('forum.new_topic', forum_id=forum[0].id) }}" class="btn btn-primary">
  26. <span class="fa fa-pencil"></span> New Topic
  27. </a>
  28. {% endif %}
  29. </div>
  30. </div>
  31. {% endif %}
  32. <table class="table table-bordered">
  33. <thead>
  34. <tr>
  35. <th colspan="5">
  36. {{ forum[0].title }}
  37. </th>
  38. </tr>
  39. </thead>
  40. <tbody>
  41. <tr>
  42. <td colspan="2">Topic</td>
  43. <td>Posts</td>
  44. <td>Views</td>
  45. <td>Last Post</td>
  46. </tr>
  47. {% for topic, topicread in topics.items %}
  48. <tr>
  49. <td width="4%">
  50. {% if topic.locked %}
  51. <span class="fa fa-locked" style="font-size: 2em"></span>
  52. {% else %}
  53. {% if topic|topic_is_unread(topicread, current_user, forum[1]) %}
  54. <span class="fa fa-comment" style="font-size: 2em"></span>
  55. {% else %}
  56. <span class="fa fa-comment-o" style="font-size: 2em"></span>
  57. {% endif %}
  58. {% endif %}
  59. </td>
  60. <td>
  61. <div>
  62. <a href="{{ url_for('forum.view_topic', topic_id=topic.id) }}">{{ topic.title }}</a>
  63. <!-- Topic Pagination -->
  64. {{ topic_pages(topic, config["POSTS_PER_PAGE"]) }}
  65. <br />
  66. {% if topic.user_id %}
  67. <small>by <a href="{{ url_for('user.profile', username=topic.user.username) }}">{{ topic.user.username }}</a></small>
  68. {% else %}
  69. <small>by {{ topic.username }}</small>
  70. {% endif %}
  71. </div>
  72. </td>
  73. <td>
  74. {{ topic.post_count }}
  75. </td>
  76. <td>
  77. {{ topic.views }}
  78. </td>
  79. <td>
  80. <a href="{{ url_for('forum.view_post', post_id=topic.last_post.id) }}">{{ topic.last_post.date_created|time_since }}</a><br />
  81. {% if topic.last_post.user_id %}
  82. <small>by <a href="{{ url_for('user.profile', username=topic.last_post.user.username) }}">{{ topic.last_post.user.username }}</a></small>
  83. {% else %}
  84. <small>{{ topic.last_post.username }}</small>
  85. {% endif %}
  86. </td>
  87. </tr>
  88. {% else %}
  89. <tr>
  90. <td colspan="5">
  91. No Topics so far.
  92. </td>
  93. </tr>
  94. {% endfor %}
  95. </tbody>
  96. </table>
  97. {% endblock %}