This commit is contained in:
Julien Constant 2023-03-03 12:44:09 +01:00
parent 1ffa65b3a4
commit f9d5585525
No known key found for this signature in database
GPG Key ID: 816E7C070117E5B7
7 changed files with 146 additions and 143 deletions

View File

@ -15,12 +15,13 @@
display: flex; display: flex;
flex-direction: row; flex-direction: row;
flex-wrap: wrap; flex-wrap: wrap;
justify-content: space-around; justify-content: center;
gap: 40px;
align-items: stretch; align-items: stretch;
@media (max-width: 750px) { @media (max-width: 750px) {
flex-direction: column; flex-direction: column;
gap: 20px; gap: 10px
} }
} }

View File

@ -1,6 +1,11 @@
{% extends "core/base.jinja" %} {% extends "core/base.jinja" %}
{% from "core/macros.jinja" import show_slots, show_tokens, user_subscription %} {% from "core/macros.jinja" import show_slots, show_tokens, user_subscription %}
{%- block additional_css -%}
<link rel="stylesheet" href="{{ scss('core/override.scss') }}">
<link rel="stylesheet" href="{{ scss('user/user_detail.scss') }}">
{%- endblock -%}
{% block title %} {% block title %}
{% trans user_name=profile.get_display_name() %}{{ user_name }}'s profile{% endtrans %} {% trans user_name=profile.get_display_name() %}{{ user_name }}'s profile{% endtrans %}
{% endblock %} {% endblock %}
@ -10,166 +15,166 @@
<div id="user_profile" class="main"> <div id="user_profile" class="main">
<!-- Profile --> <!-- Profile -->
<div class="user-name"> <div class="user-name">
<h3>{{ profile.get_full_name() }}</h3> <h3>{{ profile.get_full_name() }}</h3>
{% if profile.nick_name %} {% if profile.nick_name %}
<div id="user_profile_infos_nick">&laquo; {{ profile.nick_name }} &raquo;</div> <div id="user_profile_infos_nick">&laquo; {{ profile.nick_name }} &raquo;</div>
{% endif %} {% endif %}
</div> </div>
<div class="infos-and-picture"> <div class="infos-and-picture">
<div id="user_profile_infos"> <div id="user_profile_infos">
{% if profile.quote %} {% if profile.quote %}
<div id="user_profile_infos_quote"> <div id="user_profile_infos_quote">
{{ profile.quote }} {{ profile.quote }}
</div> </div>
{% endif %} {% endif %}
<div id="user_profile_infos_items"> <div id="user_profile_infos_items">
{% if profile.pronouns %} {% if profile.pronouns %}
<div> <div>
<span class="user_profile_infos_item">{% trans %}Pronouns: {% endtrans %}</span> <span class="user_profile_infos_item">{% trans %}Pronouns: {% endtrans %}</span>
<span class="user_profile_infos_item_value">{{ profile.pronouns }}</span> <span class="user_profile_infos_item_value">{{ profile.pronouns }}</span>
</div> </div>
{% endif %} {% endif %}
{% if profile.date_of_birth %} {% if profile.date_of_birth %}
<div> <div>
<span class="user_profile_infos_item">{% trans %}Born: {% endtrans %}</span> <span class="user_profile_infos_item">{% trans %}Born: {% endtrans %}</span>
<span class="user_profile_infos_item_value">{{ profile.date_of_birth|date("d/m/Y") }}</span> <span class="user_profile_infos_item_value">{{ profile.date_of_birth|date("d/m/Y") }}</span>
</div> </div>
{% endif %} {% endif %}
{% if profile.department != "NA" %} {% if profile.department != "NA" %}
<div> <div>
<span class="user_profile_infos_item">{% trans %}Department: {% endtrans %}</span> <span class="user_profile_infos_item">{% trans %}Department: {% endtrans %}</span>
<span class="user_profile_infos_item_value">{{ profile.department }}{{ profile.semester }}</span> <span class="user_profile_infos_item_value">{{ profile.department }}{{ profile.semester
</div> }}</span>
</div>
{% endif %} {% endif %}
{% if profile.dpt_option %} {% if profile.dpt_option %}
<div> <div>
<span class="user_profile_infos_item">{% trans %}Option: {% endtrans %}</span> <span class="user_profile_infos_item">{% trans %}Option: {% endtrans %}</span>
<span class="user_profile_infos_item_value">{{ profile.dpt_option }}</span> <span class="user_profile_infos_item_value">{{ profile.dpt_option }}</span>
</div> </div>
{% endif %} {% endif %}
{% if profile.phone %} {% if profile.phone %}
<div> <div>
<span class="user_profile_infos_item">{% trans %}Phone: {% endtrans %}</span> <span class="user_profile_infos_item">{% trans %}Phone: {% endtrans %}</span>
<span class="user_profile_infos_item_value">{{ profile.phone }}</span> <span class="user_profile_infos_item_value">{{ profile.phone }}</span>
</div> </div>
{% endif %} {% endif %}
{% if profile.address %} {% if profile.address %}
<div> <div>
<span class="user_profile_infos_item">{% trans %}Address: {% endtrans %}</span> <span class="user_profile_infos_item">{% trans %}Address: {% endtrans %}</span>
<span class="user_profile_infos_item_value">{{ profile.address }}</span> <span class="user_profile_infos_item_value">{{ profile.address }}</span>
</div> </div>
{% endif %} {% endif %}
{% if profile.parent_address %} {% if profile.parent_address %}
<div> <div>
<span class="user_profile_infos_item">{% trans %}Parents address: {% endtrans %}</span> <span class="user_profile_infos_item">{% trans %}Parents address: {% endtrans %}</span>
<span class="user_profile_infos_item_value">{{ profile.parent_address }}</span> <span class="user_profile_infos_item_value">{{ profile.parent_address }}</span>
</div> </div>
{% endif %} {% endif %}
</div> </div>
{% if profile.promo %} {% if profile.promo %}
<div id="user_profile_infos_promo"> <div id="user_profile_infos_promo">
{% trans %}Promo: {% endtrans %}{{ profile.promo }}
<img src="{{ static('core/img/promo_%02d.png' % profile.promo) }}" alt="Promo {{ profile.promo }}" />
<img src="{{ static('core/img/promo_%02d.png' % profile.promo) }}" alt="Promo {{ profile.promo }}" />
{% trans %}Promo: {% endtrans %}{{ profile.promo }} {% trans %}Promo: {% endtrans %}{{ profile.promo }}
<img src="{{ static('core/img/promo_%02d.png' % profile.promo) }}" alt="Promo {{ profile.promo }}" /> <img src="{{ static('core/img/promo_%02d.png' % profile.promo) }}"
{% trans %}Promo: {% endtrans %}{{ profile.promo }} alt="Promo {{ profile.promo }}" />
</div> </div>
{% endif %} {% endif %}
</div> </div>
<!-- Pictures --> <!-- Pictures -->
<div id="user_profile_pictures"> <div id="user_profile_pictures">
<div id="user_profile_pictures_bigone"> <div id="user_profile_pictures_bigone">
{% if profile.profile_pict %} {% if profile.profile_pict %}
<img src="{{ profile.profile_pict.get_download_url() }}" alt="{% trans %}Profile{% endtrans %}" <img src="{{ profile.profile_pict.get_download_url() }}" alt="{% trans %}Profile{% endtrans %}"
title="{% trans %}Profile{% endtrans %}" /> title="{% trans %}Profile{% endtrans %}" />
{% else %} {% else %}
<img src="{{ static('core/img/unknown.jpg') }}" alt="{% trans %}Profile{% endtrans %}" <img src="{{ static('core/img/unknown.jpg') }}" alt="{% trans %}Profile{% endtrans %}"
title="{% trans %}Profile{% endtrans %}" /> title="{% trans %}Profile{% endtrans %}" />
{% endif %} {% endif %}
</div> </div>
<div id="user_profile_pictures_thumbnails"> <div id="user_profile_pictures_thumbnails">
{% if profile.profile_pict %} {% if profile.profile_pict %}
<img src="{{ profile.profile_pict.get_download_url() }}" alt="{% trans %}Profile{% endtrans %}" <img src="{{ profile.profile_pict.get_download_url() }}" alt="{% trans %}Profile{% endtrans %}"
title="{% trans %}Profile{% endtrans %}" /> title="{% trans %}Profile{% endtrans %}" />
{% else %} {% else %}
<img src="{{ static('core/img/unknown.jpg') }}" alt="{% trans %}Profile{% endtrans %}" <img src="{{ static('core/img/unknown.jpg') }}" alt="{% trans %}Profile{% endtrans %}"
title="{% trans %}Profile{% endtrans %}" /> title="{% trans %}Profile{% endtrans %}" />
{% endif %} {% endif %}
{% if profile.avatar_pict %} {% if profile.avatar_pict %}
<img src="{{ profile.avatar_pict.get_download_url() }}" alt="{% trans %}Avatar{% endtrans %}" <img src="{{ profile.avatar_pict.get_download_url() }}" alt="{% trans %}Avatar{% endtrans %}"
title="{% trans %}Avatar{% endtrans %}" /> title="{% trans %}Avatar{% endtrans %}" />
{% else %} {% else %}
<img src="{{ static('core/img/unknown.jpg') }}" alt="{% trans %}Avatar{% endtrans %}" <img src="{{ static('core/img/unknown.jpg') }}" alt="{% trans %}Avatar{% endtrans %}"
title="{% trans %}Avatar{% endtrans %}" /> title="{% trans %}Avatar{% endtrans %}" />
{% endif %} {% endif %}
{% if profile.scrub_pict %} {% if profile.scrub_pict %}
<img src="{{ profile.scrub_pict.get_download_url() }}" alt="{% trans %}Scrub{% endtrans %}" <img src="{{ profile.scrub_pict.get_download_url() }}" alt="{% trans %}Scrub{% endtrans %}"
title="{% trans %}Scrub{% endtrans %}" /> title="{% trans %}Scrub{% endtrans %}" />
{% else %} {% else %}
<img src="{{ static('core/img/unknown.jpg') }}" alt="{% trans %}Scrub{% endtrans %}" <img src="{{ static('core/img/unknown.jpg') }}" alt="{% trans %}Scrub{% endtrans %}"
title="{% trans %}Scrub{% endtrans %}" /> title="{% trans %}Scrub{% endtrans %}" />
{% endif %} {% endif %}
</div> </div>
</div> </div>
</div> </div>
</div> </div>
{% if user.memberships.filter(end_date=None).exists() or user.is_in_group(settings.SITH_MAIN_BOARD_GROUP) or user == profile or user.is_in_group(settings.SITH_BAR_MANAGER_BOARD_GROUP) %} {% if user.memberships.filter(end_date=None).exists() or user.is_in_group(settings.SITH_MAIN_BOARD_GROUP) or user ==
profile or user.is_in_group(settings.SITH_BAR_MANAGER_BOARD_GROUP) %}
{# if the user is member of a club, he can view the subscription state #} {# if the user is member of a club, he can view the subscription state #}
<hr> <hr>
{% if profile.is_subscribed %} {% if profile.is_subscribed %}
{% if user == profile or user.is_root or user.is_board_member %} {% if user == profile or user.is_root or user.is_board_member %}
<div> <div>
{{ user_subscription(profile) }} {{ user_subscription(profile) }}
</div> </div>
{% endif %} {% endif %}
{% if user == profile or user.is_root or user.is_board_member or user.is_launderette_manager %} {% if user == profile or user.is_root or user.is_board_member or user.is_launderette_manager %}
<div> <div>
{# Shows tokens bought by the user #} {# Shows tokens bought by the user #}
{{ show_tokens(profile) }} {{ show_tokens(profile) }}
{# Shows slots took by the user #} {# Shows slots took by the user #}
{{ show_slots(profile) }} {{ show_slots(profile) }}
</div> </div>
{% endif %} {% endif %}
{% else %} {% else %}
<div> <div>
{% trans %}Not subscribed{% endtrans %} {% trans %}Not subscribed{% endtrans %}
{% if user.is_board_member %} {% if user.is_board_member %}
<a href="{{ url('subscription:subscription') }}?member={{ profile.id }}">{% trans %}New subscription{% endtrans %}</a> <a href="{{ url('subscription:subscription') }}?member={{ profile.id }}">{% trans %}New subscription{% endtrans
{% endif %} %}</a>
{% endif %} {% endif %}
</div> {% endif %}
</div>
{% endif %} {% endif %}
{% if profile.was_subscribed and (user == profile or user.can_read_subscription_history)%} {% if profile.was_subscribed and (user == profile or user.can_read_subscription_history)%}
<div id="drop_subscriptions"> <div id="drop_subscriptions">
<h5>{% trans %}Subscription history{% endtrans %}</h5> <h5>{% trans %}Subscription history{% endtrans %}</h5>
<table> <table>
<tr> <tr>
<th>{% trans %}Subscription start{% endtrans %}</th> <th>{% trans %}Subscription start{% endtrans %}</th>
<th>{% trans %}Subscription end{% endtrans %}</th> <th>{% trans %}Subscription end{% endtrans %}</th>
<th>{% trans %}Subscription type{% endtrans %}</th> <th>{% trans %}Subscription type{% endtrans %}</th>
<th>{% trans %}Payment method{% endtrans %}</th> <th>{% trans %}Payment method{% endtrans %}</th>
</tr> </tr>
{% for sub in profile.subscriptions.all() %} {% for sub in profile.subscriptions.all() %}
<tr> <tr>
<td>{{ sub.subscription_start }}</td> <td>{{ sub.subscription_start }}</td>
<td>{{ sub.subscription_end }}</td> <td>{{ sub.subscription_end }}</td>
<td>{{ sub.subscription_type }}</td> <td>{{ sub.subscription_type }}</td>
<td>{{ sub.get_payment_method_display() }}</td> <td>{{ sub.get_payment_method_display() }}</td>
</tr> </tr>
{% endfor %} {% endfor %}
</table> </table>
</div> </div>
{% endif %} {% endif %}
{% if user.is_root or user.is_board_member %} {% if user.is_root or user.is_board_member %}
@ -183,18 +188,19 @@
</form> </form>
{% if profile.gifts.exists() %} {% if profile.gifts.exists() %}
<br> <br>
<div id="drop_gifts"> <div id="drop_gifts">
<h5>{% trans %}Last given gift :{% endtrans %} {{ profile.gifts.order_by('-date').first() }}</h5> <h5>{% trans %}Last given gift :{% endtrans %} {{ profile.gifts.order_by('-date').first() }}</h5>
<div> <div>
<ul> <ul>
{% for gift in profile.gifts.all().order_by('-date') %} {% for gift in profile.gifts.all().order_by('-date') %}
<li>{{ gift }} <a href="{{ url('core:user_gift_delete', user_id=profile.id, gift_id=gift.id) }}">{% trans %}Delete{% endtrans %}</a></li> <li>{{ gift }} <a href="{{ url('core:user_gift_delete', user_id=profile.id, gift_id=gift.id) }}">{%
trans %}Delete{% endtrans %}</a></li>
{% endfor %} {% endfor %}
</ul> </ul>
</div>
</div> </div>
</div>
{% else %} {% else %}
<em>{% trans %}No gift given yet{% endtrans %}</em> <em>{% trans %}No gift given yet{% endtrans %}</em>
{% endif %} {% endif %}
</div> </div>
{% endif %} {% endif %}
@ -206,40 +212,40 @@
{% block script %} {% block script %}
{{ super() }} {{ super() }}
<script> <script>
$( function() { $(function () {
var keys = []; var keys = [];
var pattern = "71,85,89,71,85,89"; var pattern = "71,85,89,71,85,89";
$(document).keydown(function (e) { $(document).keydown(function (e) {
keys.push(e.keyCode); keys.push(e.keyCode);
if (keys.toString()==pattern) { if (keys.toString() == pattern) {
keys = []; keys = [];
$("#user_profile_pictures_bigone img").attr("src", "{{ static('core/img/yug.jpg') }}"); $("#user_profile_pictures_bigone img").attr("src", "{{ static('core/img/yug.jpg') }}");
} }
if (keys.length==6) { if (keys.length == 6) {
keys.shift(); keys.shift();
} }
});
}); });
} ); $(function () {
$(function(){ $("#user_profile_pictures_thumbnails img").click(function () {
$("#user_profile_pictures_thumbnails img").click(function () { $("#user_profile_pictures_bigone img").attr("src", $(this)[0].src);
$("#user_profile_pictures_bigone img").attr("src", $(this)[0].src); $("#user_profile_pictures_bigone img").attr("alt", $(this)[0].alt);
$("#user_profile_pictures_bigone img").attr("alt", $(this)[0].alt); $("#user_profile_pictures_bigone img").attr("title", $(this)[0].title);
$("#user_profile_pictures_bigone img").attr("title", $(this)[0].title); })
})
});
$(function(){
$("#drop_gifts").accordion({
heightStyle: "content",
collapsible: true,
active: false
}); });
}); $(function () {
$(function(){ $("#drop_gifts").accordion({
$("#drop_subscriptions").accordion({ heightStyle: "content",
heightStyle: "content", collapsible: true,
collapsible: true, active: false
active: false });
});
$(function () {
$("#drop_subscriptions").accordion({
heightStyle: "content",
collapsible: true,
active: false
});
}); });
});
</script> </script>
{% endblock %} {% endblock %}

View File

@ -6,16 +6,12 @@
{%- endblock -%} {%- endblock -%}
{% block content %} {% block content %}
<h2>{% trans user_name=profile.get_full_name() %}Edit user groups for {{ user_name }}{% endtrans %}</h2> <main>
<form action="" method="post"> <h2>{% trans user_name=profile.get_full_name() %}Edit user groups for {{ user_name }}{% endtrans %}</h2>
<main> <form action="" method="post">
<h2>{% trans user_name=profile.get_full_name() %}Edit user groups for {{ user_name }}{% endtrans %}</h2> {% csrf_token %}
<form action="" method="post"> {{ form.as_p() }}
{% csrf_token %} <p><input type="submit" value="{% trans %}Update{% endtrans %}" /></p>
{{ form.as_p() }} </form>
<p><input type="submit" value="{% trans %}Update{% endtrans %}" /></p>
</form>
<input type="submit" value="{% trans %}Update{% endtrans %}" />
</form>
</main> </main>
{%- endblock -%} {%- endblock -%}