watched.html 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208
  1. {% extends "cranefly/layout.html" %}
  2. {% import "cranefly/macros.html" as macros with context %}
  3. {% block title %}{{ macros.page_title(title=_('Threads you are watching')) }}{% endblock %}
  4. {% block container %}
  5. <div class="page-header header-primary">
  6. <div class="container">
  7. {{ messages_list(messages) }}
  8. <h1>{% trans %}Threads you are watching{% endtrans %}</h1>
  9. <ul class="nav nav-tabs header-tabs">
  10. <li class="{% if not new %}active{% endif %}"><a href="{% url 'watched_threads' %}">{% trans %}All Threads{% endtrans %}</a></li>
  11. <li class="{% if new %}active{% endif %}"><a href="{% url 'watched_threads_new' %}">{% trans %}Unread Threads{% endtrans %}</a></li>
  12. </ul>
  13. </div>
  14. </div>
  15. <div class="container container-primary">
  16. {% if message %}
  17. <div class="messages-list">
  18. {{ macros.draw_message(message) }}
  19. </div>
  20. {% endif %}
  21. {% if threads %}
  22. {{ pager() }}
  23. <div class="forum-threads-list watched-threads">
  24. <div class="header">
  25. <div class="row-fluid">
  26. <div class="span7">{% trans %}Thread{% endtrans %}</div>
  27. <div class="span5 thread-activity">
  28. <div class="thread-last">{% trans %}Last Reply{% endtrans %}</div>
  29. </div>
  30. </div>
  31. </div>
  32. {% for thread in threads %}
  33. <div id="watch-{{ loop.index }}" class="thread-row{% if thread.pk == 2 or not thread.is_read %} thread-new{% endif %}{% if loop.last %} thread-last{% endif %}">
  34. <div class="row-fluid">
  35. <div class="span7">
  36. {% if thread.is_read and not thread.pk == 2 %}
  37. <a href="{% url '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>
  38. {% else %}
  39. <a href="{% url '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>
  40. {% endif %}
  41. <a href="{% url 'thread' thread=thread.pk, slug=thread.slug %}" class="thread-name">{{ thread.name }}</a>
  42. <span class="thread-details">
  43. {% trans user=thread_starter(thread), forum=thread_forum(thread) %}by {{ user }} in {{ forum }}{% endtrans %}
  44. </span>
  45. </div>
  46. <div class="span5 thread-activity">
  47. <div class="thread-last-reply">
  48. {% if settings.avatars_on_threads_list %}
  49. <span class="thread-last-avatar">
  50. {% if thread.last_poster_id %}
  51. <a href="{% url 'user' user=thread.last_poster.pk, username=thread.last_poster.username_slug %}"><img src="{{ thread.last_poster.get_avatar(30) }}" alt=""></a>
  52. {% else %}
  53. <img src="{{ macros.avatar_guest(40) }}" alt="" class="user-avatar">
  54. {% endif %}
  55. </span>
  56. {% endif %}
  57. {{ thread_reply(thread) }}, {{ thread.last|reldate|low }}
  58. </div>
  59. <div class="thread-options">
  60. <form action="{% if thread.send_email %}{{ thread_url(thread, 'unwatch_email') }}{% else %}{{ thread_url(thread, 'watch_email') }}{% endif %}" method="post">
  61. <input type="hidden" name="{{ csrf_id }}" value="{{ csrf_token }}">
  62. <input type="hidden" name="retreat" value="{{ request_path }}#watch-{{ loop.index }}">
  63. <button type="submit" class="btn btn-{% if thread.send_email %}success{% else %}inverse{% endif %} tooltip-top" title="{% if thread.send_email %}{% trans %}Don't notify with e-mail{% endtrans %}{% else %}{% trans %}Notify with e-mail{% endtrans %}{% endif %}"><i class="icon-envelope"></i></button>
  64. </form>
  65. <form action="{{ thread_url(thread, 'unwatch') }}" method="post">
  66. <input type="hidden" name="{{ csrf_id }}" value="{{ csrf_token }}">
  67. <input type="hidden" name="retreat" value="{{ delete_retreat(loop) }}">
  68. <button type="submit" class="btn btn-danger tooltip-top" title="{% trans %}Unwatch{% endtrans %}"><i class="icon-remove"></i></button>
  69. </form>
  70. </div>
  71. </div>
  72. </div>
  73. </div>
  74. {% endfor %}
  75. {#<table class="table">
  76. <thead>
  77. <tr>
  78. <th>{% trans %}Thread{% endtrans %}</th>
  79. <th colspan="2" class="span5">{% trans %}Activity{% endtrans %}</th>
  80. </tr>
  81. </thead>
  82. <tbody>
  83. {% for thread in threads %}
  84. <tr id="watch-{{ loop.index }}">
  85. <td>
  86. <a href="{{ thread_url(thread, 'new') }}" class="thread-icon{% if not thread.is_read %} thread-new{% endif %} tooltip-top" title="{% if not thread.is_read -%}
  87. {% trans %}Click to see first unread post{% endtrans %}
  88. {%- else -%}
  89. {% trans %}Click to see last post{% endtrans %}
  90. {%- endif %}"><i class="icon-comment"></i></a>
  91. <a href="{{ thread_url(thread) }}" class="thread-name">{{ thread.name }}</a>
  92. <span class="thread-details">
  93. {% trans user=thread_starter(thread), forum=thread_forum(thread), start=thread.start|reltimesince|low %}by {{ user }} in {{ forum }} {{ start }}{% endtrans %}
  94. </span>
  95. </td>
  96. <td>
  97. <div class="thread-last-reply">
  98. {{ replies(thread.replies) }} - {% trans user=thread_reply(thread), last=thread.last|reltimesince|low %}last by {{ user }} {{ last }}{% endtrans %}
  99. </div>
  100. </td>
  101. <td class="watched-thread-flags">
  102. <form action="{{ thread_url(thread, 'unwatch') }}" method="post">
  103. <input type="hidden" name="{{ csrf_id }}" value="{{ csrf_token }}">
  104. <input type="hidden" name="retreat" value="{{ delete_retreat(loop) }}">
  105. <button type="submit" class="btn btn-danger tooltip-top" title="{% trans %}Unwatch{% endtrans %}"><i class="icon-remove"></i></button>
  106. </form>
  107. <form action="{% if thread.send_email %}{{ thread_url(thread, 'unwatch_email') }}{% else %}{{ thread_url(thread, 'watch_email') }}{% endif %}" method="post">
  108. <input type="hidden" name="{{ csrf_id }}" value="{{ csrf_token }}">
  109. <input type="hidden" name="retreat" value="{{ request_path }}#watch-{{ loop.index }}">
  110. <button type="submit" class="btn btn-{% if thread.send_email %}success{% else %}inverse{% endif %} tooltip-top" title="{% if thread.send_email %}{% trans %}Don't notify with e-mail{% endtrans %}{% else %}{% trans %}Notify with e-mail{% endtrans %}{% endif %}"><i class="icon-envelope"></i></button>
  111. </form>
  112. </td>
  113. </tr>
  114. {% endfor %}
  115. </tbody>
  116. </table>#}
  117. </div>
  118. {{ pager() }}
  119. {% else %}
  120. <p class="lead">{% if new -%}
  121. {% trans %}There are no unread threads that you are watching.{% endtrans %}
  122. {%- else -%}
  123. {% trans %}You are not watching any threads.{% endtrans %}
  124. {%- endif %}</p>
  125. {% endif %}
  126. </div>
  127. {% endblock %}
  128. {% macro thread_url(thread, route='') -%}{% filter url(thread=thread.pk, slug=thread.slug) %}{% filter trim %}
  129. {% if thread.forum_id == private_threads.pk -%}
  130. private_thread
  131. {%- elif thread.forum_id == reports.pk -%}
  132. report
  133. {%- else -%}
  134. thread
  135. {%- endif -%}{%- if route %}_{{ route }}{% endif %}{% endfilter %}{% endfilter %}
  136. {%- endmacro%}
  137. {% macro replies(thread_replies) -%}
  138. {% trans count=thread_replies, replies=('<strong>' ~ (thread_replies|intcomma) ~ '</strong>')|safe -%}
  139. {{ replies }} reply
  140. {%- pluralize -%}
  141. {{ replies }} replies
  142. {%- endtrans %}
  143. {%- endmacro %}
  144. {% macro thread_starter(thread) -%}
  145. {% 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 %}
  146. {%- endmacro %}
  147. {% macro thread_forum(thread) -%}{% filter trim %}
  148. {% if thread.forum_id == private_threads.pk %}
  149. <a href="{% url 'private_threads' %}" class="forum-link">{% trans %}Private Threads{% endtrans %}</a>
  150. {% elif thread.forum_id == reports.pk %}
  151. TODO!
  152. {% else %}
  153. <a href="{% url 'forum' forum=thread.forum_id, slug=thread.forum.slug %}" class="forum-link">{{ thread.forum.name }}</a>
  154. {% endif%}
  155. {% endfilter %}{%- endmacro %}
  156. {% macro thread_reply(thread) -%}
  157. {% 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 %}
  158. {%- endmacro %}
  159. {% macro pager() -%}
  160. {% if pagination['total'] > 1 %}
  161. <div class="pagination">
  162. <ul>
  163. <li class="count">{{ macros.pager_label(pagination) }}</li>
  164. {% if new %}
  165. {%- if pagination['prev'] > 1 %}<li><a href="{% url 'watched_threads_new' %}" class="tooltip-top" title="{% trans %}Latest Threads{% endtrans %}"><i class="icon-chevron-left"></i> {% trans %}Latest{% endtrans %}</a></li>{% endif -%}
  166. {%- if pagination['prev'] > 0 %}<li><a href="{%- if pagination['prev'] > 1 %}{% url 'watched_threads_new' page=pagination['prev'] %}{% else %}{% url 'watched_threads_new' %}{% endif %}" class="tooltip-top" title="{% trans %}Newer Threads{% endtrans %}"><i class="icon-chevron-left"></i></a></li>{% endif -%}
  167. {%- if pagination['next'] > 0 %}<li><a href="{% url 'watched_threads_new' page=pagination['next'] %}" class="tooltip-top" title="{% trans %}Older Threads{% endtrans %}"><i class="icon-chevron-right"></i></a></li>{% endif -%}
  168. {% else %}
  169. {%- if pagination['prev'] > 1 %}<li><a href="{% url 'watched_threads' %}" class="tooltip-top" title="{% trans %}Latest Threads{% endtrans %}"><i class="icon-chevron-left"></i> {% trans %}Latest{% endtrans %}</a></li>{% endif -%}
  170. {%- if pagination['prev'] > 0 %}<li><a href="{%- if pagination['prev'] > 1 %}{% url 'watched_threads' page=pagination['prev'] %}{% else %}{% url 'watched_threads' %}{% endif %}" class="tooltip-top" title="{% trans %}Newer Threads{% endtrans %}"><i class="icon-chevron-left"></i></a></li>{% endif -%}
  171. {%- if pagination['next'] > 0 %}<li><a href="{% url 'watched_threads' page=pagination['next'] %}" class="tooltip-top" title="{% trans %}Older Threads{% endtrans %}"><i class="icon-chevron-right"></i></a></li>{% endif -%}
  172. {% endif %}
  173. </ul>
  174. </div>
  175. {% endif %}
  176. {%- endmacro %}
  177. {% macro delete_retreat(loop) -%}
  178. {%- if pagination['page'] == 1 -%}
  179. {{ request_path }}{% if not (loop.first and loop.last) %}#watch-{{ loop.index }}{% endif %}
  180. {%- else -%}
  181. {%- if loop.first and loop.last -%}
  182. {%- if new -%}
  183. {%- if pagination['prev'] > 1 %}{% url 'watched_threads_new' page=pagination['prev'] %}{% else %}{% url 'watched_threads_new' %}{% endif %}
  184. {%- else -%}
  185. {%- if pagination['prev'] > 1 %}{% url 'watched_threads' page=pagination['prev'] %}{% else %}{% url 'watched_threads' %}{% endif %}
  186. {%- endif -%}#watch-{{ settings.threads_per_page }}
  187. {%- else -%}
  188. {{ request_path }}#watch-{{ loop.index }}
  189. {%- endif -%}
  190. {%- endif -%}
  191. {%- endmacro %}