This commit is contained in:
Julien Constant 2023-03-03 12:24:38 +01:00
parent 585923c827
commit 1ffa65b3a4
No known key found for this signature in database
GPG Key ID: 816E7C070117E5B7
16 changed files with 841 additions and 282 deletions

View File

@ -13,7 +13,7 @@ class Migration(migrations.Migration):
model_name="preferences", model_name="preferences",
name="receive_weekmail", name="receive_weekmail",
field=models.BooleanField( field=models.BooleanField(
default=False, verbose_name="do you want to receive the weekmail" default=False, verbose_name="receive the weekmail"
), ),
) )
] ]

View File

@ -271,7 +271,7 @@ class User(AbstractBaseUser):
_("dpt option"), max_length=32, blank=True, default="" _("dpt option"), max_length=32, blank=True, default=""
) )
semester = models.CharField(_("semester"), max_length=5, blank=True, default="") semester = models.CharField(_("semester"), max_length=5, blank=True, default="")
quote = models.CharField(_("quote"), max_length=256, blank=True, default="") quote = models.TextField(_("quote"), max_length=256, blank=True, default="")
school = models.CharField(_("school"), max_length=80, blank=True, default="") school = models.CharField(_("school"), max_length=80, blank=True, default="")
promo = models.IntegerField( promo = models.IntegerField(
_("promo"), validators=[validate_promo], null=True, blank=True _("promo"), validators=[validate_promo], null=True, blank=True
@ -784,7 +784,7 @@ class Preferences(models.Model):
User, related_name="_preferences", on_delete=models.CASCADE User, related_name="_preferences", on_delete=models.CASCADE
) )
receive_weekmail = models.BooleanField( receive_weekmail = models.BooleanField(
_("do you want to receive the weekmail"), default=False _("Receive the Weekmail"), default=False
) )
show_my_stats = models.BooleanField(_("show your stats to others"), default=False) show_my_stats = models.BooleanField(_("show your stats to others"), default=False)
notify_on_click = models.BooleanField( notify_on_click = models.BooleanField(

View File

@ -0,0 +1,7 @@
content {
padding: 20px !important;
}
h1, h2, h3, h4, h5, h6 {
margin: 0.5em 0;
}

View File

@ -0,0 +1,140 @@
.main {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
width: 100%;
}
.user-name {
display: flex;
flex-direction: column;
align-items: flex-start;
width: 100%;
max-width: 1080px;
}
.infos-and-picture {
display: flex;
flex-direction: row;
justify-content: center;
width: 100%;
max-width: 1080px;
@media (max-width: 960px) {
flex-direction: column-reverse;
gap: 20px;
}
>#user_profile_infos {
width: 50%;
@media (max-width: 960px) {
width: 100%;
}
@media (min-width: 960px) {
padding-right: 20px;
}
>#user_profile_infos_promo {
display: flex;
flex-direction: row;
gap: 10px;
align-items: center;
justify-content: center;
width: 100%;
}
>#user_profile_infos_quote {
@media (max-width: 960px) {
text-align: center !important;
}
}
}
>#user_profile_pictures {
width: 50%;
display: flex;
flex-direction: row;
@media (max-width: 960px) {
width: 100%;
height: 100% !important;
flex-direction: column;
}
@media (min-width: 960px) {
padding-left: 20px;
}
>#user_profile_pictures_bigone {
@media (max-width: 960px) {
>img {
max-width: 300px !important;
width: 100% !important;
object-fit: contain;
}
}
}
>#user_profile_pictures_thumbnails {
padding: 20px;
display: flex;
flex-direction: column;
gap: 20px;
@media (max-width: 960px) {
flex-direction: row !important;
height: 50%;
}
>img {
max-height: calc(100% / 3);
width: 100% !important;
object-fit: contain;
@media (max-width: 960px) {
max-height: 100%;
max-width: calc(100% / 3) !important;
height: auto;
}
}
}
}
}
#user_profile_page #user_profile #user_profile_infos {
@media (max-width: 960px) {
border-right-color: transparent;
}
}
#user_profile_page #user_profile #user_profile_pictures #user_profile_pictures_thumbnails,
#user_profile_page #user_profile #user_profile_infos,
#user_profile_page #user_profile #user_profile_pictures {
flex-basis: unset !important;
}
.form-gifts {
display: flex;
flex-direction: row;
justify-content: flex-start;
align-items: center;
gap: 10px;
@media (max-width: 960px) {
flex-direction: column;
}
>select,
>input {
min-width: 300px;
max-width: 100%;
height: 40px;
@media (max-width: 960px) {
width: 100%;
}
}
}

View File

