watched.html 6.7 KB

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