watched.html 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  1. {% extends "sora/layout.html" %}
  2. {% load i18n %}
  3. {% import "_forms.html" as form_theme with context %}
  4. {% import "sora/macros.html" as macros with context %}
  5. {% block title %}{{ macros.page_title(title=_('Threads you are watching')) }}{% endblock %}
  6. {% block content %}
  7. <div class="page-header">
  8. <h1>{% trans %}Threads you are watching{% endtrans %}</h1>
  9. </div>
  10. {% if message %}{{ macros.draw_message(message) }}{% endif %}
  11. <div class="list-nav">
  12. {{ pager() }}
  13. <ul class="nav nav-pills pull-right">
  14. <li class="{% if new %}primary{% else %}info{% endif %}"><a href="{% url 'watched_threads_new' %}">{% trans %}Unread Threads{% endtrans %}</a></li>
  15. <li class="{% if not new %}primary{% else %}info{% endif %}"><a href="{% url 'watched_threads' %}">{% trans %}All Threads{% endtrans %}</a></li>
  16. </ul>
  17. </div>
  18. {% if threads %}
  19. <table class="table table-striped threads-list">
  20. <thead>
  21. <tr>
  22. <th style="width: 1%;">&nbsp;</th>
  23. <th>{% trans %}Thread{% endtrans %}</th>
  24. <th>{% trans %}Forum{% endtrans %}</th>
  25. <th>{% trans %}Replies{% endtrans %}</th>
  26. <th>{% trans %}Last Poster{% endtrans %}</th>
  27. <th class="check-cell"><label class="checkbox"><input type="checkbox" class="checkbox-master"></label></th>
  28. </tr>
  29. </thead>
  30. <tbody>
  31. {% for thread in threads %}
  32. <tr>
  33. <td><span class="thread-icon{% if not thread.is_read %} {% if thread.closed %}thread-closed{% else %}thread-new{% endif %}{% endif %}"><i class="icon-comment icon-white"></i></span></td>
  34. <td>
  35. <a href="{% url 'thread' thread=thread.pk, slug=thread.slug %}">{% if not thread.is_read %}<strong>{{ thread.name }}</strong>{% else %}{{ thread.name }}{% endif %}</a> {% if not thread.is_read -%}
  36. <a href="{% url 'thread_new' thread=thread.pk, slug=thread.slug %}" class="jump jump-new tooltip-top" title="{% trans %}Jump to first unread post{% endtrans %}"><i class="icon-chevron-right"></i></a>
  37. {%- else -%}
  38. <a href="{% url 'thread_last' thread=thread.pk, slug=thread.slug %}" class="jump jump-last tooltip-top" title="{% trans %}Jump to last post{% endtrans %}"><i class="icon-chevron-right"></i></a>
  39. {%- endif %}
  40. <ul class="unstyled thread-flags">
  41. {% if thread.send_email %}<li><span class="label label-success tooltip-top" title="{% trans %}You will receive notification on your e-mail when somebody replies to this thread.{% endtrans %}"><i class="icon-envelope icon-white"></i></span></li>{% endif %}
  42. {% if thread.closed %}<li><span class="tooltip-top" title="{% trans %}This thread is closed for new replies.{% endtrans %}"><i class="icon-lock"></i></span></li>{% endif %}
  43. {% if thread.moderated %}<li><span class="tooltip-top" title="{% trans %}This thread will not be visible to other members until moderator reviews it.{% endtrans %}"><i class="icon-eye-close"></i></span></li>{% endif %}
  44. {% if thread.deleted %}<li><span class="tooltip-top" title="{% trans %}This thread has been deleted.{% endtrans %}"><i class="icon-remove"></i></span></li>{% endif %}
  45. </ul>
  46. </td>
  47. <td class="span3 thread-author"><span class="tooltip-top" title="{{ thread.start|reltimesince }}">
  48. <a href="{% url 'forum' forum=thread.forum.pk, slug=thread.forum.slug %}">{{ thread.forum.name }}</a>
  49. </td>
  50. <td class="span1 thread-stat">{{ thread.replies|intcomma }}</td>
  51. <td class="span3 thread-poster"><span class="tooltip-top" title="{{ thread.last|reltimesince }}">{% if thread.last_poster_ignored -%}
  52. {% if settings.avatars_on_threads_list %}<img src="{{ macros.avatar_guest(24) }}" alt="" class="avatar-tiny"> {% endif %}<em class="muted">{% trans %}Ignored Member{% endtrans %}</em>
  53. {%- elif thread.last_poster_id -%}
  54. {% if settings.avatars_on_threads_list %}<img src="{{ thread.last_poster.get_avatar(24) }}" alt="" class="avatar-tiny"> {% endif %}<a href="{% url 'user' user=thread.last_poster_id, username=thread.last_poster_slug %}">{{ thread.last_poster_name }}</a>
  55. {%- else -%}
  56. {% if settings.avatars_on_threads_list %}<img src="{{ macros.avatar_guest(24) }}" alt="" class="avatar-tiny"> {% endif %}<em class="muted">{{ thread.last_poster_name }}</em>
  57. {%- endif %}</span></td>
  58. <td class="check-cell"><label class="checkbox"><input form="threads_form" name="{{ list_form['list_items']['html_name'] }}" type="checkbox" class="checkbox-member" value="{{ thread.pk }}"{% if list_form['list_items']['has_value'] and ('' ~ thread.pk) in list_form['list_items']['value'] %} checked="checked"{% endif %}></label></td>
  59. </tr>
  60. {% endfor %}
  61. </tbody>
  62. </table>
  63. <div class="form-actions table-footer">
  64. <form id="threads_form" class="form-inline pull-right" action="{% if new %}{% url 'watched_threads_new' %}{% else %}{% url 'watched_threads' %}{% endif %}" method="POST">
  65. <input type="hidden" name="{{ csrf_id }}" value="{{ csrf_token }}">
  66. {{ form_theme.input_select(list_form['list_action'],width=3) }}
  67. <button type="submit" class="btn btn-primary">{% trans %}Go{% endtrans %}</button>
  68. </form>
  69. </div>
  70. <div class="list-nav last">
  71. {{ pager() }}
  72. </div>
  73. {% else %}
  74. <p class="lead">{% if new -%}
  75. {% trans %}There are no unread threads that you are watching.{% endtrans %}
  76. {%- else -%}
  77. {% trans %}You are not watching any threads.{% endtrans %}
  78. {%- endif %}</p>
  79. {% endif %}
  80. {% endblock %}
  81. {% block javascripts -%}
  82. {{ super() }}
  83. {%- if user.is_authenticated() and list_form %}
  84. <script type="text/javascript">
  85. $(function () {
  86. $('#threads_form').submit(function() {
  87. if ($('.check-cell[]:checked').length == 0) {
  88. alert("{% trans %}You have to select at least one thread.{% endtrans %}");
  89. return false;
  90. }
  91. return true;
  92. });
  93. });
  94. </script>{% endif %}
  95. {%- endblock %}
  96. {% macro pager() -%}
  97. <ul class="pager pull-left">
  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. <li class="count">
  108. {%- trans current_page=pagination['page'], pages=pagination['total'] -%}
  109. Page {{ current_page }} of {{ pages }}
  110. {%- endtrans -%}
  111. </li>
  112. </ul>
  113. {%- endmacro %}