@ -0,0 +1,171 @@
.profile {
&-visible {
display: flex;
justify-content: center;
align-items: center;
gap: 5px;
>input[type="checkbox"] {
cursor: pointer;
}
}
&-pictures {
box-sizing: border-box;
display: flex;
flex-direction: row;
flex-wrap: wrap;
justify-content: space-around;
align-items: stretch;
@media (max-width: 750px) {
flex-direction: column;
gap: 20px;
}
}
&-picture {
box-sizing: border-box;
display: flex;
justify-content: space-between;
flex-direction: column;
align-items: center;
flex-wrap: wrap;
gap: 20px;
width: 100%;
height: 100%;
max-width: 300px;
@media (max-width: 750px) {
max-width: 100%;
}
&-display {
display: flex;
flex-direction: column;
justify-content: center;
height: 300px;
gap: 10px;
@media (max-width: 750px) {
height: auto;
}
>img {
width: 100% !important;
object-fit: contain;
height: auto;
}
>p {
text-align: left !important;
width: 100% !important;
}
}
&-edit {
display: flex;
flex-direction: column-reverse;
align-items: flex-start;
justify-content: center;
width: 100%;
>input {
font-size: .8em;
font-weight: normal;
cursor: pointer;
}
>p {
margin-bottom: 0;
text-align: left !important;
min-height: 50px;
}
}
}
&-fields {
padding: 20px 0;
display: flex;
flex-direction: row;
flex-wrap: wrap;
gap: 10px;
justify-content: center;
@media (max-width: 750px) {
gap: 20px;
}
}
&-field {
display: flex;
flex-direction: row;
align-items: center;
flex-wrap: wrap;
justify-content: center;
gap: 10px;
width: 100%;
max-width: 330px;
min-width: 300px;
@media (max-width: 750px) {
gap: 4px;
max-width: 100%;
}
>* {
width: 100%;
max-width: 300px;
@media (max-width: 750px) {
max-width: 100%;
}
}
&-label {
text-align: left !important;
}
&-content {
>* {
box-sizing: border-box;
text-align: left !important;
line-height: 40px;
max-width: 100%;
width: 100%;
height: 40px;
margin: 0;
>* {
text-align: left !important;
}
}
>textarea {
height: 120px;
min-height: 40px;
min-width: 300px;
max-width: 300px;
line-height: initial;
@media (max-width: 750px) {
max-width: 100%;
}
}
>input[type="file"] {
font-size: small;
line-height: 30px;
}
>input[type="checkbox"] {
width: 20px;
height: 20px;
margin: 0;
float: left;
}
}
}
}

View File

@ -0,0 +1,13 @@
#id_groups {
margin: 0;
>li {
list-style-type: none;
margin: 0;
padding-left: 30px;
>label {
cursor: pointer;
}
}
}

View File

@ -0,0 +1,41 @@
.form {
display: flex;
flex-direction: column;
gap: 2px;
&-general {
>p {
display: flex;
flex-direction: row-reverse;
justify-content: left;
gap: 5px;
align-items: flex-start;
margin: 0;
>label {
cursor: pointer
}
}
}
&-cards,
&-trombi {
>p {
display: flex;
flex-direction: column;
align-items: flex-start;
text-align: justify;
gap: 5px;
>input,
>select {
min-width: 300px;
}
}
}
&-submit-btn {
margin-top: 10px !important;
max-width: 100px;
}
}

View File

@ -0,0 +1,40 @@
.row {
display: flex;
flex-direction: row;
flex-wrap: wrap;
justify-content: flex-start;
align-items: center;
margin-bottom: 10px;
gap: 30px;
@media (max-width: 535px) {
>div,
>div>.flexed {
width: 100%;
align-items: stretch;
}
}
}
.flexed {
display: flex;
flex-direction: column;
gap: 2px;
align-items: self-start;
>div {
display: flex;
justify-content: space-between;
>b,
>span {
width: 120px;
&:last-child {
text-align: right;
}
}
}
}

View File

@ -40,7 +40,7 @@
<form action="{{ url('set_language') }}" method="post">{% csrf_token %} <form action="{{ url('set_language') }}" method="post">{% csrf_token %}
<input name="next" value="{{ request.path }}" type="hidden" /> <input name="next" value="{{ request.path }}" type="hidden" />
<input name="language" value="{{ language[0] }}" type="hidden" /> <input name="language" value="{{ language[0] }}" type="hidden" />
<input type="submit" value="{{ language[0]|upper }}" /> <input type="submit" value="{{ language[0]|upper }}" />
</form> </form>
{% endfor %} {% endfor %}
</div> </div>
@ -218,7 +218,7 @@
<div class="dropdown-content"> <div class="dropdown-content">
<a href="{{ url('core:page', page_name='FAQ') }}">{% trans %}FAQ{% endtrans %}</a> <a href="{{ url('core:page', page_name='FAQ') }}">{% trans %}FAQ{% endtrans %}</a>
<a href="{{ url('core:page', 'contacts') }}">{% trans %}Contacts{% endtrans %}</a> <a href="{{ url('core:page', 'contacts') }}">{% trans %}Contacts{% endtrans %}</a>
<a href="{{ url('core:page', page_name="Index") }}">{% trans %}Wiki{% endtrans %}</a> <a href="{{ url('core:page', page_name='Index') }}">{% trans %}Wiki{% endtrans %}</a>
</div> </div>
</div> </div>
</nav> </nav>
@ -234,14 +234,9 @@
<div id="content"> <div id="content">
{% if list_of_tabs %} {% if list_of_tabs %}
<div class="tool_bar"> <div class="tool_bar">
<div>{{ tabs_title }}</div>
<div class="tools"> <div class="tools">
{% for t in list_of_tabs -%} {% for t in list_of_tabs -%}
<a href="{{ t.url }}" <a href="{{ t.url }}" {%- if current_tab==t.slug %} class="selected_tab" {%- endif -%}>{{ t.name }}</a>
{%- if current_tab == t.slug %}
class="selected_tab"
{%- endif -%}
>{{ t.name }}</a>
{%- endfor %} {%- endfor %}
</div> </div>
</div> </div>

