list.html 8.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188
  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. <div class="header">
  32. <div class="row-fluid">
  33. <div class="span7">{% trans %}Thread{% endtrans %}</div>
  34. <div class="span5 thread-activity">
  35. <div class="thread-replies">{% trans %}Replies{% endtrans %}</div>
  36. <div class="thread-last">{% trans %}Last Reply{% endtrans %}</div>
  37. {% if list_form %}
  38. <div class="pull-right check-cell">
  39. <label class="checkbox"><input type="checkbox" class="checkbox-master"></label>
  40. </div>
  41. {% endif %}
  42. </div>
  43. </div>
  44. </div>
  45. {% for thread in threads %}
  46. <div class="thread-row{% if thread.pk == 2 or not thread.is_read %} thread-new{% endif %}{% if loop.last %} thread-last{% endif %}">
  47. <div class="row-fluid">
  48. <div class="span7">
  49. {% if thread.is_read and not thread.pk == 2 %}
  50. <a href="{% url 'thread_new' thread=thread.pk, slug=thread.slug %}" class="thread-icon thread-icon-last tooltip-top" title="{% trans %}Click to see last post{% endtrans %}"><i class="icon-asterisk"></i></a>
  51. {% else %}
  52. <a href="{% url 'thread_new' thread=thread.pk, slug=thread.slug %}" class="thread-icon thread-icon-new tooltip-top" title="{% trans %}Click to see first unread post{% endtrans %}"><i class="icon-fire"></i></a>
  53. {% endif %}
  54. <a href="{% url 'thread' thread=thread.pk, slug=thread.slug %}" class="thread-name">{{ thread.name }}</a>
  55. <span class="thread-details">
  56. {% trans user=thread_starter(thread), start=thread.start|reldate|low %}by {{ user }}, {{ start }}{% endtrans %}
  57. </span>
  58. <ul class="unstyled thread-flags">
  59. {% if thread.replies_reported %}
  60. <li><i class="icon-warning-sign tooltip-top" title="{% trans %}This thread has reported replies{% endtrans %}"></i></li>
  61. {% endif %}
  62. {% if thread.replies_moderated %}
  63. <li><i class="icon-question-sign tooltip-top" title="{% trans %}This thread has unreviewed replies{% endtrans %}"></i></li>
  64. {% endif %}
  65. {% if thread.weight == 2 %}
  66. <li><i class="icon-star tooltip-top" title="{% trans %}This thread is an annoucement{% endtrans %}"></i></li>
  67. {% endif %}
  68. {% if thread.weight == 1 %}
  69. <li><i class="icon-star-empty tooltip-top" title="{% trans %}This thread is sticky{% endtrans %}"></i></li>
  70. {% endif %}
  71. {% if thread.moderated %}
  72. <li><i class="icon-eye-close tooltip-top" title="{% trans %}This thread awaits review{% endtrans %}"></i></li>
  73. {% endif %}
  74. {% if thread.deleted %}
  75. <li><i class="icon-trash tooltip-top" title="{% trans %}This thread is deleted{% endtrans %}"></i></li>
  76. {% endif %}
  77. {% if thread.closed %}
  78. <li><i class="icon-lock tooltip-top" title="{% trans %}This thread is closed{% endtrans %}"></i></li>
  79. {% endif %}
  80. </ul>
  81. </div>
  82. <div class="span5 thread-activity">
  83. <div class="thread-replies tooltip-top" title="{{ replies(thread.replies) }}">{{ thread.replies|intcomma }} <i class="icon-comment"></i></div>
  84. <div class="thread-last-reply">
  85. {% if settings.avatars_on_threads_list %}
  86. <span class="thread-last-avatar">
  87. {% if thread.last_poster_id %}
  88. <a href="{% url 'user' user=thread.last_poster.pk, username=thread.last_poster.username_slug %}"><img src="{{ thread.last_poster.get_avatar(30) }}" alt=""></a>
  89. {% else %}
  90. <img src="{{ macros.avatar_guest(40) }}" alt="" class="user-avatar">
  91. {% endif %}
  92. </span>
  93. {% endif %}
  94. {{ thread_reply(thread) }}, {{ thread.last|reldate|low }}
  95. </div>
  96. {% if list_form %}
  97. <label class="thread-select 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>
  98. {% endif %}
  99. </div>
  100. </div>
  101. </div>
  102. {% else %}
  103. <div class="thread-row threads-list-empty">
  104. {% trans %}You are not participating in any private discussions.{% endtrans %}
  105. </div>
  106. {% endfor %}
  107. {% if list_form %}
  108. <div class="threads-actions">
  109. <form id="threads_form" class="form-inline pull-right" action="{{ request_path }}" method="POST">
  110. <input type="hidden" name="{{ csrf_id }}" value="{{ csrf_token }}">
  111. {{ form_theme.input_select(list_form['list_action'],width=3) }}
  112. <button type="submit" class="btn btn-danger">{% trans %}Go{% endtrans %}</button>
  113. </form>
  114. </div>
  115. {% endif %}
  116. </div>
  117. <div class="forum-threads-extra">
  118. {{ pager() }}
  119. {% if acl.threads.can_start_threads(forum) %}
  120. <a href="{% url 'private_thread_start' %}" class="btn btn-inverse pull-right"><i class="icon-plus"></i> {% trans %}New Thread{% endtrans %}</a>
  121. {% endif %}
  122. </div>
  123. </div>
  124. {% endblock %}
  125. {% macro replies(thread_replies) -%}
  126. {% trans count=thread_replies, replies=thread_replies|intcomma -%}
  127. {{ replies }} reply
  128. {%- pluralize -%}
  129. {{ replies }} replies
  130. {%- endtrans %}
  131. {%- endmacro %}
  132. {% macro thread_starter(thread) -%}
  133. {% 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 %}
  134. {%- endmacro %}
  135. {% macro thread_reply(thread) -%}
  136. {% 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 %}
  137. {%- endmacro %}
  138. {% macro pager() %}
  139. {% if pagination['total'] > 0 %}
  140. <div class="pagination pull-left">
  141. <ul>
  142. <li class="count">{{ macros.pager_label(pagination) }}</li>
  143. {%- 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 -%}
  144. {%- 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 -%}
  145. {%- 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 -%}
  146. </ul>
  147. </div>
  148. {% endif %}
  149. {% endmacro %}
  150. {% block javascripts -%}
  151. {{ super() }}
  152. {%- if list_form %}
  153. <script type="text/javascript">
  154. $(function () {
  155. $('#threads_form').submit(function() {
  156. if ($('.check-cell[]:checked').length == 0) {
  157. alert("{% trans %}You have to select at least one thread.{% endtrans %}");
  158. return false;
  159. }
  160. if ($('#id_list_action').val() == 'hard') {
  161. var decision = confirm("{% trans %}Are you sure you want to delete selected threads? This action is not reversible!{% endtrans %}");
  162. return decision;
  163. }
  164. return true;
  165. });
  166. });
  167. </script>{% endif %}
  168. {%- endblock %}