club_list.jinja 1.37 KB
Newer Older
1
2
3
{% extends "core/base.jinja" %}

{% block title %}
Skia's avatar
Skia committed
4
{% trans %}Club list{% endtrans %}
5
6
7
{% endblock %}

{% macro display_club(club) -%}
Sli's avatar
Sli committed
8
9
10
11
12
13
14
15
16

        {% if club.is_active or user.is_root %}
        
        <li><a href="{{ url('club:club_view', club_id=club.id) }}">{{ club.name }}</a>
        
        {% if not club.is_active %}
            ({% trans %}inactive{% endtrans %})
        {% endif %}

Sli's avatar
Sli committed
17
18
        {% if club.president %} - <a href="{{ url('core:user_profile', user_id=club.president.user.id) }}">{{ club.president.user }}</a>{% endif %}
        {% if club.short_description %}<p>{{ club.short_description|markdown }}</p>{% endif %}
Sli's avatar
Sli committed
19
20
21
22
            
        {% endif %}

        {%- if club.children.all()|length != 0 %}
23
        <ul>
Skia's avatar
Skia committed
24
            {%- for c in club.children.order_by('name') %}
25
26
27
28
29
30
31
32
                {{ display_club(c) }}
            {%- endfor %}
        </ul>
        {%- endif -%}
    </li>
{%- endmacro %}

{% block content %}
Skia's avatar
Skia committed
33
    {% if user.is_root %}
Skia's avatar
Skia committed
34
    <p><a href="{{ url('club:club_new') }}">{% trans %}New club{% endtrans %}</a></p>
Skia's avatar
Skia committed
35
    {% endif %}
36
    {% if club_list %}
Skia's avatar
Skia committed
37
38
    <h3>{% trans %}Club list{% endtrans %}</h3>
    <ul>
Sli's avatar
Sli committed
39
        {%- for c in club_list.all().order_by('name') if c.parent is none %}
Skia's avatar
Skia committed
40
41
42
        {{ display_club(c) }}
        {%- endfor %}
    </ul>
43
    {% else %}
Skia's avatar
Skia committed
44
    {% trans %}There is no club in this website.{% endtrans %}
45
46
47
48
49
    {% endif %}
{% endblock %}