list.html 9.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154
  1. {% extends "cranefly/layout.html" %}
  2. {% load i18n %}
  3. {% load url from future %}
  4. {% import "_forms.html" as form_theme with context %}
  5. {% import "cranefly/macros.html" as macros with context %}
  6. {% block title %}{{ macros.page_title(title=forum.name,page=pagination['page']) }}{% endblock %}
  7. {% block breadcrumb %}{{ super() }} <span class="divider"><i class="icon-chevron-right"></i></span></li>
  8. {% for parent in parents %}
  9. <li><a href="{{ parent.type|url(forum=parent.pk, slug=parent.slug) }}">{{ parent.name }}</a> <span class="divider">/</span></li>
  10. {% endfor %}
  11. <li class="active">{{ forum.name }}
  12. {%- endblock %}
  13. {% block content %}
  14. <div class="page-header">
  15. <ul class="breadcrumb">
  16. {{ self.breadcrumb() }}</li>
  17. </ul>
  18. <h1>{{ forum.name }}{% if forum.description %}<br><small>{{ forum.description }}</small>{% endif %}</h1>
  19. </div>
  20. {% if forum.subforums %}
  21. <div class="forums-list subforums-list">
  22. <h3>{% trans %}Subforums{% endtrans %}:</h3>
  23. <div class="category{% if forum.style %} {{ forum.style }}{% endif %}">
  24. {{ macros.draw_forums(forum, 12) }}
  25. </div>
  26. </div>
  27. {% endif %}
  28. {% if message %}{{ macros.draw_message(message) }}{% endif %}
  29. <div class="list-nav">
  30. {{ pager() }}
  31. {% if user.is_authenticated() and acl.threads.can_start_threads(forum) %}
  32. <ul class="nav nav-pills pull-right">
  33. <li class="primary"><a href="{% url 'thread_new' forum=forum.pk, slug=forum.slug %}"><i class="icon-plus"></i> {% trans %}New Thread{% endtrans %}</a></li>
  34. </ul>
  35. {% endif %}
  36. </div>
  37. <table class="table table-striped threads-list">
  38. <thead>
  39. <tr>
  40. <th style="width: 1%;">&nbsp;</th>
  41. <th>{% trans %}Thread{% endtrans %}</th>
  42. <th>{% trans %}Author{% endtrans %}</th>
  43. <th>{% trans %}Replies{% endtrans %}</th>
  44. <th>{% trans %}Last Poster{% endtrans %}</th>
  45. {% if user.is_authenticated() and list_form %}
  46. <th class="check-cell"><label class="checkbox"><input type="checkbox" class="checkbox-master"></label></th>
  47. {% endif %}
  48. </tr>
  49. </thead>
  50. <tbody>
  51. {% for thread in threads %}
  52. <tr>
  53. <td><span class="thread-icon{% if not thread.is_read %} {% if thread.closed %}thread-closed{% else %}thread-new{% endif %}{% endif %}"><i class="icon-comment icon-white"></i></span></td>
  54. <td>
  55. {% if thread.weight > 0 %}<strong>
  56. {% if thread.weight == 2 %}
  57. <i class="icon-fire"></i> {% trans %}Annoucement:{% endtrans %}
  58. {%- else -%}
  59. <i class="icon-asterisk"></i> {% trans %}Sticky:{% endtrans %}
  60. {%- endif %}</strong> {% endif %}<a href="{% url 'thread' thread=thread.pk, slug=thread.slug %}">{% if not thread.is_read %}<strong>{{ thread.name }}</strong>{% else %}{{ thread.name }}{% endif %}</a> {% if not user.is_crawler() %}{% if not thread.is_read -%}
  61. <a href="{% url 'thread_new' thread=thread.pk, slug=thread.slug %}" class="jump jump-new tooltip-top" title="{% trans %}Jump to first unread post{% endtrans %}"><i class="icon-chevron-right"></i></a>
  62. {%- else -%}
  63. <a href="{% url 'thread_last' thread=thread.pk, slug=thread.slug %}" class="jump jump-last tooltip-top" title="{% trans %}Jump to last post{% endtrans %}"><i class="icon-chevron-right"></i></a>
  64. {%- endif %}{% endif %}
  65. <ul class="unstyled thread-flags">
  66. {% if thread.closed %}<li><span class="tooltip-top" title="{% trans %}This thread is closed for new replies.{% endtrans %}"><i class="icon-lock"></i></span></li>{% endif %}
  67. {% if thread.moderated %}<li><span class="tooltip-top" title="{% trans %}This thread will not be visible to other members until moderator reviews it.{% endtrans %}"><i class="icon-eye-close"></i></span></li>{% endif %}
  68. {% if thread.deleted %}<li><span class="tooltip-top" title="{% trans %}This thread has been deleted.{% endtrans %}"><i class="icon-remove"></i></span></li>{% endif %}
  69. </ul>
  70. </td>
  71. <td class="span3 thread-author"><span class="tooltip-top" title="{{ thread.start|reltimesince }}">{% if thread.start_poster_id -%}
  72. {% if settings.avatars_on_threads_list %}<img src="{{ thread.start_poster.get_avatar(24) }}" alt="" class="avatar-tiny"> {% endif %}<a href="{% url 'user' user=thread.start_poster_id, username=thread.start_poster_slug %}">{{ thread.start_poster_name }}</a>
  73. {%- else -%}
  74. {% if settings.avatars_on_threads_list %}<img src="{{ macros.avatar_guest(24) }}" alt="" class="avatar-tiny"> {% endif %}<em class="muted">{{ thread.start_poster_name }}</em>
  75. {% endif %}</span></td>
  76. <td class="span1 thread-stat">{{ thread.replies|intcomma }}</td>
  77. <td class="span3 thread-poster"><span class="tooltip-top" title="{{ thread.last|reltimesince }}">{% if thread.last_poster_ignored -%}
  78. {% if settings.avatars_on_threads_list %}<img src="{{ macros.avatar_guest(24) }}" alt="" class="avatar-tiny"> {% endif %}<em class="muted">{% trans %}Ignored Member{% endtrans %}</em>
  79. {%- elif thread.last_poster_id -%}
  80. {% if settings.avatars_on_threads_list %}<img src="{{ thread.last_poster.get_avatar(24) }}" alt="" class="avatar-tiny"> {% endif %}<a href="{% url 'user' user=thread.last_poster_id, username=thread.last_poster_slug %}">{{ thread.last_poster_name }}</a>
  81. {%- else -%}
  82. {% if settings.avatars_on_threads_list %}<img src="{{ macros.avatar_guest(24) }}" alt="" class="avatar-tiny"> {% endif %}<em class="muted">{{ thread.last_poster_name }}</em>
  83. {%- endif %}</span></td>
  84. {% if user.is_authenticated() and list_form %}
  85. <td class="check-cell">{% if thread.forum_id == forum.pk %}<label class="checkbox"><input form="threads_form" name="{{ list_form['list_items']['html_name'] }}" type="checkbox" class="checkbox-member" value="{{ thread.pk }}"{% if list_form['list_items']['has_value'] and ('' ~ thread.pk) in list_form['list_items']['value'] %} checked="checked"{% endif %}></label>{% else %}&nbsp;{% endif %}</td>
  86. {% endif %}
  87. </tr>
  88. {% else %}
  89. <tr>
  90. <td colspan="5" style="text-align: center;">
  91. <p class="lead">{% trans %}Looks like there are no threads in this forum.{% endtrans %}</p>
  92. {% if user.is_authenticated() and acl.threads.can_start_threads(forum) %}
  93. <a href="{% url 'thread_new' forum=forum.pk, slug=forum.slug %}" class="btn btn-primary btn-large">{% trans %}Let's Change This!{% endtrans %}</a></li>
  94. {% endif %}
  95. </td>
  96. </tr>
  97. {% endfor %}
  98. </tbody>
  99. </table>
  100. {% if user.is_authenticated() and list_form %}
  101. <div class="form-actions table-footer">
  102. <form id="threads_form" class="form-inline pull-right" action="{% url 'forum' slug=forum.slug, forum=forum.id, page=pagination['page'] %}" method="POST">
  103. <input type="hidden" name="{{ csrf_id }}" value="{{ csrf_token }}">
  104. {{ form_theme.input_select(list_form['list_action'],width=3) }}
  105. <button type="submit" class="btn btn-primary">{% trans %}Go{% endtrans %}</button>
  106. </form>
  107. </div>
  108. {% endif %}
  109. <div class="list-nav last">
  110. {{ pager() }}
  111. {% if user.is_authenticated() and acl.threads.can_start_threads(forum) %}
  112. <ul class="nav nav-pills pull-right">
  113. <li class="primary"><a href="{% url 'thread_new' forum=forum.pk, slug=forum.slug %}"><i class="icon-plus"></i> {% trans %}New Thread{% endtrans %}</a></li>
  114. </ul>
  115. {% endif %}
  116. </div>
  117. {% endblock %}
  118. {% macro pager() %}
  119. <ul class="pager pull-left">
  120. {%- if pagination['prev'] > 1 %}<li><a href="{% url 'forum' slug=forum.slug, forum=forum.id %}" class="tooltip-top" title="{% trans %}First Page{% endtrans %}"><i class="icon-chevron-left"></i> {% trans %}First{% endtrans %}</a></li>{% endif -%}
  121. {%- if pagination['prev'] > 0 %}<li><a href="{%- if pagination['prev'] > 1 %}{% url 'forum' slug=forum.slug, forum=forum.id, page=pagination['prev'] %}{% else %}{% url 'forum' slug=forum.slug, forum=forum.id %}{% endif %}" class="tooltip-top" title="{% trans %}Newest Threads{% endtrans %}"><i class="icon-chevron-left"></i></a></li>{% endif -%}
  122. {%- if pagination['next'] > 0 %}<li><a href="{% url 'forum' slug=forum.slug, forum=forum.id, page=pagination['next'] %}" class="tooltip-top" title="{% trans %}Older Threads{% endtrans %}"><i class="icon-chevron-right"></i></a></li>{% endif -%}
  123. <li class="count">
  124. {%- trans current_page=pagination['page'], pages=pagination['total'] -%}
  125. Page {{ current_page }} of {{ pages }}
  126. {%- endtrans -%}
  127. </li>
  128. </ul>
  129. {% endmacro %}
  130. {% block javascripts -%}
  131. {{ super() }}
  132. {%- if user.is_authenticated() and list_form %}
  133. <script type="text/javascript">
  134. $(function () {
  135. $('#threads_form').submit(function() {
  136. if ($('.check-cell[]:checked').length == 0) {
  137. alert("{% trans %}You have to select at least one thread.{% endtrans %}");
  138. return false;
  139. }
  140. if ($('#id_list_action').val() == 'hard') {
  141. var decision = confirm("{% trans %}Are you sure you want to delete selected threads? This action is not reversible!{% endtrans %}");
  142. return decision;
  143. }
  144. return true;
  145. });
  146. });
  147. </script>{% endif %}
  148. {%- endblock %}