Sith/core/templates/core/macros.jinja

69 lines
2.6 KiB
Plaintext
Raw Normal View History

2016-07-27 15:23:02 +00:00
{% macro user_profile_link(user) -%}
<a href="{{ url("core:user_profile", user_id=user.id) }}">{{ user.get_display_name() }}</a>
{%- endmacro %}
2016-08-19 00:53:44 +00:00
{% macro user_link_with_pict(user) -%}
<a href="{{ url("core:user_profile", user_id=user.id) }}" class="mini_profile_link" >
{{ user.get_mini_item()|safe }}
</a>
2016-08-19 00:53:44 +00:00
{%- endmacro %}
{% macro user_mini_profile(user) %}
<div id="user_profile">
2016-08-20 11:57:27 +00:00
<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>
{% endif %}
</div>
</div>
{%- endmacro %}
{% macro user_subscription(user) %}
2016-12-10 00:58:30 +00:00
{% trans subscription_end=user.subscriptions.last().subscription_end %}Subscribed until {{ subscription_end }}{% endtrans %}<br/>
{% trans %}Account number: {% endtrans %}{{ user.customer.account_id }}<br/>
{%- endmacro %}
{% macro show_slots(user) %}
2016-12-10 00:58:30 +00:00
{% if user.slots.filter(start_date__gte=timezone.now()).exists() %}
<h5>{% trans %}Slot{% endtrans %}</h5>
<ul>
2016-12-10 00:58:30 +00:00
{% for i in user.slots.filter(start_date__gte=timezone.now().replace(tzinfo=None)).all() %}
2016-09-11 17:00:12 +00:00
<li>{{ i.get_type_display() }} - {{i.machine.launderette }}, {{ i.start_date|date("l j") }} : {{ i.start_date|time(DATETIME_FORMAT) }}</li>
{% endfor %}
</ul>
{% endif %}
{% endmacro %}
{% macro show_tokens(user) %}
2016-12-10 00:58:30 +00:00
{% if user.tokens.exists() %}
<h5>{% trans %}Tokens{% endtrans %}</h5>
<ul>
2016-12-10 00:58:30 +00:00
{% for i in user.tokens.all() %}
<li>{{ i }}</li>
{% endfor %}
</ul>
{% endif %}
2016-09-11 17:00:12 +00:00
{% endmacro %}
2016-09-29 13:04:43 +00:00
{% 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 %}
2016-12-10 00:58:30 +00:00
{% endmacro %}