Sith/forum/templates/forum/forum.jinja
2023-05-10 11:56:33 +02:00

75 lines
2.3 KiB
Django/Jinja

{% extends "core/base.jinja" %}
{% from 'forum/macros.jinja' import display_forum, display_breadcrumb, display_topic, display_search_bar %}
{% block title %}
{{ forum }}
{% endblock %}
{% block content %}
{{ display_breadcrumb(forum) }}
<div id="forum">
<h3>{{ forum.name }}</h3>
<p>
{%
if user.is_com_admin
or user.is_in_group(pk=settings.SITH_GROUP_FORUM_ADMIN_ID)
or user.can_edit(forum)
%}
<a class="ib button" href="{{ url('forum:new_forum') }}?parent={{ forum.id }}">{% trans %}New forum{% endtrans %}</a> <br/>
{% endif %}
{% if not forum.is_category %}
<a class="ib button" href="{{ url('forum:new_topic', forum_id=forum.id) }}">{% trans %}New topic{% endtrans %}</a>
{% endif %}
{{ display_search_bar(request) }}
</p>
{% if forum.children.exists() %}
<div>
<div class="ib w_big">
{% trans %}Title{% endtrans %}
</div>
<div class="ib w_small">
<div class="ib w_medium">
{% trans %}Topics{% endtrans %}
</div>
<div class="ib w_small">
{% trans %}Last message{% endtrans %}
</div>
</div>
</div>
{{ display_forum(forum, user, True) }}
{% for f in forum.children.all().select_related("_last_message__author", "_last_message__topic") %}
{{ display_forum(f, user) }}
{% endfor %}
{% endif %}
{% if topics %}
<div>
<div class="ib w_medium">
{% trans %}Title{% endtrans %}
</div>
<div class="ib w_medium">
<div class="ib w_small">
{% trans %}Author{% endtrans %}
</div>
<div class="ib w_medium">
{% trans %}Messages{% endtrans %}
</div>
<div class="ib w_small">
{% trans %}Last message{% endtrans %}
</div>
</div>
</div>
{% for t in topics %}
{{ display_topic(t, user) }}
{% endfor %}
<p style="text-align: right; background: #d8e7f3;">
{% for p in topics.paginator.page_range %}
<span class="ib" style="background: {% if p == topics.number %}white{% endif %}; margin: 0;"><a href="?topic_page={{ p }}">{{ p }}</a></span>
{% endfor %}
</p>
{% endif %}
</div>
{% endblock %}