macros.jinja 2.34 KB
Newer Older
Skia's avatar
Skia committed
1
2
3
{% macro user_profile_link(user) -%}
<a href="{{ url("core:user_profile", user_id=user.id) }}">{{ user.get_display_name() }}</a>
{%- endmacro %}
Skia's avatar
Skia committed
4
5
6

{% macro user_link_with_pict(user) -%}
<a href="{{ url("core:user_profile", user_id=user.id) }}" class="mini_profile_link" >
7
8
    {{ user.get_mini_item()|safe }}
</a>
Skia's avatar
Skia committed
9
{%- endmacro %}
10
11
12

{% macro user_mini_profile(user) %}
<div id="user_profile">
Skia's avatar
Skia committed
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31

    <div id="right_column">
        <div id="pictures">
            {% if user.profile_pict %}
            <img src="{{ user.profile_pict.get_download_url() }}" alt="{% trans %}Profile{% endtrans %}" />
            {% endif %}
        </div>
    </div>
    <div id="left_column">
        <p>{{ user.get_full_name() }}</p>
        {% if user.nick_name %}
        <p id="nickname">&laquo; {{ user.nick_name }} &raquo;</p>
        {% endif %}
        {% if user.date_of_birth %}
            <p>{% trans %}Born: {% endtrans %}{{ user.date_of_birth|date("d/m/Y") }} ({{ user.get_age() }})</p>
        {% endif %}
        {% if user.promo %}
        <p><img src="{{ static('core/img/promo_%02d.png' % user.promo) }}" alt="Promo {{ user.promo }}" class="promo_pict" />
        {% trans %}Promo: {% endtrans %}{{ user.promo }}</p>
32
33
34
35
        {% endif %}
    </div>
</div>
{%- endmacro %}
36
37

{% macro show_slots(user) %}
38
    {% if get_subscriber(user).slots.filter(start_date__gte=timezone.now()).exists() %}
39
40
        <h5>{% trans %}Slot{% endtrans %}</h5>
        <ul>
Skia's avatar
Skia committed
41
42
        {% for i in get_subscriber(user).slots.filter(start_date__gte=timezone.now().replace(tzinfo=None)).all() %}
            <li>{{ i.get_type_display() }} - {{i.machine.launderette }}, {{ i.start_date|date("l j") }} : {{ i.start_date|time(DATETIME_FORMAT) }}</li>
43
44
45
46
47
48
49
50
51
52
53
54
55
56
        {% endfor %}
        </ul>
    {% endif %}
{% endmacro %}

{% macro show_tokens(user) %}
    {% if get_subscriber(user).tokens.exists() %}
        <h5>{% trans %}Tokens{% endtrans %}</h5>
        <ul>
        {% for i in get_subscriber(user).tokens.all() %}
            <li>{{ i }}</li>
        {% endfor %}
        </ul>
    {% endif %}
Skia's avatar
Skia committed
57
{% endmacro %}
Sli's avatar
Sli committed
58
59
60
61
62
63

{% macro delete_godfather(user, profile, godfather, is_father) %}
    {% if user == profile or user.is_root or user.is_board_member %}
    <a href="{{ url("core:user_godfathers_delete", user_id=profile.id, godfather_id=godfather.id, is_father=is_father) }}">{% trans %}Delete{% endtrans %}</a>
    {% endif %}
{% endmacro %}