list.html 8.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179
  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"><span class="report-id">#892431</span> {{ thread.name }}</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. {% trans user=thread_starter(thread), start=thread.start|reldate|low, forum=report_forum(thread) %}Reported by {{ user }} {{ start }} in forum {{ forum }}{% endtrans %}
  67. </div>
  68. </div>
  69. <div class="span4 thread-activity">
  70. <div class="thread-replies">
  71. <strong class="lead">{{ thread_reply(thread) }}, {{ thread.last|reldate|low }}</strong><br>
  72. {{ replies(thread.replies) }}
  73. </div>
  74. {% if list_form %}
  75. <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>
  76. {% endif %}
  77. </div>
  78. </div>
  79. </div>
  80. {% else %}
  81. <div class="thread-row threads-list-empty">
  82. {% trans %}There are no reports currently. Whef!{% endtrans %}
  83. </div>
  84. {% endfor %}
  85. {% if list_form %}
  86. <div class="threads-actions">
  87. <form id="threads_form" class="form-inline pull-right" action="{{ request_path }}" method="POST">
  88. <input type="hidden" name="{{ csrf_id }}" value="{{ csrf_token }}">
  89. {{ form_theme.input_select(list_form['list_action'],width=3) }}
  90. <button type="submit" class="btn btn-danger">{% trans %}Go{% endtrans %}</button>
  91. </form>
  92. </div>
  93. {% endif %}
  94. </div>
  95. <div class="forum-threads-extra">
  96. {{ pager() }}
  97. </div>
  98. </div>
  99. {% endblock %}
  100. {% macro replies(thread_replies) -%}
  101. {% trans count=thread_replies, replies=thread_replies|intcomma -%}
  102. {{ replies }} reply
  103. {%- pluralize -%}
  104. {{ replies }} replies
  105. {%- endtrans %}
  106. {%- endmacro %}
  107. {% macro thread_starter(thread) -%}
  108. {% 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 %}
  109. {%- endmacro %}
  110. {% macro thread_reply(thread) -%}
  111. {% 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 %}
  112. {%- endmacro %}
  113. {% macro report_forum(thread) -%}
  114. {% if thread.report_forum %}<a href="{{ thread.report_forum.forum_url() }}" class="forum-link">{{ thread.report_forum }}</a>{% else %}<em>{% trans %}Deleted{% endtrans %}</em>{% endif %}
  115. {%- endmacro %}
  116. {% macro pager() %}
  117. {% if pagination['total'] > 0 %}
  118. <div class="pagination pull-left">
  119. <ul>
  120. <li class="count">{{ macros.pager_label(pagination) }}</li>
  121. {%- 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 -%}
  122. {%- 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 -%}
  123. {%- 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 -%}
  124. </ul>
  125. </div>
  126. {% endif %}
  127. {% endmacro %}
  128. {% block javascripts -%}{{ super() }}
  129. <script type="text/javascript">
  130. $(function () {
  131. function populateForumTooltip(target) {
  132. return $('#forum-' + target + ' .forum-meta').html();
  133. };
  134. {% for subforum in forum.subforums %}
  135. $('#forum-{{ subforum.id }} .forum-title').tooltip({
  136. template: '<div class="tooltip forum-meta-tooltip"><div class="tooltip-arrow"></div><div class="tooltip-inner"></div></div>',
  137. placement: 'right',
  138. html: true,
  139. title: populateForumTooltip({{ subforum.id }})
  140. });
  141. {% endfor %}
  142. {%- if list_form %}
  143. $('#threads_form').submit(function() {
  144. if ($('.thread-select[]:checked').length == 0) {
  145. alert("{% trans %}You have to select at least one thread.{% endtrans %}");
  146. return false;
  147. }
  148. if ($('#id_list_action').val() == 'hard') {
  149. var decision = confirm("{% trans %}Are you sure you want to delete selected reports? This action is not reversible!{% endtrans %}");
  150. return decision;
  151. }
  152. return true;
  153. });{% endif %}
  154. });
  155. </script>
  156. {%- endblock %}