list.html 8.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187
  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 header-search">
  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 %} <form action="{% url 'reports_search' %}" class="form-inline" method="post">
  16. <input type="hidden" name="{{ csrf_id }}" value="{{ csrf_token }}">
  17. <input maxlength="255" type="text" name="search_query" class="span4">
  18. <button type="submit" class="btn btn-primary">{% trans %}Search{% endtrans %}</button>
  19. </form></h1>
  20. </div>
  21. </div>
  22. <div class="container container-primary">
  23. {% if message %}
  24. <div class="messages-list">
  25. {{ macros.draw_message(message) }}
  26. </div>
  27. {% endif %}
  28. <div class="forum-threads-extra extra-top">
  29. {{ pager() }}
  30. </div>
  31. <div class="forum-threads-list reports-list">
  32. <div class="header">
  33. <div class="row-fluid">
  34. <div class="span6 offset2">{% trans %}Report{% endtrans %}</div>
  35. <div class="span4 thread-activity">
  36. <div class="thread-replies">{% trans %}Activity{% 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 not thread.is_read %} thread-new{% endif %}{% if loop.last %} thread-last{% endif %}">
  47. <div class="row-fluid">
  48. <div class="span2 thread-label">
  49. {% if thread.weight == 2 %}
  50. <span class="report-label report-open"><i class="icon-time"></i> {% trans %}Open{% endtrans %}</span>
  51. {% elif thread.weight == 1 %}
  52. <span class="report-label report-resolved"><i class="icon-ok"></i> {% trans %}Resolved{% endtrans %}</span>
  53. {% else %}
  54. <span class="report-label report-bogus"><i class="icon-remove"></i> {% trans %}Bogus{% endtrans %}</span>
  55. {% endif %}
  56. </div>
  57. <div class="span6">
  58. {% if thread.deleted %}
  59. <ul class="unstyled thread-flags">
  60. <li class="flag-deleted"><i class="icon-trash tooltip-top" title="{% trans %}This thread is deleted{% endtrans %}"></i></li>
  61. </ul>
  62. {% endif %}
  63. <a href="{% url 'report' thread=thread.pk, slug=thread.slug %}" class="thread-name"><span class="report-id">#{{ thread.pk }}</span> {{ thread.name }}</a>
  64. {% if thread.is_read %}
  65. <a href="{% url 'report_new' thread=thread.pk, slug=thread.slug %}" class="thread-icon thread-icon-last tooltip-top" title="{% trans %}Click to see last comment{% endtrans %}"><i class="icon-asterisk"></i></a>
  66. {% else %}
  67. <a href="{% url 'report_new' thread=thread.pk, slug=thread.slug %}" class="thread-icon thread-icon-new tooltip-top" title="{% trans %}Click to see first unread comment{% endtrans %}"><i class="icon-fire"></i></a>
  68. {% endif %}
  69. <div class="thread-details">
  70. {% if thread.report_forum %}
  71. {% trans user=thread_starter(thread), start=thread.start|reldate|low, forum=report_forum(thread) %}Post reported by {{ user }} {{ start }} in forum {{ forum }}{% endtrans %}
  72. {% else %}
  73. {% trans user=thread_starter(thread), start=thread.start|reldate|low %}Deleted post reported by {{ user }} {{ start }}{% endtrans %}
  74. {% endif %}
  75. </div>
  76. </div>
  77. <div class="span4 thread-activity">
  78. <div class="thread-replies">
  79. <strong class="lead">{{ thread_reply(thread) }}, {{ thread.last|reldate|low }}</strong><br>
  80. {{ replies(thread.replies) }}
  81. </div>
  82. {% if list_form %}
  83. <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>
  84. {% endif %}
  85. </div>
  86. </div>
  87. </div>
  88. {% else %}
  89. <div class="thread-row threads-list-empty">
  90. {% trans %}There are no reports currently. Whef!{% endtrans %}
  91. </div>
  92. {% endfor %}
  93. {% if list_form %}
  94. <div class="threads-actions">
  95. <form id="threads_form" class="form-inline pull-right" action="{{ request_path }}" method="POST">
  96. <input type="hidden" name="{{ csrf_id }}" value="{{ csrf_token }}">
  97. {{ form_theme.input_select(list_form['list_action'],width=3) }}
  98. <button type="submit" class="btn btn-danger">{% trans %}Go{% endtrans %}</button>
  99. </form>
  100. </div>
  101. {% endif %}
  102. </div>
  103. <div class="forum-threads-extra">
  104. {{ pager() }}
  105. </div>
  106. </div>
  107. {% endblock %}
  108. {% macro replies(thread_replies) -%}
  109. {% trans count=thread_replies, replies=thread_replies|intcomma -%}
  110. {{ replies }} reply
  111. {%- pluralize -%}
  112. {{ replies }} replies
  113. {%- endtrans %}
  114. {%- endmacro %}
  115. {% macro thread_starter(thread) -%}
  116. {% 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 %}
  117. {%- endmacro %}
  118. {% macro thread_reply(thread) -%}
  119. {% 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 %}
  120. {%- endmacro %}
  121. {% macro report_forum(thread) -%}
  122. <a href="{{ thread.report_forum.url }}" class="forum-link">{{ thread.report_forum }}</a>
  123. {%- endmacro %}
  124. {% macro pager() %}
  125. {% if pagination['total'] > 0 %}
  126. <div class="pagination pull-left">
  127. <ul>
  128. <li class="count">{{ macros.pager_label(pagination) }}</li>
  129. {%- 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 -%}
  130. {%- 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 -%}
  131. {%- 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 -%}
  132. </ul>
  133. </div>
  134. {% endif %}
  135. {% endmacro %}
  136. {% block javascripts -%}{{ super() }}
  137. <script type="text/javascript">
  138. $(function () {
  139. function populateForumTooltip(target) {
  140. return $('#forum-' + target + ' .forum-meta').html();
  141. };
  142. {% for subforum in forum.subforums %}
  143. $('#forum-{{ subforum.id }} .forum-title').tooltip({
  144. template: '<div class="tooltip forum-meta-tooltip"><div class="tooltip-arrow"></div><div class="tooltip-inner"></div></div>',
  145. placement: 'right',
  146. html: true,
  147. title: populateForumTooltip({{ subforum.id }})
  148. });
  149. {% endfor %}
  150. {%- if list_form %}
  151. $('#threads_form').submit(function() {
  152. if ($('.thread-select[]:checked').length == 0) {
  153. alert("{% trans %}You have to select at least one thread.{% endtrans %}");
  154. return false;
  155. }
  156. if ($('#id_list_action').val() == 'hard') {
  157. var decision = confirm("{% trans %}Are you sure you want to delete selected reports? This action is not reversible!{% endtrans %}");
  158. return decision;
  159. }
  160. return true;
  161. });{% endif %}
  162. });
  163. </script>
  164. {%- endblock %}