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-replies">{% trans %}Activity{% endtrans %}</div>
  29. </div>
  30. </div>
  31. </div>
  32. {% for thread in threads %}
  33. <div id="watch-{{ loop.index }}" class="thread-row{% if 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 %}
  37. <a href="{{ thread_url(thread, 'new') }}" 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="{{ thread_url(thread, 'new') }}" 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. {{ macros.thread_flags(thread) }}
  42. <a href="{{ thread_url(thread) }}" class="thread-name">{{ thread.name }}</a>
  43. <div class="thread-details">
  44. {% trans user=thread_starter(thread), forum=thread_forum(thread), start=thread.start|reltimesince|low %}by {{ user }} in {{ forum }} {{ start }}{% endtrans %}
  45. </div>
  46. </div>
  47. <div class="span5 thread-activity">
  48. {% if settings.avatars_on_threads_list %}
  49. <div 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(40) }}" alt=""></a>
  52. {% else %}
  53. <img src="{{ macros.avatar_guest(40) }}" alt="" class="user-avatar">
  54. {% endif %}
  55. </div>
  56. {% endif %}
  57. <div class="thread-replies">
  58. <strong class="lead">{{ thread_reply(thread) }}, {{ thread.last|reldate|low }}</strong><br>
  59. {{ 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>
  60. </div>
  61. <div class="thread-options">
  62. <form action="{% if thread.send_email %}{{ thread_url(thread, 'unwatch_email') }}{% else %}{{ thread_url(thread, 'watch_email') }}{% endif %}" method="post">
  63. <input type="hidden" name="{{ csrf_id }}" value="{{ csrf_token }}">
  64. <input type="hidden" name="retreat" value="{{ request_path }}#watch-{{ loop.index }}">
  65. <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>
  66. </form>
  67. <form action="{{ thread_url(thread, 'unwatch') }}" method="post">
  68. <input type="hidden" name="{{ csrf_id }}" value="{{ csrf_token }}">
  69. <input type="hidden" name="retreat" value="{{ delete_retreat(loop) }}">
  70. <button type="submit" class="btn btn-danger tooltip-top" title="{% trans %}Unwatch{% endtrans %}"><i class="icon-remove"></i></button>
  71. </form>
  72. </div>
  73. </div>
  74. </div>
  75. </div>
  76. {% endfor %}
  77. {#<table class="table">
  78. <thead>
  79. <tr>
  80. <th>{% trans %}Thread{% endtrans %}</th>
  81. <th colspan="2" class="span5">{% trans %}Activity{% endtrans %}</th>
  82. </tr>
  83. </thead>
  84. <tbody>
  85. {% for thread in threads %}
  86. <tr id="watch-{{ loop.index }}">
  87. <td>
  88. <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 -%}
  89. {% trans %}Click to see first unread post{% endtrans %}
  90. {%- else -%}
  91. {% trans %}Click to see last post{% endtrans %}
  92. {%- endif %}"><i class="icon-comment"></i></a>
  93. <a href="{{ thread_url(thread) }}" class="thread-name">{{ thread.name }}</a>
  94. <span class="thread-details">
  95. {% trans user=thread_starter(thread), forum=thread_forum(thread), start=thread.start|reltimesince|low %}by {{ user }} in {{ forum }} {{ start }}{% endtrans %}
  96. </span>
  97. </td>
  98. <td>
  99. <div class="thread-last-reply">
  100. {{ replies(thread.replies) }} - {% trans user=thread_reply(thread), last=thread.last|reltimesince|low %}last by {{ user }} {{ last }}{% endtrans %}
  101. </div>
  102. </td>
  103. <td class="watched-thread-flags">
  104. <form action="{{ thread_url(thread, 'unwatch') }}" method="post">
  105. <input type="hidden" name="{{ csrf_id }}" value="{{ csrf_token }}">
  106. <input type="hidden" name="retreat" value="{{ delete_retreat(loop) }}">
  107. <button type="submit" class="btn btn-danger tooltip-top" title="{% trans %}Unwatch{% endtrans %}"><i class="icon-remove"></i></button>
  108. </form>
  109. <form action="{% if thread.send_email %}{{ thread_url(thread, 'unwatch_email') }}{% else %}{{ thread_url(thread, 'watch_email') }}{% endif %}" method="post">
  110. <input type="hidden" name="{{ csrf_id }}" value="{{ csrf_token }}">
  111. <input type="hidden" name="retreat" value="{{ request_path }}#watch-{{ loop.index }}">
  112. <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>
  113. </form>
  114. </td>
  115. </tr>
  116. {% endfor %}
  117. </tbody>
  118. </table>#}
  119. </div>
  120. {{ pager() }}
  121. {% else %}
  122. <p class="lead">{% if new -%}
  123. {% trans %}There are no unread threads that you are watching.{% endtrans %}
  124. {%- else -%}
  125. {% trans %}You are not watching any threads.{% endtrans %}
  126. {%- endif %}</p>
  127. {% endif %}
  128. </div>
  129. {% endblock %}
  130. {% macro thread_url(thread, route='') -%}{% filter url(thread=thread.pk, slug=thread.slug) %}{% filter trim %}
  131. {% if thread.forum_id == private_threads.pk -%}
  132. private_thread
  133. {%- elif thread.forum_id == reports.pk -%}
  134. report
  135. {%- else -%}
  136. thread
  137. {%- endif -%}{%- if route %}_{{ route }}{% endif %}{% endfilter %}{% endfilter %}
  138. {%- endmacro%}
  139. {% macro replies(thread_replies) -%}
  140. {% trans count=thread_replies, replies=('<strong>' ~ (thread_replies|intcomma) ~ '</strong>')|safe -%}
  141. {{ replies }} reply
  142. {%- pluralize -%}
  143. {{ replies }} replies
  144. {%- endtrans %}
  145. {%- endmacro %}
  146. {% macro thread_starter(thread) -%}
  147. {% 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 %}
  148. {%- endmacro %}
  149. {% macro thread_forum(thread) -%}
  150. <a href="{{ thread.forum.url }}" class="forum-link">{{ thread.forum }}</a>
  151. {%- endmacro %}
  152. {% macro thread_reply(thread) -%}
  153. {% 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 %}
  154. {%- endmacro %}
  155. {% macro pager() -%}
  156. {% if pagination['total'] > 1 %}
  157. <div class="pagination">
  158. <ul>
  159. <li class="count">{{ macros.pager_label(pagination) }}</li>
  160. {% if new %}
  161. {%- 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 -%}
  162. {%- 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 -%}
  163. {%- 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 -%}
  164. {% else %}
  165. {%- 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 -%}
  166. {%- 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 -%}
  167. {%- 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 -%}
  168. {% endif %}
  169. </ul>
  170. </div>
  171. {% endif %}
  172. {%- endmacro %}
  173. {% macro delete_retreat(loop) -%}
  174. {%- if pagination['page'] == 1 -%}
  175. {{ request_path }}{% if not (loop.first and loop.last) %}#watch-{{ loop.index }}{% endif %}
  176. {%- else -%}
  177. {%- if loop.first and loop.last -%}
  178. {%- if new -%}
  179. {%- if pagination['prev'] > 1 %}{{ url('watched_threads_new', page=pagination['prev']) }}{% else %}{{ url('watched_threads_new') }}{% endif %}
  180. {%- else -%}
  181. {%- if pagination['prev'] > 1 %}{{ url('watched_threads', page=pagination['prev']) }}{% else %}{{ url('watched_threads') }}{% endif %}
  182. {%- endif -%}#watch-{{ settings.threads_per_page }}
  183. {%- else -%}
  184. {{ request_path }}#watch-{{ loop.index }}
  185. {%- endif -%}
  186. {%- endif -%}
  187. {%- endmacro %}