View File

@ -7,16 +7,17 @@
{% block content %} {% block content %}
<div id="user_profile_page"> <div id="user_profile_page">
<div id="user_profile"> <div id="user_profile" class="main">
<!-- Profile --> <!-- Profile -->
<div id="user_profile_infos"> <div class="user-name">
<h4>{{ profile.get_full_name() }}</h4> <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 class="infos-and-picture">
<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 }}
@ -75,6 +76,10 @@
{% 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 }}
<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 }}
</div> </div>
@ -118,7 +123,7 @@
</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>
@ -168,9 +173,9 @@
{% endif %} {% endif %}
{% if user.is_root or user.is_board_member %} {% if user.is_root or user.is_board_member %}
<div>
<hr> <hr>
<form style="margin-left: 0px;" action="{{ url('core:user_gift_create', user_id=profile.id) }}" method="post"> <div>
<form class="form-gifts" action="{{ url('core:user_gift_create', user_id=profile.id) }}" method="post">
{% csrf_token %} {% csrf_token %}
{{ gift_form.label }} {{ gift_form.label }}
{{ gift_form.user }} {{ gift_form.user }}
@ -189,7 +194,7 @@
</div> </div>
</div> </div>
{% else %} {% else %}
{% trans %}No gift given yet{% endtrans %} <em>{% trans %}No gift given yet{% endtrans %}</em>
{% endif %} {% endif %}
</div> </div>
{% endif %} {% endif %}

View File

