123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163 |
- {% extends "cranefly/layout.html" %}
- {% 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 %}
- {{ pager() }}
- <div class="forum-threads-list watched-threads">
- <ul>
- {% for thread in threads %}
- <li id="watch-{{ loop.index }}"{% if not thread.is_read %} class="thread-new"{% endif %}>
- <div class="thread-icon">
- {% if thread.weight == 2 %}
- {% if thread.is_read %}
- <a href="{{ thread_url(thread, 'new') }}" class="thread-icon-last tooltip-top" title="{% trans %}Announcement, click to see last post{% endtrans %}">
- {% else %}
- <a href="{{ thread_url(thread, 'new') }}" class="thread-icon-new tooltip-top" title="{% trans %}Announcement, click to see first unread post{% endtrans %}">
- {% endif %}
- <i class="icon-star{% if thread.is_read %}-empty{% endif %}"></i>
- </a>
- {% elif thread.weight == 1 %}
- {% if thread.is_read %}
- <a href="{{ thread_url(thread, 'new') }}" class="thread-icon-last tooltip-top" title="{% trans %}Pinned, click to see last post{% endtrans %}">
- {% else %}
- <a href="{{ thread_url(thread, 'new') }}" class="thread-icon-new tooltip-top" title="{% trans %}Pinned, click to see first unread post{% endtrans %}">
- {% endif %}
- <i class="icon-bookmark{% if thread.is_read %}-empty{% endif %}"></i>
- </a>
- {% else %}
- {% if thread.is_read %}
- <a href="{{ thread_url(thread, 'new') }}" class="thread-icon-last tooltip-top" title="{% trans %}Click to see last post{% endtrans %}">
- {% else %}
- <a href="{{ thread_url(thread, 'new') }}" class="thread-icon-new tooltip-top" title="{% trans %}Click to see first unread post{% endtrans %}">
- {% endif %}
- <i class="icon-circle{% if thread.is_read %}-blank{% endif %}"></i>
- </a>
- {% endif %}
- </div>
- <div class="thread-body">
- <div class="thread-actions">
- <form action="{% if thread.send_email %}{{ thread_url(thread, 'unwatch_email') }}{% else %}{{ thread_url(thread, 'watch_email') }}{% 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{% if thread.send_email %} btn-success{% endif %} tooltip-top" title="{% if thread.send_email %}{% trans %}Click to don't notify with e-mail{% endtrans %}{% else %}{% trans %}Click to notify with e-mail{% endtrans %}{% endif %}"><i class="icon-envelope-alt"></i> {% if thread.send_email %}{% trans %}Notify{% endtrans %}{% else %}{% trans %}Notify{% endtrans %}{% endif %}</button>
- </form>
- <form action="{{ thread_url(thread, 'unwatch') }}" 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 %}Click to remove from list{% endtrans %}"><i class="icon-remove"></i> {% trans %}Unwatch{% endtrans %}</button>
- </form>
- </div>
- <div class="thread-title">
- {% if thread.prefix_id %}{{ draw_prefix(thread.forum, prefixes[thread.prefix_id]) }}{% endif %}
- <a href="{{ thread_url(thread) }}" class="thread-link">{{ thread.name }}</a>
- </div>
- <ul class="thread-details">
- <li><a href="{{ thread.forum.url }}" class="forum-link">{{ thread.forum }}</a></li>
- <li>{% trans user=thread_starter(thread), start=thread.start|reldate|low %}Started by {{ user }}, {{ start }}{% endtrans %}</li>
- {% if thread.replies %}
- <li><i class="icon-comments-alt"></i> {% trans count=thread.replies, replies=thread.replies|intcomma, user=thread_reply(thread), last=thread.last|reldate|low -%}
- {{ replies }} reply, by {{ user }} {{ last }}
- {%- pluralize -%}
- {{ replies }} replies, last by {{ user }} {{ last }}
- {%- endtrans %}</li>
- {% else %}
- <li><i class="icon-comments-alt"></i> {% trans %}No replies{% endtrans %}</li>
- {% endif %}
- </ul>
- </div>
- </li>
- {% endfor %}
- </ul>
- </div>
- {{ pager() }}
- {% 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 thread_url(thread, route='') -%}
- {%- if route %}{% set route = '_'~route %}{% endif %}
- {% if thread.forum_id == private_threads.pk -%}
- {{ url('private_thread' ~ route, thread=thread.pk, slug=thread.slug) }}
- {%- elif thread.forum_id == reports.pk -%}
- {{ url('report' ~ route, thread=thread.pk, slug=thread.slug) }}
- {%- else -%}
- {{ url('thread' ~ route, thread=thread.pk, slug=thread.slug) }}
- {%- endif -%}
- {%- endmacro %}
- {% macro thread_starter(thread) -%}
- {% 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 %}
- {%- endmacro %}
- {% macro thread_reply(thread) -%}
- {% 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 %}
- {%- endmacro %}
- {% 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 draw_prefix(forum, prefix) -%}
- <a href="{{ url('forum_prefixed', slug=forum.slug, forum=forum.id, prefix=prefix.slug) }}" class="label{% if prefix.style %} label-{{ prefix.style }}{% endif %} thread-prefix thread-prefix-active">{{ _(prefix.name) }}</a>
- {%- 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 %}
|