macros.jinja 1.23 KB
Newer Older
1
{% macro display_forum(forum, user) %}
Skia's avatar
Skia committed
2
<div class="forum {% if forum.is_category %}category{% endif %}">
Skia's avatar
Skia committed
3 4 5 6 7 8 9 10 11 12 13 14 15
    <div class="ib w_big">
        {% if not forum.is_category %}
        <a class="ib w_big" href="{{ url('forum:view_forum', forum_id=forum.id) }}">
        {% else %}
        <div class="ib w_big">
        {% endif %}
            <h5>{{ forum.name }}</h5>
            <p>{{ forum.description }}</p>
        {% if not forum.is_category %}
        </a>
        {% else %}
        </div>
        {% endif %}
16
        {% if user.is_owner(forum) %}
Skia's avatar
Skia committed
17
        <a class="ib" href="{{ url('forum:edit_forum', forum_id=forum.id) }}">Edit</a>
18 19
        <a class="ib" href="{{ url('forum:delete_forum', forum_id=forum.id) }}">Delete</a>
        {% endif %}
Skia's avatar
Skia committed
20 21
    </div>
    {% if not forum.is_category %}
Skia's avatar
Skia committed
22 23 24 25 26 27 28 29 30 31 32 33
    <div class="ib w_small">
        <div class="ib w_medium">
            {{ forum.get_topic_number() }}
        </div>
        <div class="ib w_medium">
            {% set last_msg = forum.get_last_message() %}
            {% if last_msg %}
            {{ last_msg.author }} <br/>
            {{ last_msg.date|date(DATETIME_FORMAT) }} {{ last_msg.date|time(DATETIME_FORMAT) }}
            {% endif %}
        </div>
    </div>
Skia's avatar
Skia committed
34
    {% endif %}
Skia's avatar
Skia committed
35 36 37 38
</div>
{% endmacro %}