@ -1,55 +1,157 @@
{% extends "core/base.jinja" %} {%- extends "core/base.jinja" -%}
{% block title %} {%- block title -%}
{% trans %}Edit user{% endtrans %} {%- trans -%}Edit user{%- endtrans -%}
{% endblock %} {%- endblock -%}
{% block content %} {%- block additional_css -%}
<h2>{% trans %}Edit user profile{% endtrans %}</h2> <link rel="stylesheet" href="{{ scss('core/override.scss') }}">
<link rel="stylesheet" href="{{ scss('user/user_edit.scss') }}">
{%- endblock -%}
{%- block content -%}
<h2>{%- trans -%}Edit user profile{%- endtrans -%}</h2>
<form action="" method="post" enctype="multipart/form-data" id="user_edit"> <form action="" method="post" enctype="multipart/form-data" id="user_edit">
{% csrf_token %}
{{ form.non_field_errors() }}
{% for field in form %}
<p>{{ field.errors }}<label for="{{ field.name }}">{{ field.label }}
{%- if field.name == "profile_pict" -%}
<br>{% trans %}Current profile: {% endtrans %}
{% if form.instance.profile_pict %}
<img src="{{ form.instance.profile_pict.get_download_url() }}" title="{% trans %}Profile{% endtrans %}" /><br>
{% if user.is_in_group(settings.SITH_MAIN_BOARD_GROUP) %}
<a href="{{ url('core:file_delete', file_id=form.instance.profile_pict.id, popup="") }}">{% trans %}Delete{% endtrans %}</a>
{% endif %}
{% else %}
<img src="{{ static('core/img/unknown.jpg') }}" title="-" crossOrigin="Anonymous" id="new_profile"/><br>
<div id="take_picture">
<div id="camera_canvas" style="width:320; height:240; margin: 0px auto;"></div>
<a href="javascript:void(take_snapshot())">{% trans %}Take picture{% endtrans %}</a>
</div>
<p>
{% endif %}<br>
{%- elif field.name == "avatar_pict" and form.instance.avatar_pict -%}
<br>{% trans %}Current avatar: {% endtrans %}
<img src="{{ form.instance.avatar_pict.get_download_url() }}" title="{% trans %}Avatar{% endtrans %}" /><br>
{%- elif field.name == "scrub_pict" and form.instance.scrub_pict -%}
<br>{% trans %}Current scrub: {% endtrans %}
<img src="{{ form.instance.scrub_pict.get_download_url() }}" title="{% trans %}Scrub{% endtrans %}" /><br>
{%- endif %}</label> {{ field }}</p>
{% endfor %}
<p><input type="submit" value="{% trans %}Update{% endtrans %}" /></p>
<p>{% trans %}Username: {% endtrans %}{{ form.instance.username }}</p>
{% if form.instance.customer %}
<p>{% trans %}Account number: {% endtrans %}{{ form.instance.customer.account_id }}</p>
{% endif %}
{% if form.instance == user %}
<p><a href="{{ url('core:password_change') }}">{% trans %}Change my password{% endtrans %}</a></p>
{% elif user.is_root %}
<p><a href="{{ url('core:password_root_change', user_id=form.instance.id) }}">{% trans %}Change user password{% endtrans %}</a></p>
{% endif %}
</form>
{% endblock %}
{% block script %} {%- csrf_token -%}
{{ form.non_field_errors() }}
{# User Pictures #}
<div class="profile-pictures">
{# <p>{%- trans -%}Current profile: {%- endtrans -%}</p> #}
<div class="profile-picture">
<div class="profile-picture-display">
{%- if form.instance.profile_pict -%}
<img src="{{ form.instance.profile_pict.get_download_url() }}"
alt="{%- trans -%}Profile{%- endtrans -%}" title="{%- trans -%}Profile{%- endtrans -%}" />
{%- else -%}
<img src="{{ static('core/img/unknown.jpg') }}" alt="{%- trans -%}Profile{%- endtrans -%}"
title="{%- trans -%}Profile{%- endtrans -%}" />
{%- endif -%}
</div>
<div class="profile-picture-edit">
<p>{{ form["profile_pict"].label }}</p>
{{ form["profile_pict"] }}
{%- if user.is_in_group(settings.SITH_MAIN_BOARD_GROUP) -%}
<a href="{{ url('core:file_delete', file_id=form.instance.profile_pict.id, popup='') }}">{%- trans
-%}Delete{%- endtrans -%}</a>
{%- endif -%}
</div>
</div>
<div class="profile-picture">
<div class="profile-picture-display">
{%- if form.instance.avatar_pict -%}
<img src="{{ form.instance.avatar_pict.get_download_url() }}" alt="{%- trans -%}Profile{%- endtrans -%}"
title="{%- trans -%}Profile{%- endtrans -%}" />
{%- else -%}
<img src="{{ static('core/img/unknown.jpg') }}" alt="{%- trans -%}Profile{%- endtrans -%}"
title="{%- trans -%}Profile{%- endtrans -%}" />
{%- endif -%}
</div>
<div class="profile-picture-edit">
<p>{{ form["avatar_pict"].label }}</p>
{{ form["avatar_pict"] }}
{%- if user.is_in_group(settings.SITH_MAIN_BOARD_GROUP) -%}
<a href="{{ url('core:file_delete', file_id=form.instance.avatar_pict.id, popup='') }}">{%- trans
-%}Delete{%- endtrans -%}</a>
{%- endif -%}
</div>
</div>
<div class="profile-picture">
<div class="profile-picture-display">
{%- if form.instance.scrub_pict -%}
<img src="{{ form.instance.scrub_pict.get_download_url() }}" alt="{%- trans -%}Profile{%- endtrans -%}"
title="{%- trans -%}Profile{%- endtrans -%}" />
{%- else -%}
<img src="{{ static('core/img/unknown.jpg') }}" alt="{%- trans -%}Profile{%- endtrans -%}"
title="{%- trans -%}Profile{%- endtrans -%}" />
{%- endif -%}
</div>
<div class="profile-picture-edit">
<p>{{ form["scrub_pict"].label }}</p>
{{ form["scrub_pict"] }}
{%- if user.is_in_group(settings.SITH_MAIN_BOARD_GROUP) -%}
<a href="{{ url('core:file_delete', file_id=form.instance.scrub_pict.id, popup='') }}">{%- trans
-%}Delete{%-
endtrans -%}</a>
{%- endif -%}
</div>
</div>
</div>
{# All fields #}
<div class="profile-fields">
{%- for field in form -%}
{%-
if field.name in ["quote","profile_pict","avatar_pict","scrub_pict","is_subscriber_viewable","forum_signature"]
-%}
{%- continue -%}
{%- endif -%}
<div class="profile-field">
<div class="profile-field-label">{{ field.label }}</div>
<div class="profile-field-content">
{{ field }}
{%- if field.errors -%}
<div class="field-error">{{ field.errors }}</div>
{%- endif -%}
</div>
</div>
{%- endfor -%}
</div>
{# Textareas #}
<div class="profile-fields">
{%- for field in [form["quote"], form["forum_signature"]] -%}
<div class="profile-field">
<div class="profile-field-label">{{ field.label }}</div>
<div class="profile-field-content">
{{ field }}
{%- if field.errors -%}
<div class="field-error">{{ field.errors }}</div>
{%- endif -%}
</div>
</div>
{%- endfor -%}
</div>
{# Checkboxes #}
<div class="profile-visible">
{{ form["is_subscriber_viewable"] }}
{{ form["is_subscriber_viewable"].label }}
</div>
{%- if form.instance == user -%}
<p align="center">
<a href="{{ url('core:password_change') }}">{%- trans -%}Change my password{%- endtrans -%}</a>
</p>
{%- elif user.is_root -%}
<p align="center">
<a href="{{ url('core:password_root_change', user_id=form.instance.id) }}">{%- trans -%}Change user password{%-
endtrans -%}</a>
</p>
{%- endif -%}
<p align="center">
<input type="submit" value="{%- trans -%}Update{%- endtrans -%}" />
</p>
</form>
<p>
<em>{%- trans -%}Username: {%- endtrans -%}&nbsp;{{ form.instance.username }}</em>
<br />
{%- if form.instance.customer -%}
<em>{%- trans -%}Account number: {%- endtrans -%}&nbsp;{{ form.instance.customer.account_id }}</em>
{%- endif -%}
</p>
{%- endblock -%}
{%- block script -%}
{{ super() }} {{ super() }}
{% if not form.instance.profile_pict %} {%- if not form.instance.profile_pict -%}
<script src="{{ static('core/js/webcam.js') }}"></script> <script src="{{ static('core/js/webcam.js') }}"></script>
<script language="JavaScript"> <script language="JavaScript">
Webcam.on('error', function (msg) { console.log('Webcam.js error: ' + msg) }) Webcam.on('error', function (msg) { console.log('Webcam.js error: ' + msg) })
@ -63,7 +165,6 @@
force_flash: false force_flash: false
}); });
Webcam.attach('#camera_canvas'); Webcam.attach('#camera_canvas');
function take_snapshot() { function take_snapshot() {
var data_uri = Webcam.snap(); var data_uri = Webcam.snap();
var url = "{{ url('core:user_profile_upload', user_id=form.instance.id) }}"; var url = "{{ url('core:user_profile_upload', user_id=form.instance.id) }}";
@ -79,8 +180,5 @@
}, "new_profile_pict", { name: 'csrfmiddlewaretoken', value: '{{ csrf_token }}' }); }, "new_profile_pict", { name: 'csrfmiddlewaretoken', value: '{{ csrf_token }}' });
} }
</script> </script>
{% endif %} {%- endif -%}
{% endblock %} {%- endblock -%}

