list.html 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173
  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 header-search">
  10. <div class="container">
  11. {{ messages_list(messages) }}
  12. <ul class="breadcrumb" {{ macros.itemprop_bread() }}>
  13. {{ self.breadcrumb() }} <form action="{% url 'private_threads_search' %}" class="form-inline" method="post">
  14. <input type="hidden" name="{{ csrf_id }}" value="{{ csrf_token }}">
  15. <input maxlength="255" type="text" name="search_query" class="span4">
  16. <button type="submit" class="btn btn-primary">{% trans %}Search{% endtrans %}</button>
  17. </form></li>
  18. </ul>
  19. <h1>{% trans %}Private Threads{% endtrans %}</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. {% if acl.threads.can_start_threads(forum) %}
  31. <a href="{% url 'private_thread_start' %}" class="btn btn-inverse pull-right"><i class="icon-plus"></i> {% trans %}New Thread{% endtrans %}</a>
  32. {% endif %}
  33. </div>
  34. <div class="forum-threads-list">
  35. <div class="header">
  36. <div class="row-fluid">
  37. <div class="span7">{% trans %}Thread{% endtrans %}</div>
  38. <div class="span5 thread-activity">
  39. <div class="thread-replies">{% trans %}Activity{% endtrans %}</div>
  40. {% if list_form %}
  41. <div class="pull-right check-cell">
  42. <label class="checkbox"><input type="checkbox" class="checkbox-master"></label>
  43. </div>
  44. {% endif %}
  45. </div>
  46. </div>
  47. </div>
  48. {% for thread in threads %}
  49. <div class="thread-row{% if not thread.is_read %} thread-new{% endif %}{% if loop.last %} thread-last{% endif %}">
  50. <div class="row-fluid">
  51. <div class="span7">
  52. {% if thread.is_read %}
  53. <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>
  54. {% else %}
  55. <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>
  56. {% endif %}
  57. <a href="{% url 'private_thread' thread=thread.pk, slug=thread.slug %}" class="thread-name">{{ thread.name }}</a>
  58. {{ macros.thread_flags(thread) }}
  59. <div class="thread-details">
  60. {% trans user=thread_starter(thread), start=thread.start|reldate|low %}by {{ user }}, {{ start }}{% endtrans %}
  61. </div>
  62. </div>
  63. <div class="span5 thread-activity">
  64. {% if settings.avatars_on_threads_list %}
  65. <div class="thread-last-avatar">
  66. {% if thread.last_poster_id %}
  67. <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>
  68. {% else %}
  69. <img src="{{ macros.avatar_guest(40) }}" alt="" class="user-avatar">
  70. {% endif %}
  71. </div>
  72. {% endif %}
  73. <div class="thread-replies">
  74. <strong class="lead">{{ thread_reply(thread) }}, {{ thread.last|reldate|low }}</strong><br>
  75. {{ replies(thread.replies) }}
  76. </div>
  77. {% if list_form %}
  78. <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>
  79. {% endif %}
  80. </div>
  81. </div>
  82. </div>
  83. {% else %}
  84. <div class="thread-row threads-list-empty">
  85. {% trans %}You are not participating in any private discussions.{% endtrans %}
  86. </div>
  87. {% endfor %}
  88. {% if list_form %}
  89. <div class="threads-actions">
  90. <form id="threads_form" class="form-inline pull-right" action="{{ request_path }}" method="POST">
  91. <input type="hidden" name="{{ csrf_id }}" value="{{ csrf_token }}">
  92. {{ form_theme.input_select(list_form['list_action'],width=3) }}
  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. {% if acl.threads.can_start_threads(forum) %}
  101. <a href="{% url 'private_thread_start' %}" class="btn btn-inverse pull-right"><i class="icon-plus"></i> {% trans %}New Thread{% endtrans %}</a>
  102. {% endif %}
  103. </div>
  104. </div>
  105. {% endblock %}
  106. {% macro replies(thread_replies) -%}
  107. {% trans count=thread_replies, replies=thread_replies|intcomma -%}
  108. {{ replies }} reply
  109. {%- pluralize -%}
  110. {{ replies }} replies
  111. {%- endtrans %}
  112. {%- endmacro %}
  113. {% macro thread_starter(thread) -%}
  114. {% 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 %}
  115. {%- endmacro %}
  116. {% macro thread_reply(thread) -%}
  117. {% 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 %}
  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 'private_threads' %}" 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 '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 -%}
  126. {%- 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 -%}
  127. </ul>
  128. </div>
  129. {% endif %}
  130. {% endmacro %}
  131. {% block javascripts -%}
  132. {{ super() }}
  133. {%- if list_form %}
  134. <script type="text/javascript">
  135. $(function () {
  136. $('#threads_form').submit(function() {
  137. if ($('.check-cell[]: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 threads? This action is not reversible!{% endtrans %}");
  143. return decision;
  144. }
  145. return true;
  146. });
  147. });
  148. </script>{% endif %}
  149. {%- endblock %}