watched.html 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  1. {% extends "cranefly/layout.html" %}
  2. {% load i18n %}
  3. {% import "cranefly/macros.html" as macros with context %}
  4. {% block title %}{{ macros.page_title(title=_('Threads you are watching')) }}{% endblock %}
  5. {% block container %}
  6. <div class="page-header header-primary">
  7. <div class="container">
  8. {% if messages %}
  9. <div class="messages-list">
  10. {{ messages_list(messages) }}
  11. </div>
  12. {% endif %}
  13. <h1>{% trans %}Threads you are watching{% endtrans %}</h1>
  14. <ul class="nav nav-tabs header-tabs">
  15. <li class="{% if not new %}active{% endif %}"><a href="{% url 'watched_threads' %}">{% trans %}All Threads{% endtrans %}</a></li>
  16. <li class="{% if new %}active{% endif %}"><a href="{% url 'watched_threads_new' %}">{% trans %}Unread Threads{% endtrans %}</a></li>
  17. </ul>
  18. </div>
  19. </div>
  20. <div class="container container-primary">
  21. {% if message %}
  22. <div class="messages-list">
  23. {{ macros.draw_message(message) }}
  24. </div>
  25. {% endif %}
  26. {% if threads %}
  27. <div class="watched-threads">
  28. {{ pager() }}
  29. <table class="table table-striped">
  30. <thead>
  31. <tr>
  32. <th style="width: 1%">&nbsp;</th>
  33. <th colspan="2">{% trans %}Thread{% endtrans %}</th>
  34. <th class="span4">{% trans %}Forum{% endtrans %}</th>
  35. </tr>
  36. </thead>
  37. <tbody>
  38. {% for thread in threads %}
  39. <tr id="watch-{{ loop.index }}">
  40. <td nowrap="nowrap">
  41. <div class="watched-thread-flags">
  42. <form action="{% url 'thread_unwatch' thread=thread.pk, slug=thread.slug %}" method="post">
  43. <input type="hidden" name="{{ csrf_id }}" value="{{ csrf_token }}">
  44. <input type="hidden" name="retreat" value="{{ delete_retreat(loop) }}">
  45. <button type="submit" class="btn btn-danger tooltip-top" title="{% trans %}Unwatch{% endtrans %}"><i class="icon-remove"></i></button>
  46. </form>
  47. <form action="{% if thread.send_email %}{% url 'thread_unwatch_email' thread=thread.pk, slug=thread.slug %}{% else %}{% url 'thread_watch_email' thread=thread.pk, slug=thread.slug %}{% endif %}" method="post">
  48. <input type="hidden" name="{{ csrf_id }}" value="{{ csrf_token }}">
  49. <input type="hidden" name="retreat" value="{{ request_path }}#watch-{{ loop.index }}">
  50. <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>
  51. </form>
  52. <span class="label thread-{% if thread.is_read -%}read{% else %}new{% endif %} tooltip-top" title="{% if thread.is_read %}{% trans %}No new posts{% endtrans %}{% else %}{% trans %}New posts{% endtrans %}{% endif %}"><i class="icon-comment"></i></span>
  53. </div>
  54. </td>
  55. <td>
  56. {% if not thread.is_read -%}
  57. <a href="{% url 'thread_new' thread=thread.pk, slug=thread.slug %}" class="thread-title thread-title-new tooltip-top" title="{% trans %}Jump to first unread post{% endtrans %}">
  58. {%- else -%}
  59. <a href="{% url 'thread_last' thread=thread.pk, slug=thread.slug %}" class="thread-title tooltip-top" title="{% trans %}Jump to last post{% endtrans %}">
  60. {%- endif -%}{{ thread.name }}</a>
  61. </td>
  62. <td class="thread-replies">
  63. {% trans replies=replies(thread.replies), last=thread.last|reldate|low %}{{ replies }}, last one on {{ last }}{% endtrans %}
  64. </td>
  65. <td class="thread-forum">
  66. <a href="{% url 'forum' forum=thread.forum.pk, slug=thread.forum.slug %}">{{ thread.forum.name }}</a>
  67. </td>
  68. </tr>
  69. {% endfor %}
  70. </tbody>
  71. </table>
  72. {{ pager() }}
  73. </div>
  74. {% else %}
  75. <p class="lead">{% if new -%}
  76. {% trans %}There are no unread threads that you are watching.{% endtrans %}
  77. {%- else -%}
  78. {% trans %}You are not watching any threads.{% endtrans %}
  79. {%- endif %}</p>
  80. {% endif %}
  81. </div>
  82. {% endblock %}
  83. {% macro pager() -%}
  84. {% if pagination['total'] > 1 %}
  85. <div class="pagination">
  86. <ul>
  87. <li class="count">{{ macros.pager_label(pagination) }}</li>
  88. {% if new %}
  89. {%- 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 -%}
  90. {%- 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 -%}
  91. {%- 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 -%}
  92. {% else %}
  93. {%- 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 -%}
  94. {%- 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 -%}
  95. {%- 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 -%}
  96. {% endif %}
  97. </ul>
  98. </div>
  99. {% endif %}
  100. {%- endmacro %}
  101. {% macro replies(thread_replies) -%}
  102. {% trans count=thread_replies, replies=thread_replies|intcomma -%}
  103. One reply
  104. {%- pluralize -%}
  105. {{ replies }} replies
  106. {%- endtrans %}
  107. {%- endmacro %}
  108. {% macro delete_retreat(loop) -%}
  109. {%- if pagination['page'] == 1 -%}
  110. {{ request_path }}{% if not (loop.first and loop.last) %}#watch-{{ loop.index }}{% endif %}
  111. {%- else -%}
  112. {%- if loop.first and loop.last -%}
  113. {%- if new -%}
  114. {%- if pagination['prev'] > 1 %}{% url 'watched_threads_new' page=pagination['prev'] %}{% else %}{% url 'watched_threads_new' %}{% endif %}
  115. {%- else -%}
  116. {%- if pagination['prev'] > 1 %}{% url 'watched_threads' page=pagination['prev'] %}{% else %}{% url 'watched_threads' %}{% endif %}
  117. {%- endif -%}#watch-{{ settings.threads_per_page }}
  118. {%- else -%}
  119. {{ request_path }}#watch-{{ loop.index }}
  120. {%- endif -%}
  121. {%- endif -%}
  122. {%- endmacro %}