View File

@ -1,14 +1,21 @@
{% extends "core/base.jinja" %} {% extends "core/base.jinja" %}
{%- block additional_css -%}
<link rel="stylesheet" href="{{ scss('core/override.scss') }}">
<link rel="stylesheet" href="{{ scss('user/user_group.scss') }}">
{%- endblock -%}
{% block content %} {% block content %}
<h2>{% trans user_name=profile.get_full_name() %}Edit user groups for {{ user_name }}{% endtrans %}</h2>
<form action="" method="post">
<main>
<h2>{% trans user_name=profile.get_full_name() %}Edit user groups for {{ user_name }}{% endtrans %}</h2> <h2>{% trans user_name=profile.get_full_name() %}Edit user groups for {{ user_name }}{% endtrans %}</h2>
<form action="" method="post"> <form action="" method="post">
{% csrf_token %} {% csrf_token %}
{{ form.as_p() }} {{ form.as_p() }}
<p><input type="submit" value="{% trans %}Update{% endtrans %}" /></p> <p><input type="submit" value="{% trans %}Update{% endtrans %}" /></p>
</form> </form>
{% endblock %} <input type="submit" value="{% trans %}Update{% endtrans %}" />
</form>
</main>
{%- endblock -%}

View File

@ -1,46 +1,67 @@
{% extends "core/base.jinja" %} {% extends "core/base.jinja" %}
{%- block additional_css -%}
<link rel="stylesheet" href="{{ scss('core/override.scss') }}">
<link rel="stylesheet" href="{{ scss('user/user_preferences.scss') }}">
{%- endblock -%}
{% block title %} {% block title %}
{% trans %}Preferences{% endtrans %} {% trans %}Preferences{% endtrans %}
{% endblock %} {% endblock %}
{% block content %} {% block content %}
<h2>{% trans %}Preferences{% endtrans %}</h2> <h2>{% trans %}Preferences{% endtrans %}</h2>
<form action="" method="post" enctype="multipart/form-data"> <h3>{% trans %}General{% endtrans %}</h3>
<form class="form form-general" action="" method="post" enctype="multipart/form-data">
{% csrf_token %} {% csrf_token %}
{{ form.as_p() }} {{ form.as_p() }}
<p><input type="submit" value="{% trans %}Save{% endtrans %}" /></p> <input class="form-submit-btn" type="submit" value="{% trans %}Save{% endtrans %}" />
</form> </form>
<h4>{% trans %}Trombi{% endtrans %}</h4>
<h3>{% trans %}Trombi{% endtrans %}</h3>
{% if trombi_form %} {% if trombi_form %}
<form action="{{ url('trombi:user_tools') }}" method="post" enctype="multipart/form-data"> <form class="form form-trombi" action="{{ url('trombi:user_tools') }}" method="post" enctype="multipart/form-data">
{% csrf_token %} {% csrf_token %}
{{ trombi_form.as_p() }} {{ trombi_form.as_p() }}
<p><input type="submit" value="{% trans %}Save{% endtrans %}" /></p> <input class="form-submit-btn" type="submit" value="{% trans %}Save{% endtrans %}" />
</form> </form>
{% else %} {% else %}
<p>{% trans trombi=user.trombi_user.trombi %}You already choose to be in that Trombi: {{ trombi }}.{% endtrans %} <p>{% trans trombi=user.trombi_user.trombi %}You already choose to be in that Trombi: {{ trombi }}.{% endtrans %}
<a href="{{ url('trombi:user_tools') }}">{% trans %}Go to my Trombi tools{% endtrans %}</a></p> <br />
<a href="{{ url('trombi:user_tools') }}">{% trans %}Go to my Trombi tools{% endtrans %}</a>
</p>
{% endif %} {% endif %}
{% if profile.customer %} {% if profile.customer %}
<h4>{% trans %}Student cards{% endtrans %}</h4> <h3>{% trans %}Student cards{% endtrans %}</h3>
<p>{% trans %}You can add a card by asking at a counter or add it yourself here. If you want to manually add a student card yourself, you'll need a NFC reader. We store the UID of the card which is 14 characters long.{% endtrans %}</p>
<form action="{{ url('counter:add_student_card', customer_id=profile.customer.pk) }}" method="post">
{% csrf_token %}
{{ student_card_form.as_p() }}
<p><input type="submit" value="{% trans %}Save{% endtrans %}" /></p>
</form>
{% if profile.customer.student_cards.exists() %} {% if profile.customer.student_cards.exists() %}
<ul> <ul>
{% for card in profile.customer.student_cards.all() %} {% for card in profile.customer.student_cards.all() %}
<li>{{ card.uid }} - <a href="{{ url('counter:delete_student_card', customer_id=profile.customer.pk, card_id=card.id) }}">{% trans %}Delete{% endtrans %}</a></li> <li>
{{ card.uid }}
&nbsp;-&nbsp;
<a href="{{ url('counter:delete_student_card', customer_id=profile.customer.pk, card_id=card.id) }}">
{% trans %}Delete{% endtrans %}
</a>
</li>
{% endfor %} {% endfor %}
</ul> </ul>
{% else %} {% else %}
<p>{% trans %}No student cards registered.{% endtrans %}</p> <em>{% trans %}No student card registered.{% endtrans %}</em>
<p align="justify">{% trans %}You can add a card by asking at a counter or add it yourself here. If you want to manually
add a student card yourself, you'll need a NFC reader. We store the UID of the card which is 14 characters long.{%
endtrans %}</p>
{% endif %} {% endif %}
<form class="form form-cards" action="{{ url('counter:add_student_card', customer_id=profile.customer.pk) }}"
method="post">
{% csrf_token %}
{{ student_card_form.as_p() }}
<input class="form-submit-btn" type="submit" value="{% trans %}Save{% endtrans %}" />
</form>
{% endif %} {% endif %}
{% endblock %} {% endblock %}

