watched.html 6.7 KB

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