forum.jinja 2.27 KB
Newer Older
Skia's avatar
Skia committed
1
{% extends "core/base.jinja" %}
2
{% from 'forum/macros.jinja' import display_forum, display_breadcrumb, display_topic, display_search_bar %}
Skia's avatar
Skia committed
3 4 5 6

{% block title %}
{{ forum }}
{% endblock %}
Skia's avatar
Skia committed
7 8

{% block content %}
9
{{ display_breadcrumb(forum) }}
Skia's avatar
Skia committed
10
<div id="forum">
Skia's avatar
Skia committed
11
    <h3>{{ forum.name }}</h3>
12
    <p>
Sli's avatar
Sli committed
13
    {% if user.is_in_group(settings.SITH_GROUP_FORUM_ADMIN_ID) or user.is_in_group(settings.SITH_GROUP_COM_ADMIN_ID) or user.can_edit(forum) %}
Skia's avatar
Skia committed
14
        <a class="ib button" href="{{ url('forum:new_forum') }}?parent={{ forum.id }}">{% trans %}New forum{% endtrans %}</a> <br/>
15
    {% endif %}
Krophil's avatar
Krophil committed
16
    {% if not forum.is_category %}
Skia's avatar
Skia committed
17
        <a class="ib button" href="{{ url('forum:new_topic', forum_id=forum.id) }}">{% trans %}New topic{% endtrans %}</a>
Krophil's avatar
Krophil committed
18
    {% endif %}
Sli's avatar
Sli committed
19
    {{ display_search_bar(request) }}
20
    </p>
21 22 23
    {% if forum.children.exists() %}
    <div>
        <div class="ib w_big">
Skia's avatar
Skia committed
24
            {% trans %}Title{% endtrans %}
25 26 27
        </div>
        <div class="ib w_small">
            <div class="ib w_medium">
Skia's avatar
Skia committed
28
                {% trans %}Topics{% endtrans %}
29 30
            </div>
            <div class="ib w_small">
Skia's avatar
Skia committed
31
                {% trans %}Last message{% endtrans %}
32 33 34
            </div>
        </div>
    </div>
Skia's avatar
Skia committed
35
    {{ display_forum(forum, user, True) }}
36
    {% for f in forum.children.all().select_related("_last_message__author", "_last_message__topic") %}
37
    {{ display_forum(f, user) }}
Skia's avatar
Skia committed
38
    {% endfor %}
39 40 41 42
    {% endif %}
    {% if topics %}
    <div>
        <div class="ib w_medium">
Skia's avatar
Skia committed
43
            {% trans %}Title{% endtrans %}
44 45 46
        </div>
        <div class="ib w_medium">
            <div class="ib w_small">
Skia's avatar
Skia committed
47
                {% trans %}Author{% endtrans %}
48 49
            </div>
            <div class="ib w_medium">
Skia's avatar
Skia committed
50
                {% trans %}Messages{% endtrans %}
51 52
            </div>
            <div class="ib w_small">
Skia's avatar
Skia committed
53
                {% trans %}Last message{% endtrans %}
54 55 56
            </div>
        </div>
    </div>
Skia's avatar
Skia committed
57
    {% for t in topics %}
Skia's avatar
Skia committed
58
    {{ display_topic(t, user) }}
Skia's avatar
Skia committed
59
    {% endfor %}
Skia's avatar
Skia committed
60 61 62 63 64
    <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>
65
    {% endif %}
Skia's avatar
Skia committed
66
</div>
Skia's avatar
Skia committed
67 68 69 70
{% endblock %}