user_detail.jinja 3.57 KB
Newer Older
1
{% extends "core/base.jinja" %}
2
{% from "core/macros.jinja" import show_slots, show_tokens %}
Skia's avatar
Skia committed
3
4

{% block title %}
Skia's avatar
Skia committed
5
{% trans user_name=profile.get_display_name() %}{{ user_name }}'s profile{% endtrans %}
Skia's avatar
Skia committed
6
7
{% endblock %}

8
{% block content %}
9

10
11
<div id="user_profile_container">
    <div id="user_profile">
Skia's avatar
Skia committed
12
13
14
        <div id="right_column">
            <div id="pictures">
                {% if profile.profile_pict %}
15
16
17
                <img src="{{ profile.profile_pict.get_download_url() }}" alt="{% trans %}Profile{% endtrans %}" id="picture" />
                {% else %}
                <img src="{{ static('core/img/unknown.jpg') }}" alt="{% trans %}Profile{% endtrans %}" id="picture" />
Skia's avatar
Skia committed
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
                {% endif %}
            </div>
            <p id="quote"><em>{{ profile.quote }}</em></p>
        </div>
        <div id="left_column">
            <h4>{{ profile.get_full_name() }}</h4>
            {% if profile.nick_name %}
            <p id="nickname">&laquo; {{ profile.nick_name }} &raquo;</p>
            {% endif %}
            {% if profile.date_of_birth %}
            <p>{% trans %}Born: {% endtrans %}{{ profile.date_of_birth|date("d/m/Y") }}</p>
            {% endif %}
            {% if profile.department != "NA" %}
            <p>{{ profile.department }}{{ profile.semester }}
            {% endif %}
            {% if profile.dpt_option %}
            <br>{% trans %}Option: {% endtrans %}{{ profile.dpt_option }}
            {% endif %}
Skia's avatar
Skia committed
36
37
38
39
40
            {% if profile.phone %}
            <p>
            {{ profile.phone }}
            </p>
            {% endif %}
Sli's avatar
Sli committed
41
42
43
44
45
            {% if profile.address %}
            <p>
            {{ profile.address }}
            </p>
            {% endif %}
Skia's avatar
Skia committed
46
47
48
49
            </p>
            {% if profile.promo %}
            <p><img src="{{ static('core/img/promo_%02d.png' % profile.promo) }}" alt="Promo {{ profile.promo }}" class="promo_pict" />
            {% trans %}Promo: {% endtrans %}{{ profile.promo }}</p>
50
51
            {% endif %}
        </div>
52
    </div>
53
</div>
Skia's avatar
Skia committed
54

Skia's avatar
Skia committed
55
{% if user.memberships.filter(end_date=None).exists() or user.is_in_group(settings.SITH_MAIN_BOARD_GROUP) or user == profile %}
56
{# if the user is member of a club, he can view the subscription state #}
Skia's avatar
Skia committed
57
58
<p>
{% if get_subscriber(profile).is_subscribed() %}
Sli's avatar
Sli committed
59
    {% if user == profile or user.is_root or user.is_board_member %}
60
61
        {% trans subscription_end=get_subscriber(profile).subscriptions.last().subscription_end %}Subscribed until {{ subscription_end }}{% endtrans %}<br/>
        {% trans %}Account number: {% endtrans %}{{ profile.customer.account_id }}<br/>
Sli's avatar
Sli committed
62
63
    {% endif %}
    {% if user == profile or user.is_root or user.is_board_member or user.is_launderette_manager %}
64
65
66
67
        {# Shows tokens bought by the user #}
        {{ show_tokens(profile) }}
        {# Shows slots took by the user #}
        {{ show_slots(profile) }}
68
    {% endif %}
Skia's avatar
Skia committed
69
{% else %}
Sli's avatar
Sli committed
70
71
72
73
74
75
    {% trans %}Not subscribed{% endtrans %}
    {% if user.is_in_group(settings.SITH_MAIN_BOARD_GROUP) %}
        <a href="{{ url('subscription:subscription') }}?member={{ profile.id }}">{% trans %}New subscription{% endtrans %}</a>
        {% endif %}
    {% endif %}
    </p>
76
{% endif %}
Skia's avatar
Skia committed
77

Skia's avatar
Skia committed
78
79
{% endblock %}

80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
{% block script %}
{{ super() }}
<script>
$( function() {
    var keys = [];
    var pattern = "71,85,89,71,85,89";
    $(document).keydown(function (e) {
        keys.push(e.keyCode);
        if (keys.toString()==pattern) {
                keys = [];
                $("#right_column img").attr("src", "{{ static('core/img/yug.jpg') }}");
        }
        if (keys.length==6) {
            keys.shift();
        }
    });
} );
</script>
{% endblock %}
Skia's avatar
Skia committed
99