View File

@ -1,25 +1,40 @@
{% extends "core/base.jinja" %} {% extends "core/base.jinja" %}
{%- block additional_css -%}
<link rel="stylesheet" href="{{ scss('core/override.scss') }}">
<link rel="stylesheet" href="{{ scss('user/user_stats.scss') }}">
{%- endblock -%}
{% block title %} {% block title %}
{% trans user_name=profile.get_display_name() %}{{ user_name }}'s stats{% endtrans %} {% trans user_name=profile.get_display_name() %}{{ user_name }}'s stats{% endtrans %}
{% endblock %} {% endblock %}
{% block content %} {% block content %}
<div class="row">
{% if profile.permanencies %} {% if profile.permanencies %}
<h3>{% trans %}Permanencies{% endtrans %}</h3>
<div> <div>
<p>Total: {{ total_perm_time }}</p> <h3>{% trans %}Permanencies{% endtrans %}</h3>
<p>Foyer: {{ total_foyer_time }}</p> <div class="flexed">
<p>MDE: {{ total_mde_time }}</p> <div><span>Foyer :</span><span>{{ total_foyer_time }}</span></div>
<p>La Gommette: {{ total_gommette_time }}</p> <div><span>Gommette :</span><span>{{ total_gommette_time }}</span></div>
<div><span>MDE :</span><span>{{ total_mde_time }}</span></div>
<div><b>Total :</b><b>{{ total_perm_time }}</b></div>
</div>
</div> </div>
{% endif %} {% endif %}
<h3>{% trans %}Buyings{% endtrans %}</h3>
<div> <div>
<p>Foyer: {{ total_foyer_buyings }} €</p> <h3>{% trans %}Buyings{% endtrans %}</h3>
<p>MDE: {{ total_mde_buyings }} €</p> <div class="flexed">
<p>La Gommette: {{ total_gommette_buyings }} €</p> <div><span>Foyer :</span><span>{{ total_foyer_buyings }}&nbsp;€</span></div>
<div><span>Gommette :</span><span>{{ total_gommette_buyings }}&nbsp;€</span></div>
<div><span>MDE :</span><span>{{ total_mde_buyings }}&nbsp;€</span></div>
<div><b>Total :</b><b>{{ total_foyer_buyings + total_gommette_buyings + total_mde_buyings }}&nbsp;€</b>
</div> </div>
</div>
</div>
</div>
<h3>{% trans %}Product top 10{% endtrans %}</h3> <h3>{% trans %}Product top 10{% endtrans %}</h3>
<table> <table>
<thead> <thead>
@ -38,5 +53,3 @@
</tbody> </tbody>
</table> </table>
{% endblock %} {% endblock %}

View File

