list.html 8.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184
  1. {% extends "cranefly/layout.html" %}
  2. {% import "_forms.html" as form_theme with context %}
  3. {% import "cranefly/macros.html" as macros with context %}
  4. {% block title %}{{ macros.page_title(title=_("Private Threads"),page=pagination['page']) }}{% endblock %}
  5. {% block breadcrumb %}{{ super() }} <span class="divider"><i class="icon-chevron-right"></i></span></li>
  6. <li class="active">{% trans %}Private Threads{% endtrans %}
  7. {%- endblock %}
  8. {% block container %}
  9. <div class="page-header header-primary">
  10. <div class="container">
  11. {{ messages_list(messages) }}
  12. <ul class="breadcrumb" {{ macros.itemprop_bread() }}>
  13. {{ self.breadcrumb() }}</li>
  14. </ul>
  15. <h1>{% trans %}Private Threads{% endtrans %}</h1>
  16. </div>
  17. </div>
  18. <div class="container container-primary">
  19. {% if message %}
  20. <div class="messages-list">
  21. {{ macros.draw_message(message) }}
  22. </div>
  23. {% endif %}
  24. <div class="forum-threads-extra extra-top">
  25. {{ pager() }}
  26. {% if acl.threads.can_start_threads(forum) %}
  27. <a href="{% url 'private_thread_start' %}" class="btn btn-inverse pull-right"><i class="icon-plus"></i> {% trans %}New Thread{% endtrans %}</a>
  28. {% endif %}
  29. </div>
  30. <div class="forum-threads-list">
  31. <table class="table">
  32. <thead>
  33. <tr>
  34. <th>{% trans %}Thread{% endtrans %}</th>
  35. <th class="span1">{% trans %}Rating{% endtrans %}</th>
  36. <th class="span5">{% trans %}Activity{% endtrans %}</th>
  37. {% if list_form %}
  38. <th class="check-cell"><label class="checkbox"><input type="checkbox" class="checkbox-master"></label></th>
  39. {% endif %}
  40. </tr>
  41. </thead>
  42. <tbody>
  43. {% for thread in threads %}
  44. <tr>
  45. <td>
  46. <a href="{% url 'private_thread_new' thread=thread.pk, slug=thread.slug %}" class="thread-icon{% if not thread.is_read %} thread-new{% endif %} tooltip-top" title="{% if not thread.is_read -%}
  47. {% trans %}Click to see first unread post{% endtrans %}
  48. {%- else -%}
  49. {% trans %}Click to see last post{% endtrans %}
  50. {%- endif %}"><i class="icon-comment"></i></a>
  51. <a href="{% url 'private_thread' thread=thread.pk, slug=thread.slug %}" class="thread-name">{{ thread.name }}</a>
  52. <span class="thread-details">
  53. {% trans user=thread_starter(thread), start=thread.start|reltimesince|low %}by {{ user }} {{ start }}{% endtrans %}
  54. </span>
  55. <ul class="unstyled thread-flags">
  56. {% if thread.replies_reported %}
  57. <li><i class="icon-warning-sign tooltip-top" title="{% trans %}This thread has reported replies{% endtrans %}"></i></li>
  58. {% endif %}
  59. {% if thread.replies_moderated %}
  60. <li><i class="icon-question-sign tooltip-top" title="{% trans %}This thread has unreviewed replies{% endtrans %}"></i></li>
  61. {% endif %}
  62. {% if thread.weight == 2 %}
  63. <li><i class="icon-star tooltip-top" title="{% trans %}This thread is an annoucement{% endtrans %}"></i></li>
  64. {% endif %}
  65. {% if thread.weight == 1 %}
  66. <li><i class="icon-star-empty tooltip-top" title="{% trans %}This thread is sticky{% endtrans %}"></i></li>
  67. {% endif %}
  68. {% if thread.moderated %}
  69. <li><i class="icon-eye-close tooltip-top" title="{% trans %}This thread awaits review{% endtrans %}"></i></li>
  70. {% endif %}
  71. {% if thread.deleted %}
  72. <li><i class="icon-trash tooltip-top" title="{% trans %}This thread is deleted{% endtrans %}"></i></li>
  73. {% endif %}
  74. {% if thread.closed %}
  75. <li><i class="icon-lock tooltip-top" title="{% trans %}This thread is closed{% endtrans %}"></i></li>
  76. {% endif %}
  77. </ul>
  78. </td>
  79. <td>
  80. <div class="thread-rating{% if (thread.upvotes-thread.downvotes) > 0 %} thread-rating-positive{% elif (thread.upvotes-thread.downvotes) < 0 %} thread-rating-negative{% endif %}">
  81. {% if (thread.upvotes-thread.downvotes) > 0 %}+{% elif (thread.upvotes-thread.downvotes) < 0 %}-{% endif %}{{ (thread.upvotes-thread.downvotes)|abs|intcomma }}
  82. </div>
  83. </td>
  84. <td>
  85. <div class="thread-last-reply">
  86. {{ replies(thread.replies) }} - {% trans user=thread_reply(thread), last=thread.last|reltimesince|low %}last by {{ user }} {{ last }}{% endtrans %}
  87. </div>
  88. </td>
  89. {% if list_form %}
  90. <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>
  91. {% endif %}
  92. </tr>
  93. {% else %}
  94. <tr>
  95. <td colspan="4" class="threads-list-empty">
  96. {% if tab == 'all' %}
  97. {% trans %}You are not participating in any private discussions.{% endtrans %}
  98. {% elif tab == 'new' %}
  99. {% trans %}There are no unread private threads.{% endtrans %}
  100. {% else %}
  101. {% trans %}You have started no private threads.{% endtrans %}
  102. {% endif %}
  103. </td>
  104. </tr>
  105. {% endfor %}
  106. </tbody>
  107. </table>
  108. {% if list_form %}
  109. <div class="threads-actions">
  110. <form id="threads_form" class="form-inline pull-right" action="{{ request_path }}" method="POST">
  111. <input type="hidden" name="{{ csrf_id }}" value="{{ csrf_token }}">
  112. {{ form_theme.input_select(list_form['list_action'],width=3) }}
  113. <button type="submit" class="btn btn-danger">{% trans %}Go{% endtrans %}</button>
  114. </form>
  115. </div>
  116. {% endif %}
  117. </div>
  118. <div class="forum-threads-extra">
  119. {{ pager() }}
  120. {% if acl.threads.can_start_threads(forum) %}
  121. <a href="{% url 'private_thread_start' %}" class="btn btn-inverse pull-right"><i class="icon-plus"></i> {% trans %}New Thread{% endtrans %}</a>
  122. {% endif %}
  123. </div>
  124. </div>
  125. {% endblock %}
  126. {% macro replies(thread_replies) -%}
  127. {% trans count=thread_replies, replies=('<strong>' ~ (thread_replies|intcomma) ~ '</strong>')|safe -%}
  128. {{ replies }} reply
  129. {%- pluralize -%}
  130. {{ replies }} replies
  131. {%- endtrans %}
  132. {%- endmacro %}
  133. {% macro thread_starter(thread) -%}
  134. {% if thread.start_poster_id %}<a href="{% url 'user' user=thread.start_poster_id, username=thread.start_poster_slug %}" class="user-link">{{ thread.start_poster_name }}</a>{% else %}{{ thread.start_poster_name }}{% endif %}
  135. {%- endmacro %}
  136. {% macro thread_reply(thread) -%}
  137. {% if thread.last_poster_id %}<a href="{% url 'user' user=thread.last_poster_id, username=thread.last_poster_slug %}" class="user-link">{{ thread.last_poster_name }}</a>{% else %}{{ thread.last_poster_name }}{% endif %}
  138. {%- endmacro %}
  139. {% macro pager() %}
  140. {% if pagination['total'] > 0 %}
  141. <div class="pagination pull-left">
  142. <ul>
  143. <li class="count">{{ macros.pager_label(pagination) }}</li>
  144. {%- if pagination['prev'] > 1 %}<li><a href="{% url 'private_threads' %}" class="tooltip-top" title="{% trans %}First Page{% endtrans %}"><i class="icon-chevron-left"></i> {% trans %}First{% endtrans %}</a></li>{% endif -%}
  145. {%- if pagination['prev'] > 0 %}<li><a href="{%- if pagination['prev'] > 1 %}{% url 'private_threads' page=pagination['prev'] %}{% else %}{% url 'private_threads' %}{% endif %}" class="tooltip-top" title="{% trans %}Newest Threads{% endtrans %}"><i class="icon-chevron-left"></i></a></li>{% endif -%}
  146. {%- if pagination['next'] > 0 %}<li><a href="{% url 'private_threads' page=pagination['next'] %}" class="tooltip-top" title="{% trans %}Older Threads{% endtrans %}"><i class="icon-chevron-right"></i></a></li>{% endif -%}
  147. </ul>
  148. </div>
  149. {% endif %}
  150. {% endmacro %}
  151. {% block javascripts -%}
  152. {{ super() }}
  153. {%- if list_form %}
  154. <script type="text/javascript">
  155. $(function () {
  156. $('#threads_form').submit(function() {
  157. if ($('.check-cell[]:checked').length == 0) {
  158. alert("{% trans %}You have to select at least one thread.{% endtrans %}");
  159. return false;
  160. }
  161. if ($('#id_list_action').val() == 'hard') {
  162. var decision = confirm("{% trans %}Are you sure you want to delete selected threads? This action is not reversible!{% endtrans %}");
  163. return decision;
  164. }
  165. return true;
  166. });
  167. });
  168. </script>{% endif %}
  169. {%- endblock %}