watched.html 7.3 KB

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