123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131 |
- {% extends "cranefly/layout.html" %}
- {% load i18n %}
- {% import "cranefly/macros.html" as macros with context %}
- {% block title %}{{ macros.page_title(title=_('Threads you are watching')) }}{% endblock %}
- {% block container %}
- <div class="page-header header-primary">
- <div class="container">
- {{ messages_list(messages) }}
- <h1>{% trans %}Threads you are watching{% endtrans %}</h1>
- <ul class="nav nav-tabs header-tabs">
- <li class="{% if not new %}active{% endif %}"><a href="{% url 'watched_threads' %}">{% trans %}All Threads{% endtrans %}</a></li>
- <li class="{% if new %}active{% endif %}"><a href="{% url 'watched_threads_new' %}">{% trans %}Unread Threads{% endtrans %}</a></li>
- </ul>
- </div>
- </div>
- <div class="container container-primary">
- {% if message %}
- <div class="messages-list">
- {{ macros.draw_message(message) }}
- </div>
- {% endif %}
- {% if threads %}
- <div class="watched-threads">
- {{ pager() }}
- <table class="table table-striped">
- <thead>
- <tr>
- <th style="width: 1%"> </th>
- <th colspan="2">{% trans %}Thread{% endtrans %}</th>
- <th class="span4">{% trans %}Forum{% endtrans %}</th>
- </tr>
- </thead>
- <tbody>
- {% for thread in threads %}
- <tr id="watch-{{ loop.index }}">
- <td nowrap="nowrap">
- <div class="watched-thread-flags">
- <form action="{% url 'thread_unwatch' thread=thread.pk, slug=thread.slug %}" method="post">
- <input type="hidden" name="{{ csrf_id }}" value="{{ csrf_token }}">
- <input type="hidden" name="retreat" value="{{ delete_retreat(loop) }}">
- <button type="submit" class="btn btn-danger tooltip-top" title="{% trans %}Unwatch{% endtrans %}"><i class="icon-remove"></i></button>
- </form>
- <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">
- <input type="hidden" name="{{ csrf_id }}" value="{{ csrf_token }}">
- <input type="hidden" name="retreat" value="{{ request_path }}#watch-{{ loop.index }}">
- <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>
- </form>
- <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>
- </div>
- </td>
- <td>
- {% if not thread.is_read -%}
- <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 %}">
- {%- else -%}
- <a href="{% url 'thread_last' thread=thread.pk, slug=thread.slug %}" class="thread-title tooltip-top" title="{% trans %}Jump to last post{% endtrans %}">
- {%- endif -%}{{ thread.name }}</a>
- </td>
- <td class="thread-replies">
- {% trans replies=replies(thread.replies), last=thread.last|reldate|low %}{{ replies }}, last one on {{ last }}{% endtrans %}
- </td>
- <td class="thread-forum">
- <a href="{% url 'forum' forum=thread.forum.pk, slug=thread.forum.slug %}">{{ thread.forum.name }}</a>
- </td>
- </tr>
- {% endfor %}
- </tbody>
- </table>
- {{ pager() }}
- </div>
- {% else %}
- <p class="lead">{% if new -%}
- {% trans %}There are no unread threads that you are watching.{% endtrans %}
- {%- else -%}
- {% trans %}You are not watching any threads.{% endtrans %}
- {%- endif %}</p>
- {% endif %}
- </div>
- {% endblock %}
- {% macro pager() -%}
- {% if pagination['total'] > 1 %}
- <div class="pagination">
- <ul>
- <li class="count">{{ macros.pager_label(pagination) }}</li>
- {% if new %}
- {%- 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 -%}
- {%- 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 -%}
- {%- 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 -%}
- {% else %}
- {%- 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 -%}
- {%- 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 -%}
- {%- 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 -%}
- {% endif %}
- </ul>
- </div>
- {% endif %}
- {%- endmacro %}
- {% macro replies(thread_replies) -%}
- {% trans count=thread_replies, replies=thread_replies|intcomma -%}
- One reply
- {%- pluralize -%}
- {{ replies }} replies
- {%- endtrans %}
- {%- endmacro %}
- {% macro delete_retreat(loop) -%}
- {%- if pagination['page'] == 1 -%}
- {{ request_path }}{% if not (loop.first and loop.last) %}#watch-{{ loop.index }}{% endif %}
- {%- else -%}
- {%- if loop.first and loop.last -%}
- {%- if new -%}
- {%- if pagination['prev'] > 1 %}{% url 'watched_threads_new' page=pagination['prev'] %}{% else %}{% url 'watched_threads_new' %}{% endif %}
- {%- else -%}
- {%- if pagination['prev'] > 1 %}{% url 'watched_threads' page=pagination['prev'] %}{% else %}{% url 'watched_threads' %}{% endif %}
- {%- endif -%}#watch-{{ settings.threads_per_page }}
- {%- else -%}
- {{ request_path }}#watch-{{ loop.index }}
- {%- endif -%}
- {%- endif -%}
- {%- endmacro %}
|