watched.html 8.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158
  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-new 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 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 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 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 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 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 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. <a href="{{ thread_url(thread) }}">{{ thread.name }}</a>
  69. </div>
  70. <ul class="thread-details">
  71. <li><a href="{{ thread.forum.url }}" class="forum-link">{{ thread.forum }}</a></li>
  72. <li>{% trans user=thread_starter(thread), start=thread.start|reldate|low %}Started by {{ user }}, {{ start }}{% endtrans %}</li>
  73. {% if thread.replies %}
  74. <li><i class="icon-comments-alt"></i> {% trans count=thread.replies, replies=thread.replies|intcomma, user=thread_reply(thread), last=thread.last|reldate|low -%}
  75. {{ replies }} reply, by {{ user }} {{ last }}
  76. {%- pluralize -%}
  77. {{ replies }} replies, last by {{ user }} {{ last }}
  78. {%- endtrans %}</li>
  79. {% else %}
  80. <li><i class="icon-comments-alt"></i> {% trans %}No replies{% endtrans %}</li>
  81. {% endif %}
  82. </ul>
  83. </div>
  84. </li>
  85. {% endfor %}
  86. </ul>
  87. </div>
  88. {{ pager() }}
  89. {% else %}
  90. <p class="lead">{% if new -%}
  91. {% trans %}There are no unread threads that you are watching.{% endtrans %}
  92. {%- else -%}
  93. {% trans %}You are not watching any threads.{% endtrans %}
  94. {%- endif %}</p>
  95. {% endif %}
  96. </div>
  97. {% endblock %}
  98. {% macro thread_url(thread, route='') -%}
  99. {%- if route %}{% set route = '_'~route %}{% endif %}
  100. {% if thread.forum_id == private_threads.pk -%}
  101. {{ url('private_thread' ~ route, thread=thread.pk, slug=thread.slug) }}
  102. {%- elif thread.forum_id == reports.pk -%}
  103. {{ url('report' ~ route, thread=thread.pk, slug=thread.slug) }}
  104. {%- else -%}
  105. {{ url('thread' ~ route, thread=thread.pk, slug=thread.slug) }}
  106. {%- endif -%}
  107. {%- endmacro %}
  108. {% macro thread_starter(thread) -%}
  109. {% 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 %}
  110. {%- endmacro %}
  111. {% macro thread_reply(thread) -%}
  112. {% 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 %}
  113. {%- endmacro %}
  114. {% macro pager() -%}
  115. {% if pagination['total'] > 1 %}
  116. <div class="pagination">
  117. <ul>
  118. <li class="count">{{ macros.pager_label(pagination) }}</li>
  119. {% if new %}
  120. {%- 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 -%}
  121. {%- 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 -%}
  122. {%- 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 -%}
  123. {% else %}
  124. {%- 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 -%}
  125. {%- 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 -%}
  126. {%- 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 -%}
  127. {% endif %}
  128. </ul>
  129. </div>
  130. {% endif %}
  131. {%- endmacro %}
  132. {% macro delete_retreat(loop) -%}
  133. {%- if pagination['page'] == 1 -%}
  134. {{ request_path }}{% if not (loop.first and loop.last) %}#watch-{{ loop.index }}{% endif %}
  135. {%- else -%}
  136. {%- if loop.first and loop.last -%}
  137. {%- if new -%}
  138. {%- if pagination['prev'] > 1 %}{{ url('watched_threads_new', page=pagination['prev']) }}{% else %}{{ url('watched_threads_new') }}{% endif %}
  139. {%- else -%}
  140. {%- if pagination['prev'] > 1 %}{{ url('watched_threads', page=pagination['prev']) }}{% else %}{{ url('watched_threads') }}{% endif %}
  141. {%- endif -%}#watch-{{ settings.threads_per_page }}
  142. {%- else -%}
  143. {{ request_path }}#watch-{{ loop.index }}
  144. {%- endif -%}
  145. {%- endif -%}
  146. {%- endmacro %}