list.html 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271
  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-new">
  31. {% if threads %}
  32. <ul>
  33. {% for thread in threads %}
  34. <li{% if not thread.is_read %} class="thread-new"{% endif %}>
  35. <div class="thread-icon">
  36. {% if thread.is_read %}
  37. <a href="{{ url('private_thread_new', thread=thread.pk, slug=thread.slug) }}" class="thread-icon thread-icon-last tooltip-top" title="{% trans %}Click to see last post{% endtrans %}">
  38. {% else %}
  39. <a href="{{ url('private_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 %}">
  40. {% endif %}
  41. <i class="icon-circle{% if thread.is_read %}-blank{% endif %}"></i>
  42. </a>
  43. </div>
  44. <div class="thread-body">
  45. <ul class="thread-activity">
  46. {% if thread.replies_reported and acl.threads.can_mod_posts(forum) %}
  47. <li class="thread-replies-reported tooltip-top" title="{% trans %}Reported replies{% endtrans %}">
  48. {{ thread.replies_reported|intcomma }}
  49. </li>
  50. {% endif %}
  51. {% if thread.replies_moderated and acl.threads.can_approve(forum) %}
  52. <li class="thread-replies-moderated tooltip-top" title="{% trans %}Unreviewed replies{% endtrans %}">
  53. {{ thread.replies_moderated|intcomma }}
  54. </li>
  55. {% endif %}
  56. {% if thread.replies %}
  57. <li class="thread-replies tooltip-top" title="{% trans %}Replies{% endtrans %}">
  58. {{ thread.replies|intcomma }}
  59. </li>
  60. {% endif %}
  61. <li class="thread-last-reply tooltip-top" title="{% trans last=thread.last|reldate %}Last post {{ last }}{% endtrans %}">
  62. <a href="{{ url('private_thread_last', thread=thread.pk, slug=thread.slug) }}">{{ thread.last|relcompact }}</a>
  63. </li>
  64. {% if thread.start_poster_name != thread.last_poster_name %}
  65. <li class="thread-author tooltip-top" title="{% trans username=thread.start_poster_name %}Thread by {{ username }}{% endtrans %}">
  66. {% if thread.start_poster_id %}
  67. <a href="{{ url('user', user=thread.start_poster_id, username=thread.start_poster_name) }}">{% if settings.avatars_on_threads_list %}<img src="{{ thread.start_poster.get_avatar(18) }}" alt="{{ thread.start_poster_name }}" class="user-avatar">{% else %}{{ thread.start_poster_name }}{% endif %}</a>
  68. {% else %}
  69. {% if settings.avatars_on_threads_list %}<img src="{{ macros.avatar_guest(24) }}" alt="{{ thread.start_poster_name }}" class="user-avatar">{% else %}{{ thread.start_poster_name }}{% endif %}
  70. {% endif %}
  71. </li>
  72. {% endif %}
  73. <li class="thread-poster tooltip-top" title="{% if thread.start_poster_name != thread.last_poster_name %}{% trans username=thread.last_poster_name %}Last reply by {{ username }}{% endtrans %}{% else %}{% trans username=thread.last_poster_name %}Thread and last post by {{ username }}{% endtrans %}{% endif %}">
  74. {% if thread.last_poster_id %}
  75. <a href="{{ url('user', user=thread.last_poster_id, username=thread.last_poster_name) }}">{% if settings.avatars_on_threads_list %}<img src="{{ thread.last_poster.get_avatar(18) }}" alt="{{ thread.last_poster_name }}" class="user-avatar">{% else %}{{ thread.last_poster_name }}{% endif %}</a>
  76. {% else %}
  77. {% if settings.avatars_on_threads_list %}<img src="{{ macros.avatar_guest(24) }}" alt="{{ thread.last_poster_name }}" class="user-avatar">{% else %}{{ thread.last_poster_name }}{% endif %}
  78. {% endif %}
  79. </li>
  80. {% if thread.moderated %}
  81. <li class="thread-flag thread-moderated tooltip-top" title="{% trans %}This thread awaits review{% endtrans %}">
  82. <i class="icon-remove-circle"></i>
  83. </li>
  84. {% endif %}
  85. {% if thread.closed %}
  86. <li class="thread-flag thread-closed tooltip-top" title="{% trans %}This thread is closed{% endtrans %}">
  87. <i class="icon-remove-circle"></i>
  88. </li>
  89. {% endif %}
  90. {% if thread.deleted %}
  91. <li class="thread-flag thread-deleted tooltip-top" title="{% trans %}This thread is deleted{% endtrans %}">
  92. <i class="icon-trash"></i>
  93. </li>
  94. {% endif %}
  95. {% if list_form %}
  96. <li class="thread-select">
  97. <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>
  98. </li>
  99. {% endif %}
  100. </ul>
  101. <div class="thread-title">
  102. <a href="{{ url('private_thread', thread=thread.pk, slug=thread.slug) }}">{{ thread.name }}</a>
  103. </div>
  104. </div>
  105. </li>
  106. {% endfor %}
  107. </ul>
  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. {% set list_form_context = list_form.list_action.field.widget.get_context(list_form.list_action.html_name, list_form.list_action.value()) %}
  113. {% if list_form_context['optgroups'][0][1]|length > 1 %}
  114. {{ form_theme.field(list_form.list_action, attrs={'class': 'span3'}) }}
  115. <button type="submit" class="btn btn-danger">{% trans %}Go{% endtrans %}</button>
  116. {% else %}
  117. <input type="hidden" name="{{ list_form_context.name }}" value="{{ list_form_context['optgroups'][0][1][0][0] }}">
  118. <button type="submit" class="btn btn-danger">{{ list_form_context['optgroups'][0][1][0][1] }}</button>
  119. {% endif %}
  120. </form>
  121. </div>
  122. {% endif %}
  123. {% else %}
  124. <div class="threads-list-empty">
  125. {% trans %}You are not participating in any private discussions.{% endtrans %}
  126. </div>
  127. {% endif %}
  128. </div>
  129. {# OLD Threads List
  130. <div class="forum-threads-list">
  131. <div class="header">
  132. <div class="row-fluid">
  133. <div class="span7">{% trans %}Thread{% endtrans %}</div>
  134. <div class="span5 thread-activity">
  135. <div class="thread-replies">{% trans %}Activity{% endtrans %}</div>
  136. {% if list_form %}
  137. <div class="pull-right check-cell">
  138. <label class="checkbox"><input type="checkbox" class="checkbox-master"></label>
  139. </div>
  140. {% endif %}
  141. </div>
  142. </div>
  143. </div>
  144. {% for thread in threads %}
  145. <div class="thread-row{% if not thread.is_read %} thread-new{% endif %}{% if loop.last %} thread-last{% endif %}">
  146. <div class="row-fluid">
  147. <div class="span7">
  148. {% if thread.is_read %}
  149. <a href="{{ url('private_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-circle-blank"></i></a>
  150. {% else %}
  151. <a href="{{ url('private_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-circle"></i></a>
  152. {% endif %}
  153. <a href="{{ url('private_thread', thread=thread.pk, slug=thread.slug) }}" class="thread-name{% if thread.name|length > 70 %} tooltip-top" title="{{ thread.name }}{% endif %}">{{ thread.name|short_string(70) }}</a>
  154. {{ macros.thread_flags(thread) }}
  155. <div class="thread-details">
  156. {% trans user=thread_starter(thread), start=thread.start|reldate|low %}by {{ user }}, {{ start }}{% endtrans %}
  157. </div>
  158. </div>
  159. <div class="span5 thread-activity">
  160. {% if settings.avatars_on_threads_list %}
  161. <div class="thread-last-avatar">
  162. {% if thread.last_poster_id %}
  163. <a href="{{ url('user', user=thread.last_poster.pk, username=thread.last_poster.username_slug) }}"><img src="{{ thread.last_poster.get_avatar(40) }}" alt=""></a>
  164. {% else %}
  165. <img src="{{ macros.avatar_guest(40) }}" alt="" class="user-avatar">
  166. {% endif %}
  167. </div>
  168. {% endif %}
  169. <div class="thread-replies">
  170. <strong class="lead">{{ thread_reply(thread) }}, {{ thread.last|reldate|low }}</strong><br>
  171. {{ replies(thread.replies) }}
  172. </div>
  173. {% if list_form %}
  174. <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>
  175. {% endif %}
  176. </div>
  177. </div>
  178. </div>
  179. {% else %}
  180. <div class="thread-row threads-list-empty">
  181. {% trans %}You are not participating in any private discussions.{% endtrans %}
  182. </div>
  183. {% endfor %}
  184. {% if list_form %}
  185. <div class="threads-actions">
  186. <form id="threads_form" class="form-inline pull-right" action="{{ request_path }}" method="POST">
  187. <input type="hidden" name="{{ csrf_id }}" value="{{ csrf_token }}">
  188. {{ form_theme.field(list_form.list_action, attrs={'class': 'span3'}) }}
  189. <button type="submit" class="btn btn-danger">{% trans %}Go{% endtrans %}</button>
  190. </form>
  191. </div>
  192. {% endif %}
  193. </div>
  194. #}
  195. <div class="forum-threads-extra">
  196. {{ pager() }}
  197. {% if acl.threads.can_start_threads(forum) %}
  198. <a href="{{ url('private_thread_start') }}" class="btn btn-inverse pull-right"><i class="icon-plus"></i> {% trans %}New Thread{% endtrans %}</a>
  199. {% endif %}
  200. </div>
  201. </div>
  202. {% endblock %}
  203. {% macro replies(thread_replies) -%}
  204. {% trans count=thread_replies, replies=thread_replies|intcomma -%}
  205. {{ replies }} reply
  206. {%- pluralize -%}
  207. {{ replies }} replies
  208. {%- endtrans %}
  209. {%- endmacro %}
  210. {% macro thread_starter(thread) -%}
  211. {% 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 %}
  212. {%- endmacro %}
  213. {% macro thread_reply(thread) -%}
  214. {% 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 %}
  215. {%- endmacro %}
  216. {% macro pager() %}
  217. {% if pagination['total'] > 0 %}
  218. <div class="pagination pull-left">
  219. <ul>
  220. <li class="count">{{ macros.pager_label(pagination) }}</li>
  221. {%- 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 -%}
  222. {%- 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 -%}
  223. {%- 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 -%}
  224. </ul>
  225. </div>
  226. {% endif %}
  227. {% endmacro %}
  228. {% block javascripts -%}
  229. {{ super() }}
  230. {%- if list_form %}
  231. <script type="text/javascript">
  232. $(function () {
  233. $('#threads_form').submit(function() {
  234. if ($('.thread-select[]:checked').length == 0) {
  235. alert("{% trans %}You have to select at least one thread.{% endtrans %}");
  236. return false;
  237. }
  238. if ($('#id_list_action').val() == 'hard') {
  239. var decision = confirm("{% trans %}Are you sure you want to delete selected threads? This action is not reversible!{% endtrans %}");
  240. return decision;
  241. }
  242. return true;
  243. });
  244. });
  245. </script>{% endif %}
  246. {%- endblock %}