list.html 8.0 KB

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