Sith/core/templates/core/user_detail.jinja

98 lines
3.4 KiB
Django/Jinja

{% extends "core/base.jinja" %}
{% from "core/macros.jinja" import show_slots, show_tokens, user_subscription %}
{% block title %}
{% trans user_name=profile.get_display_name() %}{{ user_name }}'s profile{% endtrans %}
{% endblock %}
{% block content %}
<div id="user_profile_container">
<div id="user_profile">
<div id="right_column">
<div id="pictures">
{% if profile.profile_pict %}
<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" />
{% 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 %}
{% if profile.phone %}
<p>
{{ profile.phone }}
</p>
{% endif %}
{% if profile.address %}
<p>
{{ profile.address }}
</p>
{% endif %}
</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>
{% endif %}
</div>
</div>
</div>
{% if user.memberships.filter(end_date=None).exists() or user.is_in_group(settings.SITH_MAIN_BOARD_GROUP) or user == profile %}
{# if the user is member of a club, he can view the subscription state #}
<p>
{% if get_subscriber(profile).is_subscribed() %}
{% if user == profile or user.is_root or user.is_board_member %}
{{ user_subscription(profile) }}
{% endif %}
{% if user == profile or user.is_root or user.is_board_member or user.is_launderette_manager %}
{# Shows tokens bought by the user #}
{{ show_tokens(profile) }}
{# Shows slots took by the user #}
{{ show_slots(profile) }}
{% endif %}
{% else %}
{% 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>
{% endif %}
{% endblock %}
{% 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 %}