list.html 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169
  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=_("Private Threads"),page=pagination['page']) }}{% endblock %}
  5. {% block breadcrumb %}{{ super() }} <span class="divider"><i class="icon-chevron-right"></i></span></li>
  6. <li class="active">{% trans %}Private Threads{% 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 %}Private Threads{% 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. {% if acl.threads.can_start_threads(forum) %}
  27. <a href="{% url 'private_thread_start' %}" class="btn btn-inverse pull-right"><i class="icon-plus"></i> {% trans %}New Thread{% endtrans %}</a>
  28. {% endif %}
  29. </div>
  30. <div class="forum-threads-list">
  31. <div class="header">
  32. <div class="row-fluid">
  33. <div class="span7">{% trans %}Thread{% endtrans %}</div>
  34. <div class="span5 thread-activity">
  35. <div class="thread-replies">{% trans %}Activity{% endtrans %}</div>
  36. {% if list_form %}
  37. <div class="pull-right check-cell">
  38. <label class="checkbox"><input type="checkbox" class="checkbox-master"></label>
  39. </div>
  40. {% endif %}
  41. </div>
  42. </div>
  43. </div>
  44. {% for thread in threads %}
  45. <div class="thread-row{% if not thread.is_read %} thread-new{% endif %}{% if loop.last %} thread-last{% endif %}">
  46. <div class="row-fluid">
  47. <div class="span7">
  48. {% if thread.is_read %}
  49. <a href="{% url 'private_thread_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>
  50. {% else %}
  51. <a href="{% url 'private_thread_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>
  52. {% endif %}
  53. <a href="{% url 'private_thread' thread=thread.pk, slug=thread.slug %}" class="thread-name">{{ thread.name }}</a>
  54. {{ macros.thread_flags(thread) }}
  55. <div class="thread-details">
  56. {% trans user=thread_starter(thread), start=thread.start|reldate|low %}by {{ user }}, {{ start }}{% endtrans %}
  57. </div>
  58. </div>
  59. <div class="span5 thread-activity">
  60. {% if settings.avatars_on_threads_list %}
  61. <div class="thread-last-avatar">
  62. {% if thread.last_poster_id %}
  63. <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>
  64. {% else %}
  65. <img src="{{ macros.avatar_guest(40) }}" alt="" class="user-avatar">
  66. {% endif %}
  67. </div>
  68. {% endif %}
  69. <div class="thread-replies">
  70. <strong class="lead">{{ thread_reply(thread) }}, {{ thread.last|reldate|low }}</strong><br>
  71. {{ 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>
  72. </div>
  73. {% if list_form %}
  74. <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>
  75. {% endif %}
  76. </div>
  77. </div>
  78. </div>
  79. {% else %}
  80. <div class="thread-row threads-list-empty">
  81. {% trans %}You are not participating in any private discussions.{% endtrans %}
  82. </div>
  83. {% endfor %}
  84. {% if list_form %}
  85. <div class="threads-actions">
  86. <form id="threads_form" class="form-inline pull-right" action="{{ request_path }}" method="POST">
  87. <input type="hidden" name="{{ csrf_id }}" value="{{ csrf_token }}">
  88. {{ form_theme.input_select(list_form['list_action'],width=3) }}
  89. <button type="submit" class="btn btn-danger">{% trans %}Go{% endtrans %}</button>
  90. </form>
  91. </div>
  92. {% endif %}
  93. </div>
  94. <div class="forum-threads-extra">
  95. {{ pager() }}
  96. {% if acl.threads.can_start_threads(forum) %}
  97. <a href="{% url 'private_thread_start' %}" class="btn btn-inverse pull-right"><i class="icon-plus"></i> {% trans %}New Thread{% endtrans %}</a>
  98. {% endif %}
  99. </div>
  100. </div>
  101. {% endblock %}
  102. {% macro replies(thread_replies) -%}
  103. {% trans count=thread_replies, replies=thread_replies|intcomma -%}
  104. {{ replies }} reply
  105. {%- pluralize -%}
  106. {{ replies }} replies
  107. {%- endtrans %}
  108. {%- endmacro %}
  109. {% macro thread_starter(thread) -%}
  110. {% 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 %}
  111. {%- endmacro %}
  112. {% macro thread_reply(thread) -%}
  113. {% 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 %}
  114. {%- endmacro %}
  115. {% macro pager() %}
  116. {% if pagination['total'] > 0 %}
  117. <div class="pagination pull-left">
  118. <ul>
  119. <li class="count">{{ macros.pager_label(pagination) }}</li>
  120. {%- if pagination['prev'] > 1 %}<li><a href="{% url 'private_threads' %}" class="tooltip-top" title="{% trans %}First Page{% endtrans %}"><i class="icon-chevron-left"></i> {% trans %}First{% endtrans %}</a></li>{% endif -%}
  121. {%- if pagination['prev'] > 0 %}<li><a href="{%- if pagination['prev'] > 1 %}{% url 'private_threads' page=pagination['prev'] %}{% else %}{% url 'private_threads' %}{% endif %}" class="tooltip-top" title="{% trans %}Newest Threads{% endtrans %}"><i class="icon-chevron-left"></i></a></li>{% endif -%}
  122. {%- if pagination['next'] > 0 %}<li><a href="{% url 'private_threads' page=pagination['next'] %}" class="tooltip-top" title="{% trans %}Older Threads{% endtrans %}"><i class="icon-chevron-right"></i></a></li>{% endif -%}
  123. </ul>
  124. </div>
  125. {% endif %}
  126. {% endmacro %}
  127. {% block javascripts -%}
  128. {{ super() }}
  129. {%- if list_form %}
  130. <script type="text/javascript">
  131. $(function () {
  132. $('#threads_form').submit(function() {
  133. if ($('.check-cell[]:checked').length == 0) {
  134. alert("{% trans %}You have to select at least one thread.{% endtrans %}");
  135. return false;
  136. }
  137. if ($('#id_list_action').val() == 'hard') {
  138. var decision = confirm("{% trans %}Are you sure you want to delete selected threads? This action is not reversible!{% endtrans %}");
  139. return decision;
  140. }
  141. return true;
  142. });
  143. });
  144. </script>{% endif %}
  145. {%- endblock %}