@ -1,5 +1,9 @@
{% extends "core/base.jinja" %} {% extends "core/base.jinja" %}
{%- block additional_css -%}
<link rel="stylesheet" href="{{ scss('core/override.scss') }}">
{%- endblock -%}
{% block title %} {% block title %}
{% trans user_name=user.get_display_name() %}{{ user_name }}'s tools{% endtrans %} {% trans user_name=user.get_display_name() %}{{ user_name }}'s tools{% endtrans %}
{% endblock %} {% endblock %}
@ -7,14 +11,15 @@
{% block content %} {% block content %}
<h3>{% trans %}User Tools{% endtrans %}</h3> <h3>{% trans %}User Tools{% endtrans %}</h3>
<hr> {% if user.can_create_subscription or user.is_root or user.is_board_member %}
<h4>{% trans %}Sith management{% endtrans %}</h4> <h4>{% trans %}Sith management{% endtrans %}</h4>
<ul> <ul>
{% if user.is_root %} {% if user.is_root %}
<li><a href="{{ url('core:group_list') }}">{% trans %}Groups{% endtrans %}</a></li> <li><a href="{{ url('core:group_list') }}">{% trans %}Groups{% endtrans %}</a></li>
<li><a href="{{ url('rootplace:merge') }}">{% trans %}Merge users{% endtrans %}</a></li> <li><a href="{{ url('rootplace:merge') }}">{% trans %}Merge users{% endtrans %}</a></li>
<li><a href="{{ url('rootplace:operation_logs') }}">{% trans %}Operation logs{% endtrans %}</a></li> <li><a href="{{ url('rootplace:operation_logs') }}">{% trans %}Operation logs{% endtrans %}</a></li>
<li><a href="{{ url('rootplace:delete_forum_messages') }}">{% trans %}Delete user's forum messages{% endtrans %}</a></li> <li><a href="{{ url('rootplace:delete_forum_messages') }}">{% trans %}Delete user's forum messages{% endtrans %}</a>
</li>
{% endif %} {% endif %}
{% if user.can_create_subscription or user.is_root %} {% if user.can_create_subscription or user.is_root %}
<li><a href="{{ url('subscription:subscription') }}">{% trans %}Subscriptions{% endtrans %}</a></li> <li><a href="{{ url('subscription:subscription') }}">{% trans %}Subscriptions{% endtrans %}</a></li>
@ -24,8 +29,8 @@
<li><a href="{{ url('club:club_new') }}">{% trans %}New club{% endtrans %}</a></li> <li><a href="{{ url('club:club_new') }}">{% trans %}New club{% endtrans %}</a></li>
{% endif %} {% endif %}
</ul> </ul>
{% endif %}
<hr>
<h4>{% trans %}Counters{% endtrans %}</h4> <h4>{% trans %}Counters{% endtrans %}</h4>
<ul> <ul>
{% if user.is_in_group(settings.SITH_GROUP_COUNTER_ADMIN_ID) or user.is_root %} {% if user.is_in_group(settings.SITH_GROUP_COUNTER_ADMIN_ID) or user.is_root %}
@ -54,7 +59,6 @@
{% endfor %} {% endfor %}
</ul> </ul>
<hr>
<h4>{% trans %}Accounting{% endtrans %}</h4> <h4>{% trans %}Accounting{% endtrans %}</h4>
<ul> <ul>
{% if user.is_in_group(settings.SITH_GROUP_ACCOUNTING_ADMIN_ID) or user.is_root %} {% if user.is_in_group(settings.SITH_GROUP_ACCOUNTING_ADMIN_ID) or user.is_root %}
@ -62,20 +66,28 @@
<li><a href="{{ url('accounting:bank_list') }}">{% trans %}General accounting{% endtrans %}</a></li> <li><a href="{{ url('accounting:bank_list') }}">{% trans %}General accounting{% endtrans %}</a></li>
<li><a href="{{ url('accounting:co_list') }}">{% trans %}Company list{% endtrans %}</a></li> <li><a href="{{ url('accounting:co_list') }}">{% trans %}Company list{% endtrans %}</a></li>
{% endif %} {% endif %}
{% for m in user.memberships.filter(end_date=None).filter(role__gte=7).all() -%} {% for m in user.memberships.filter(end_date=None).filter(role__gte=7).all() -%}
{%- for b in m.club.bank_accounts.all() %} {%- for b in m.club.bank_accounts.all() %}
<li><strong>{% trans %}Bank account: {% endtrans %}</strong> <li>
<a href="{{ url('accounting:bank_details', b_account_id=b.id) }}">{{ b }}</a></li> <strong>{% trans %}Bank account: {% endtrans %}</strong>
<a href="{{ url('accounting:bank_details', b_account_id=b.id) }}">{{ b }}</a>
</li>
{%- endfor %} {%- endfor %}
{% if m.club.club_account.exists() -%} {% if m.club.club_account.exists() -%}
{% for ca in m.club.club_account.all() %} {% for ca in m.club.club_account.all() %}
<li><strong>{% trans %}Club account: {% endtrans %}</strong> <a href="{{ url('accounting:club_details', c_account_id=ca.id) }}">{{ ca }}</a></li> <li>
<strong>{% trans %}Club account: {% endtrans %}</strong>
<a href="{{ url('accounting:club_details', c_account_id=ca.id) }}">{{ ca }}</a>
</li>
{%- endfor %} {%- endfor %}
{%- endif -%} {%- endif -%}
{%- endfor %} {%- endfor %}
</ul> </ul>
<hr> {% if user.is_in_group(settings.SITH_GROUP_SAS_ADMIN_ID) or user.is_in_group(settings.SITH_GROUP_COM_ADMIN_ID) or
user.is_root %}
<h4>{% trans %}Communication{% endtrans %}</h4> <h4>{% trans %}Communication{% endtrans %}</h4>
<ul> <ul>
{% if user.is_in_group(settings.SITH_GROUP_COM_ADMIN_ID) or user.is_root %} {% if user.is_in_group(settings.SITH_GROUP_COM_ADMIN_ID) or user.is_root %}
@ -95,26 +107,25 @@
<li><a href="{{ url('sas:moderation') }}">{% trans %}Moderate pictures{% endtrans %}</a></li> <li><a href="{{ url('sas:moderation') }}">{% trans %}Moderate pictures{% endtrans %}</a></li>
{% endif %} {% endif %}
</ul> </ul>
{% endif %}
{% if user.memberships.filter(end_date=None).all().count() > 0 %}
<hr>
<h4>{% trans %}Club tools{% endtrans %}</h4> <h4>{% trans %}Club tools{% endtrans %}</h4>
<ul> <ul>
{% for m in user.memberships.filter(end_date=None).all() %} {% for m in user.memberships.filter(end_date=None).all() %}
<li><a href="{{ url('club:tools', club_id=m.club.id) }}">{{ m.club }}</a></li> <li><a href="{{ url('club:tools', club_id=m.club.id) }}">{{ m.club }}</a></li>
{% endfor %} {% endfor %}
</ul> </ul>
{% endif %}
<hr> {% if user.is_in_group(settings.SITH_GROUP_PEDAGOGY_ADMIN_ID) or user.is_root %}
<h4>{% trans %}Pedagogy{% endtrans %}</h4> <h4>{% trans %}Pedagogy{% endtrans %}</h4>
<ul> <ul>
{% if user.is_in_group(settings.SITH_GROUP_PEDAGOGY_ADMIN_ID) or user.is_root %}
<li><a href="{{ url('pedagogy:uv_create') }}">{% trans %}Create UV{% endtrans %}</a></li> <li><a href="{{ url('pedagogy:uv_create') }}">{% trans %}Create UV{% endtrans %}</a></li>
<li><a href="{{ url('pedagogy:moderation') }}">{% trans %}Moderate comments{% endtrans %}</a></li> <li><a href="{{ url('pedagogy:moderation') }}">{% trans %}Moderate comments{% endtrans %}</a></li>
{% endif %}
</ul> </ul>
{% endif %}
<hr>
<h4>{% trans %}Elections{% endtrans %}</h4> <h4>{% trans %}Elections{% endtrans %}</h4>
<ul> <ul>
<li><a href="{{ url('election:list') }}">{% trans %}See available elections{% endtrans %}</a></li> <li><a href="{{ url('election:list') }}">{% trans %}See available elections{% endtrans %}</a></li>
@ -124,14 +135,11 @@
{%- endif -%} {%- endif -%}
</ul> </ul>
<hr>
<h4>{% trans %}Other tools{% endtrans %}</h4> <h4>{% trans %}Other tools{% endtrans %}</h4>
<ul> <ul>
<li><a href="{{ url('core:to_markdown') }}">{% trans %}Convert dokuwiki/BBcode syntax to Markdown{% endtrans %}</a></li> <li><a href="{{ url('core:to_markdown') }}">{% trans %}Convert dokuwiki/BBcode syntax to Markdown{% endtrans %}</a>
</li>
<li><a href="{{ url('trombi:user_tools') }}">{% trans %}Trombi tools{% endtrans %}</a></li> <li><a href="{{ url('trombi:user_tools') }}">{% trans %}Trombi tools{% endtrans %}</a></li>
</ul> </ul>
{% endblock %} {% endblock %}

