watched.html 9.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163
  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. <ul>
  25. {% for thread in threads %}
  26. <li id="watch-{{ loop.index }}"{% if not thread.is_read %} class="thread-new"{% endif %}>
  27. <div class="thread-icon">
  28. {% if thread.weight == 2 %}
  29. {% if thread.is_read %}
  30. <a href="{{ thread_url(thread, 'new') }}" class="thread-icon-last tooltip-top" title="{% trans %}Announcement, click to see last post{% endtrans %}">
  31. {% else %}
  32. <a href="{{ thread_url(thread, 'new') }}" class="thread-icon-new tooltip-top" title="{% trans %}Announcement, click to see first unread post{% endtrans %}">
  33. {% endif %}
  34. <i class="icon-star{% if thread.is_read %}-empty{% endif %}"></i>
  35. </a>
  36. {% elif thread.weight == 1 %}
  37. {% if thread.is_read %}
  38. <a href="{{ thread_url(thread, 'new') }}" class="thread-icon-last tooltip-top" title="{% trans %}Pinned, click to see last post{% endtrans %}">
  39. {% else %}
  40. <a href="{{ thread_url(thread, 'new') }}" class="thread-icon-new tooltip-top" title="{% trans %}Pinned, click to see first unread post{% endtrans %}">
  41. {% endif %}
  42. <i class="icon-bookmark{% if thread.is_read %}-empty{% endif %}"></i>
  43. </a>
  44. {% else %}
  45. {% if thread.is_read %}
  46. <a href="{{ thread_url(thread, 'new') }}" class="thread-icon-last tooltip-top" title="{% trans %}Click to see last post{% endtrans %}">
  47. {% else %}
  48. <a href="{{ thread_url(thread, 'new') }}" class="thread-icon-new tooltip-top" title="{% trans %}Click to see first unread post{% endtrans %}">
  49. {% endif %}
  50. <i class="icon-circle{% if thread.is_read %}-blank{% endif %}"></i>
  51. </a>
  52. {% endif %}
  53. </div>
  54. <div class="thread-body">
  55. <div class="thread-actions">
  56. <form action="{% if thread.send_email %}{{ thread_url(thread, 'unwatch_email') }}{% else %}{{ thread_url(thread, 'watch_email') }}{% endif %}" method="post">
  57. <input type="hidden" name="{{ csrf_id }}" value="{{ csrf_token }}">
  58. <input type="hidden" name="retreat" value="{{ request_path }}#watch-{{ loop.index }}">
  59. <button type="submit" class="btn{% if thread.send_email %} btn-success{% endif %} tooltip-top" title="{% if thread.send_email %}{% trans %}Click to don't notify with e-mail{% endtrans %}{% else %}{% trans %}Click to notify with e-mail{% endtrans %}{% endif %}"><i class="icon-envelope-alt"></i> {% if thread.send_email %}{% trans %}Notify{% endtrans %}{% else %}{% trans %}Notify{% endtrans %}{% endif %}</button>
  60. </form>
  61. <form action="{{ thread_url(thread, 'unwatch') }}" method="post">
  62. <input type="hidden" name="{{ csrf_id }}" value="{{ csrf_token }}">
  63. <input type="hidden" name="retreat" value="{{ delete_retreat(loop) }}">
  64. <button type="submit" class="btn btn-danger tooltip-top" title="{% trans %}Click to remove from list{% endtrans %}"><i class="icon-remove"></i> {% trans %}Unwatch{% endtrans %}</button>
  65. </form>
  66. </div>
  67. <div class="thread-title">
  68. {% if thread.prefix_id %}{{ draw_prefix(thread.forum, prefixes[thread.prefix_id]) }}{% endif %}
  69. <a href="{{ thread_url(thread) }}" class="thread-link">{{ thread.name }}</a>
  70. </div>
  71. <ul class="thread-details">
  72. <li><a href="{{ thread.forum.url }}" class="forum-link">{{ thread.forum }}</a></li>
  73. <li>{% trans user=thread_starter(thread), start=thread.start|reldate|low %}Started by {{ user }}, {{ start }}{% endtrans %}</li>
  74. {% if thread.replies %}
  75. <li><i class="icon-comments-alt"></i> {% trans count=thread.replies, replies=thread.replies|intcomma, user=thread_reply(thread), last=thread.last|reldate|low -%}
  76. {{ replies }} reply, by {{ user }} {{ last }}
  77. {%- pluralize -%}
  78. {{ replies }} replies, last by {{ user }} {{ last }}
  79. {%- endtrans %}</li>
  80. {% else %}
  81. <li><i class="icon-comments-alt"></i> {% trans %}No replies{% endtrans %}</li>
  82. {% endif %}
  83. </ul>
  84. </div>
  85. </li>
  86. {% endfor %}
  87. </ul>
  88. </div>
  89. {{ pager() }}
  90. {% else %}
  91. <p class="lead">{% if new -%}
  92. {% trans %}There are no unread threads that you are watching.{% endtrans %}
  93. {%- else -%}
  94. {% trans %}You are not watching any threads.{% endtrans %}
  95. {%- endif %}</p>
  96. {% endif %}
  97. </div>
  98. {% endblock %}
  99. {% macro thread_url(thread, route='') -%}
  100. {%- if route %}{% set route = '_'~route %}{% endif %}
  101. {% if thread.forum_id == private_threads.pk -%}
  102. {{ url('private_thread' ~ route, thread=thread.pk, slug=thread.slug) }}
  103. {%- elif thread.forum_id == reports.pk -%}
  104. {{ url('report' ~ route, thread=thread.pk, slug=thread.slug) }}
  105. {%- else -%}
  106. {{ url('thread' ~ route, thread=thread.pk, slug=thread.slug) }}
  107. {%- endif -%}
  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'] > 1 %}
  117. <div class="pagination">
  118. <ul>
  119. <li class="count">{{ macros.pager_label(pagination) }}</li>
  120. {% if new %}
  121. {%- 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 -%}
  122. {%- 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 -%}
  123. {%- 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 -%}
  124. {% else %}
  125. {%- 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 -%}
  126. {%- 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 -%}
  127. {%- 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 -%}
  128. {% endif %}
  129. </ul>
  130. </div>
  131. {% endif %}
  132. {%- endmacro %}
  133. {% macro draw_prefix(forum, prefix) -%}
  134. <a href="{{ url('forum_prefixed', slug=forum.slug, forum=forum.id, prefix=prefix.slug) }}" class="label{% if prefix.style %} label-{{ prefix.style }}{% endif %} thread-prefix thread-prefix-active">{{ _(prefix.name) }}</a>
  135. {%- endmacro %}
  136. {% macro delete_retreat(loop) -%}
  137. {%- if pagination['page'] == 1 -%}
  138. {{ request_path }}{% if not (loop.first and loop.last) %}#watch-{{ loop.index }}{% endif %}
  139. {%- else -%}
  140. {%- if loop.first and loop.last -%}
  141. {%- if new -%}
  142. {%- if pagination['prev'] > 1 %}{{ url('watched_threads_new', page=pagination['prev']) }}{% else %}{{ url('watched_threads_new') }}{% endif %}
  143. {%- else -%}
  144. {%- if pagination['prev'] > 1 %}{{ url('watched_threads', page=pagination['prev']) }}{% else %}{{ url('watched_threads') }}{% endif %}
  145. {%- endif -%}#watch-{{ settings.threads_per_page }}
  146. {%- else -%}
  147. {{ request_path }}#watch-{{ loop.index }}
  148. {%- endif -%}
  149. {%- endif -%}
  150. {%- endmacro %}