forum: add favorite topics

Signed-off-by: Skia <skia@libskia.so>
This commit is contained in:
Skia
2018-02-22 22:19:17 +01:00
parent f47f846d26
commit 606f1af4d5
9 changed files with 231 additions and 114 deletions

View File

@ -0,0 +1,33 @@
{% extends "core/base.jinja" %}
{% from 'forum/macros.jinja' import display_topic %}
{% block title %}
{% trans %}Favorite topics{% endtrans %}
{% endblock %}
{% block content %}
<p>
<a href="{{ url('forum:main') }}">Forum</a> >
<a href="{{ url('forum:favorite_topics') }}">{% trans %}Favorite topics{% endtrans %}</a>
</p>
<div id="forum">
<h3>{% trans %}Forum{% endtrans %}</h3>
<h4>{% trans %}Favorite topics{% endtrans %}</h4>
{% for t in page_obj.object_list %}
{% if user.can_view(t) %}
{{ display_topic(t, user) }}
{% endif %}
{% endfor %}
<p style="text-align: right; background: #d8e7f3;">
{% for p in paginator.page_range %}
<span class="ib" style="background: {% if p == paginator.number %}white{% endif %}; margin: 0;">
<a href="?page={{ p }}">{{ p }}</a>
</span>
{% endfor %}
</p>
</div>
{% endblock %}

View File

@ -14,6 +14,7 @@
<h3>{% trans %}Forum{% endtrans %}</h3>
<p>
<a class="ib button" href="{{ url('forum:last_unread') }}">{% trans %}View last unread messages{% endtrans %}</a>
<a class="ib button" href="{{ url('forum:favorite_topics') }}">{% trans %}Favorite topics{% endtrans %}</a>
</p>
{% if user.is_in_group(settings.SITH_GROUP_FORUM_ADMIN_ID) or user.is_in_group(settings.SITH_GROUP_COM_ADMIN_ID) %}
<p>

View File

@ -37,7 +37,14 @@
<h3>{{ topic.title }}</h3>
<div id="forum">
<p>{{ topic.description }}</p>
<p><a href="{{ url('forum:new_message', topic_id=topic.id) }}">{% trans %}Reply{% endtrans %}</a></p>
<p>
<a class="ib button" href="{{ url('forum:new_message', topic_id=topic.id) }}">{% trans %}Reply{% endtrans %}</a>
{% if user in topic.subscribed_users.all() %}
<a class="ib button" href="{{ url('forum:toggle_subscribe_topic', topic_id=topic.id) }}">{% trans %}Unmark as favorite{% endtrans %}</a>
{% else %}
<a class="ib button" href="{{ url('forum:toggle_subscribe_topic', topic_id=topic.id) }}">{% trans %}Mark as favorite{% endtrans %}</a>
{% endif %}
</p>
<p style="text-align: right; background: #d8e7f3;">
{% for p in msgs.paginator.page_range %}
@ -56,7 +63,7 @@
{% endif %}
{% endfor %}
<p><a href="{{ url('forum:new_message', topic_id=topic.id) }}">{% trans %}Reply{% endtrans %}</a></p>
<p><a class="ib button" href="{{ url('forum:new_message', topic_id=topic.id) }}">{% trans %}Reply{% endtrans %}</a></p>
<p style="text-align: right; background: #d8e7f3;">
{% for p in msgs.paginator.page_range %}