View File

@ -2214,8 +2214,8 @@ msgid "Visitor"
msgstr "Visiteur" msgstr "Visiteur"
#: core/models.py:787 #: core/models.py:787
msgid "do you want to receive the weekmail" msgid "receive the Weekmail"
msgstr "voulez-vous recevoir le Weekmail" msgstr "recevoir le Weekmail"
#: core/models.py:789 #: core/models.py:789
msgid "show your stats to others" msgid "show your stats to others"
@ -2223,11 +2223,11 @@ msgstr "montrez vos statistiques aux autres"
#: core/models.py:791 #: core/models.py:791
msgid "get a notification for every click" msgid "get a notification for every click"
msgstr "recevez une notification pour chaque click" msgstr "avoir une notification pour chaque click"
#: core/models.py:794 #: core/models.py:794
msgid "get a notification for every refilling" msgid "get a notification for every refilling"
msgstr "recevez une notification pour chaque rechargement" msgstr "avoir une notification pour chaque rechargement"
#: core/models.py:817 #: core/models.py:817
msgid "file name" msgid "file name"
@ -3361,8 +3361,8 @@ msgstr ""
"14 caractères de long." "14 caractères de long."
#: core/templates/core/user_preferences.jinja:40 #: core/templates/core/user_preferences.jinja:40
msgid "No student cards registered." msgid "No student card registered."
msgstr "Aucune cartes étudiante enregistré." msgstr "Aucune carte étudiante enregistrée."
#: core/templates/core/user_stats.jinja:4 #: core/templates/core/user_stats.jinja:4
#, python-format #, python-format