list.html 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171
  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">
  28. <div class="header">
  29. <div class="row-fluid">
  30. <div class="span7">{% trans %}Report{% endtrans %}</div>
  31. <div class="span5 thread-activity">
  32. <div class="thread-replies">{% trans %}Activity{% endtrans %}</div>
  33. {% if user.is_authenticated() and 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="span7">
  45. {% if thread.is_read %}
  46. <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 post{% endtrans %}"><i class="icon-asterisk"></i></a>
  47. {% else %}
  48. <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 post{% endtrans %}"><i class="icon-fire"></i></a>
  49. {% endif %}
  50. {{ macros.thread_flags(thread) }}
  51. <a href="{% url 'report' thread=thread.pk, slug=thread.slug %}" class="thread-name">{{ thread.name }}</a>
  52. <div class="thread-details">
  53. {% trans user=thread_starter(thread), start=thread.start|reldate|low %}by {{ user }}, {{ start }}{% endtrans %}
  54. </div>
  55. </div>
  56. <div class="span5 thread-activity">
  57. {% if settings.avatars_on_threads_list %}
  58. <div class="thread-last-avatar">
  59. {% if thread.last_poster_id %}
  60. <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>
  61. {% else %}
  62. <img src="{{ macros.avatar_guest(40) }}" alt="" class="user-avatar">
  63. {% endif %}
  64. </div>
  65. {% endif %}
  66. <div class="thread-replies">
  67. <strong class="lead">{{ thread_reply(thread) }}, {{ thread.last|reldate|low }}</strong><br>
  68. {{ replies(thread.replies) }}, <span{% if (thread.upvotes-thread.downvotes) > 0 %} class="text-success"{% elif (thread.upvotes-thread.downvotes) < 0 %} class="text-error"{% endif %}><strong>{% if (thread.upvotes-thread.downvotes) > 0 %}+{% elif (thread.upvotes-thread.downvotes) < 0 %}-{% endif %}</strong>{% trans rating=(thread.upvotes-thread.downvotes)|abs|intcomma %}{{ rating }} thread rating{% endtrans %}</span>
  69. </div>
  70. {% if user.is_authenticated() and list_form %}
  71. <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>
  72. {% endif %}
  73. </div>
  74. </div>
  75. </div>
  76. {% else %}
  77. <div class="thread-row threads-list-empty">
  78. {% trans %}There are no threads in this forum.{% endtrans %}
  79. </div>
  80. {% endfor %}
  81. {% if user.is_authenticated() and list_form %}
  82. <div class="threads-actions">
  83. <form id="threads_form" class="form-inline pull-right" action="{{ request_path }}" method="POST">
  84. <input type="hidden" name="{{ csrf_id }}" value="{{ csrf_token }}">
  85. {{ form_theme.input_select(list_form['list_action'],width=3) }}
  86. <button type="submit" class="btn btn-danger">{% trans %}Go{% endtrans %}</button>
  87. </form>
  88. </div>
  89. {% endif %}
  90. </div>
  91. <div class="forum-threads-extra">
  92. {{ pager() }}
  93. </div>
  94. </div>
  95. {% endblock %}
  96. {% macro replies(thread_replies) -%}
  97. {% trans count=thread_replies, replies=thread_replies|intcomma -%}
  98. {{ replies }} reply
  99. {%- pluralize -%}
  100. {{ replies }} replies
  101. {%- endtrans %}
  102. {%- endmacro %}
  103. {% macro thread_starter(thread) -%}
  104. {% 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 %}
  105. {%- endmacro %}
  106. {% macro thread_reply(thread) -%}
  107. {% 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 %}
  108. {%- endmacro %}
  109. {% macro pager() %}
  110. {% if pagination['total'] > 0 %}
  111. <div class="pagination pull-left">
  112. <ul>
  113. <li class="count">{{ macros.pager_label(pagination) }}</li>
  114. {%- 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 -%}
  115. {%- 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 -%}
  116. {%- 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 -%}
  117. </ul>
  118. </div>
  119. {% endif %}
  120. {% endmacro %}
  121. {% block javascripts -%}{{ super() }}
  122. <script type="text/javascript">
  123. $(function () {
  124. function populateForumTooltip(target) {
  125. return $('#forum-' + target + ' .forum-meta').html();
  126. };
  127. {% for subforum in forum.subforums %}
  128. $('#forum-{{ subforum.id }} .forum-title').tooltip({
  129. template: '<div class="tooltip forum-meta-tooltip"><div class="tooltip-arrow"></div><div class="tooltip-inner"></div></div>',
  130. placement: 'right',
  131. html: true,
  132. title: populateForumTooltip({{ subforum.id }})
  133. });
  134. {% endfor %}
  135. {%- if user.is_authenticated() and list_form %}
  136. $('#threads_form').submit(function() {
  137. if ($('.thread-select[]:checked').length == 0) {
  138. alert("{% trans %}You have to select at least one thread.{% endtrans %}");
  139. return false;
  140. }
  141. if ($('#id_list_action').val() == 'hard') {
  142. var decision = confirm("{% trans %}Are you sure you want to delete selected reports? This action is not reversible!{% endtrans %}");
  143. return decision;
  144. }
  145. return true;
  146. });{% endif %}
  147. });
  148. </script>
  149. {%- endblock %}