list.html 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205
  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=_('Reported Posts'),page=pagination['page']) }}{% endblock %}
  5. {% block breadcrumb %}{{ super() }} <span class="divider"><i class="icon-chevron-right"></i></span></li>
  6. <li class="active">{% trans %}Reported Posts{% 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 %}Reported Posts{% 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. </div>
  27. <div class="forum-threads-list reports-list">
  28. {% if threads %}
  29. <ul>
  30. {% for thread in threads %}
  31. <li{% if not thread.is_read %} class="thread-new"{% endif %}>
  32. <div class="thread-icon report-icon">
  33. {% if thread.weight == 2 %}
  34. {% if thread.is_read %}
  35. <a href="{{ url('report_new', thread=thread.pk, slug=thread.slug) }}" class="report-open thread-icon-last tooltip-top" title="{% trans %}Click to see last post{% endtrans %}">
  36. {% else %}
  37. <a href="{{ url('report_new', thread=thread.pk, slug=thread.slug) }}" class="report-open thread-icon-new tooltip-top" title="{% trans %}Click to see first unread post{% endtrans %}">
  38. {% endif %}
  39. <i class="icon-time"></i> {% trans %}Open{% endtrans %}
  40. </a>
  41. {% elif thread.weight == 1 %}
  42. {% if thread.is_read %}
  43. <a href="{{ url('report_new', thread=thread.pk, slug=thread.slug) }}" class="report-resolved thread-icon-last tooltip-top" title="{% trans %}Click to see last post{% endtrans %}">
  44. {% else %}
  45. <a href="{{ url('report_new', thread=thread.pk, slug=thread.slug) }}" class="report-resolved thread-icon-new tooltip-top" title="{% trans %}Click to see first unread post{% endtrans %}">
  46. {% endif %}
  47. <i class="icon-ok"></i> {% trans %}Resolved{% endtrans %}
  48. </a>
  49. {% else %}
  50. {% if thread.is_read %}
  51. <a href="{{ url('report_new', thread=thread.pk, slug=thread.slug) }}" class="report-bogus thread-icon-last tooltip-top" title="{% trans %}Click to see last post{% endtrans %}">
  52. {% else %}
  53. <a href="{{ url('report_new', thread=thread.pk, slug=thread.slug) }}" class="report-bogus thread-icon-new tooltip-top" title="{% trans %}Click to see first unread post{% endtrans %}">
  54. {% endif %}
  55. <i class="icon-remove"></i> {% trans %}Bogus{% endtrans %}
  56. </a>
  57. {% endif %}
  58. </div>
  59. <div class="thread-body">
  60. <ul class="thread-activity">
  61. {% if user.is_authenticated() %}
  62. {% if thread.replies_reported and acl.threads.can_mod_posts(forum) %}
  63. <li class="thread-replies-reported tooltip-top" title="{% trans %}Reported replies{% endtrans %}">
  64. {{ thread.replies_reported|intcomma }}
  65. </li>
  66. {% endif %}
  67. {% if thread.replies_moderated and acl.threads.can_approve(forum) %}
  68. <li class="thread-replies-moderated tooltip-top" title="{% trans %}Unreviewed replies{% endtrans %}">
  69. {{ thread.replies_moderated|intcomma }}
  70. </li>
  71. {% endif %}
  72. {% endif %}
  73. {% if thread.replies %}
  74. <li class="thread-replies tooltip-top" title="{% trans %}Replies{% endtrans %}">
  75. {{ thread.replies|intcomma }}
  76. </li>
  77. {% endif %}
  78. <li class="thread-last-reply tooltip-top" title="{% trans last=thread.last|reldate %}Last post {{ last }}{% endtrans %}">
  79. <a href="{{ url('report_last', thread=thread.pk, slug=thread.slug) }}">{{ thread.last|relcompact }}</a>
  80. </li>
  81. {% if thread.start_poster_name != thread.last_poster_name %}
  82. <li class="thread-author tooltip-top" title="{% trans username=thread.start_poster_name %}Report by {{ username }}{% endtrans %}">
  83. {% if thread.start_poster_id %}
  84. <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>
  85. {% else %}
  86. {% 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 %}
  87. {% endif %}
  88. </li>
  89. {% endif %}
  90. <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 %}Report and last post by {{ username }}{% endtrans %}{% endif %}">
  91. {% if thread.last_poster_id %}
  92. <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>
  93. {% else %}
  94. {% 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 %}
  95. {% endif %}
  96. </li>
  97. {% if thread.moderated %}
  98. <li class="thread-flag thread-moderated tooltip-top" title="{% trans %}This thread awaits review{% endtrans %}">
  99. <i class="icon-remove-circle"></i>
  100. </li>
  101. {% endif %}
  102. {% if thread.closed %}
  103. <li class="thread-flag thread-closed tooltip-top" title="{% trans %}This thread is closed{% endtrans %}">
  104. <i class="icon-remove-circle"></i>
  105. </li>
  106. {% endif %}
  107. {% if thread.deleted %}
  108. <li class="thread-flag thread-deleted tooltip-top" title="{% trans %}This thread is deleted{% endtrans %}">
  109. <i class="icon-trash"></i>
  110. </li>
  111. {% endif %}
  112. <li class="thread-forum tooltip-top" title="{% trans %}Report Forum{% endtrans %}">
  113. <a href="{{ thread.report_forum.url }}">{{ thread.report_forum }}</a>
  114. </li>
  115. {% if list_form %}
  116. <li class="thread-select">
  117. <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>
  118. </li>
  119. {% endif %}
  120. </ul>
  121. <div class="thread-title">
  122. <a href="{{ url('report', thread=thread.pk, slug=thread.slug) }}" class="thread-link">{{ thread.name }}</a>
  123. </div>
  124. </div>
  125. </li>
  126. {% endfor %}
  127. </ul>
  128. {% if list_form %}
  129. <div class="threads-actions">
  130. <form id="threads_form" class="form-inline pull-right" action="{{ request_path }}" method="POST">
  131. <input type="hidden" name="{{ csrf_id }}" value="{{ csrf_token }}">
  132. {% set list_form_context = list_form.list_action.field.widget.get_context(list_form.list_action.html_name, list_form.list_action.value()) %}
  133. {% if list_form_context['optgroups'][0][1]|length > 1 %}
  134. {{ form_theme.field(list_form.list_action, attrs={'class': 'span3'}) }}
  135. <button type="submit" class="btn btn-danger">{% trans %}Go{% endtrans %}</button>
  136. {% else %}
  137. <input type="hidden" name="{{ list_form_context.name }}" value="{{ list_form_context['optgroups'][0][1][0][0] }}">
  138. <button type="submit" class="btn btn-danger">{{ list_form_context['optgroups'][0][1][0][1] }}</button>
  139. {% endif %}
  140. </form>
  141. </div>
  142. {% endif %}
  143. {% else %}
  144. <div class="threads-list-empty">
  145. {% trans %}There are no threads in this forum.{% endtrans %}
  146. </div>
  147. {% endif %}
  148. </div>
  149. <div class="forum-threads-extra">
  150. {{ pager() }}
  151. </div>
  152. </div>
  153. {% endblock %}
  154. {% macro pager() %}
  155. {% if pagination['total'] > 0 %}
  156. <div class="pagination pull-left">
  157. <ul>
  158. <li class="count">{{ macros.pager_label(pagination) }}</li>
  159. {%- 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 -%}
  160. {%- 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 -%}
  161. {%- 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 -%}
  162. </ul>
  163. </div>
  164. {% endif %}
  165. {% endmacro %}
  166. {% block javascripts -%}{{ super() }}
  167. <script type="text/javascript">
  168. $(function () {
  169. function populateForumTooltip(target) {
  170. return $('#forum-' + target + ' .forum-meta').html();
  171. };
  172. {% for subforum in forum.subforums %}
  173. $('#forum-{{ subforum.id }} .forum-title').tooltip({
  174. template: '<div class="tooltip forum-meta-tooltip"><div class="tooltip-arrow"></div><div class="tooltip-inner"></div></div>',
  175. placement: 'right',
  176. html: true,
  177. title: populateForumTooltip({{ subforum.id }})
  178. });
  179. {% endfor %}
  180. {%- if list_form %}
  181. $('#threads_form').submit(function() {
  182. if ($('.thread-select[]:checked').length == 0) {
  183. alert("{% trans %}You have to select at least one thread.{% endtrans %}");
  184. return false;
  185. }
  186. if ($('#id_list_action').val() == 'hard') {
  187. var decision = confirm("{% trans %}Are you sure you want to delete selected reports? This action is not reversible!{% endtrans %}");
  188. return decision;
  189. }
  190. return true;
  191. });{% endif %}
  192. });
  193. </script>
  194. {%- endblock %}