Merge branch 'morefront' into 'beta'

Do not list alias on profile page

See merge request bde/nk20!99
This commit is contained in:
erdnaxe 2020-08-25 16:44:55 +02:00
commit 93e5e4c8cd
26 changed files with 548 additions and 526 deletions

View File

@ -96,8 +96,8 @@ class MembershipTable(tables.Table):
t = pretty_money(value) t = pretty_money(value)
# If it is required and if the user has the right, the renew button is displayed. # If it is required and if the user has the right, the renew button is displayed.
if record.club.membership_start is not None: if record.club.membership_start is not None \
if record.date_start < record.club.membership_start: # If the renew is available and record.date_start < record.club.membership_start:
if not Membership.objects.filter( if not Membership.objects.filter(
club=record.club, club=record.club,
user=record.user, user=record.user,
@ -113,9 +113,13 @@ class MembershipTable(tables.Table):
) )
if PermissionBackend.check_perm(get_current_authenticated_user(), if PermissionBackend.check_perm(get_current_authenticated_user(),
"member:add_membership", empty_membership): # If the user has right "member:add_membership", empty_membership): # If the user has right
t = format_html(t + ' <a class="btn btn-warning" href="{url}">{text}</a>', renew_url = reverse_lazy('member:club_renew_membership',
url=reverse_lazy('member:club_renew_membership', kwargs={"pk": record.pk})
kwargs={"pk": record.pk}), text=_("Renew")) t = format_html(
t + ' <a class="btn btn-sm btn-warning" title="{text}"'
' href="{renew_url}"><i class="fa fa-repeat"></i></a>',
renew_url=renew_url, text=_("Renew")
)
return t return t
def render_roles(self, record): def render_roles(self, record):

View File

@ -1,14 +1,15 @@
{% extends "member/base.html" %} {% extends "member/base.html" %}
{% load crispy_forms_tags %} {% comment %}
{% load static %} SPDX-License-Identifier: GPL-3.0-or-later
{% load i18n %} {% endcomment %}
{% load pretty_money %} {% load crispy_forms_tags i18n pretty_money %}
{% block profile_info %}
{% include "member/club_info.html" %}
{% endblock %}
{% block profile_content %} {% block profile_content %}
<div class="card bg-light">
<h3 class="card-header text-center">
{{ title }}
</h3>
<div class="card-body">
{% if additional_fee_renewal %} {% if additional_fee_renewal %}
<div class="alert alert-warning"> <div class="alert alert-warning">
{% if renewal %} {% if renewal %}
@ -30,16 +31,18 @@
{{ form|crispy }} {{ form|crispy }}
<button class="btn btn-primary" type="submit">{% trans "Submit" %}</button> <button class="btn btn-primary" type="submit">{% trans "Submit" %}</button>
</form> </form>
</div>
</div>
{% endblock %} {% endblock %}
{% block extrajavascript %} {% block extrajavascript %}
<script> <script>
function autocompleted(user) { function autocompleted(user) {
$("#id_last_name").val(user.last_name); $("#id_last_name").val(user.last_name);
$("#id_first_name").val(user.first_name); $("#id_first_name").val(user.first_name);
$.getJSON("/api/members/profile/" + user.id + "/", function(profile) { $.getJSON("/api/members/profile/" + user.id + "/", function (profile) {
let fee = profile.paid ? {{ club.membership_fee_paid }} : {{ club.membership_fee_unpaid }}; let fee = profile.paid ? "{{ club.membership_fee_paid }}" : "{{ club.membership_fee_unpaid }}";
$("#id_credit_amount").val((fee / 100).toFixed(2)); $("#id_credit_amount").val((Number(fee) / 100).toFixed(2));
}); });
} }
@ -68,5 +71,5 @@
} }
soge_field.change(fillFields); soge_field.change(fillFields);
</script> </script>
{% endblock %} {% endblock %}

View File

@ -2,6 +2,7 @@
{% comment %} {% comment %}
SPDX-License-Identifier: GPL-3.0-or-later SPDX-License-Identifier: GPL-3.0-or-later
{% endcomment %} {% endcomment %}
{% load i18n perms %}
{% block contenttitle %}{% endblock %} {% block contenttitle %}{% endblock %}
{# Use a fluid-width container #} {# Use a fluid-width container #}
@ -11,24 +12,74 @@ SPDX-License-Identifier: GPL-3.0-or-later
<div class="row mt-4"> <div class="row mt-4">
<div class="col-xl-4"> <div class="col-xl-4">
{% block profile_info %} {% block profile_info %}
{% include "member/profile_info.html" %} <div class="card bg-light">
<h4 class="card-header text-center">
{% if user_object %}
{% trans "Account #" %}{{ user_object.pk }}
{% elif club %}
Club {{ club.name }}
{% endif %}
</h4>
<div class="text-center">
{% if user_object %}
<a href="{% url 'member:user_update_pic' user_object.pk %}">
<img src="{{ user_object.note.display_image.url }}" class="img-thumbnail mt-2">
</a>
{% elif club %}
<a href="{% url 'member:club_update_pic' club.pk %}">
<img src="{{ club.note.display_image.url }}" class="img-thumbnail mt-2">
</a>
{% endif %}
</div>
<div class="card-body" id="profile_infos">
{% if user_object %}
{% include "member/includes/profile_info.html" %}
{% elif club %}
{% include "member/includes/club_info.html" %}
{% endif %}
{% endblock %} {% endblock %}
</div> </div>
<div class="card-footer">
{% if user_object %}
<a class="btn btn-sm btn-secondary" href="{% url 'member:user_update_profile' user_object.pk %}">
<i class="fa fa-edit"></i> {% trans 'Update Profile' %}
</a>
{% url 'member:user_detail' user_object.pk as user_profile_url %}
{% if request.path_info != user_profile_url %}
<a class="btn btn-sm btn-primary" href="{{ user_profile_url }}">{% trans 'View Profile' %}</a>
{% endif %}
{% elif club and not club.weiclub %}
{% if can_add_members %}
<a class="btn btn-sm btn-success" href="{% url 'member:club_add_member' club_pk=club.pk %}"
data-turbolinks="false"> {% trans "Add member" %}</a>
{% endif %}
{% if ".change_"|has_perm:club %}
<a class="btn btn-sm btn-secondary" href="{% url 'member:club_update' pk=club.pk %}"
data-turbolinks="false">
<i class="fa fa-edit"></i> {% trans 'Update Profile' %}
</a>
{% endif %}
{% url 'member:club_detail' club.pk as club_detail_url %}
{% if request.path_info != club_detail_url %}
<a class="btn btn-sm btn-primary" href="{{ club_detail_url }}">{% trans 'View Profile' %}</a>
{% endif %}
{% endif %}
</div>
</div>
</div>
<div class="col-xl-8"> <div class="col-xl-8">
{% block profile_content %} {% block profile_content %}{% endblock %}
{% include "member/profile_tables.html" %}
{% endblock %}
</div> </div>
</div> </div>
{% endblock %} {% endblock %}
{% block extrajavascript %} {% block extrajavascript %}
{% if object %}
<script> <script>
{% if object %}
function refreshHistory() { function refreshHistory() {
$("#history_list").load("{% url 'member:user_detail' pk=object.pk %} #history_list"); $("#history_list").load("{% url 'member:user_detail' pk=object.pk %} #history_list");
$("#profile_infos").load("{% url 'member:user_detail' pk=object.pk %} #profile_infos"); $("#profile_infos").load("{% url 'member:user_detail' pk=object.pk %} #profile_infos");
} }
{% endif %}
</script> </script>
{% endif %}
{% endblock %} {% endblock %}

View File

@ -1,4 +1,7 @@
{% extends "member/club_detail.html" %} {% extends "member/base.html" %}
{% comment %}
SPDX-License-Identifier: GPL-3.0-or-later
{% endcomment %}
{% load static django_tables2 i18n %} {% load static django_tables2 i18n %}
{% block profile_content %} {% block profile_content %}

View File

@ -1,11 +1,50 @@
{% extends "member/base.html" %} {% extends "member/base.html" %}
{% comment %}
{% block profile_info %} SPDX-License-Identifier: GPL-3.0-or-later
{% include "member/club_info.html" %} {% endcomment %}
{% endblock %} {% load render_table from django_tables2 %}
{% load i18n perms %}
{% block profile_content %} {% block profile_content %}
{% include "member/club_tables.html" %} {% if managers.data %}
<div class="card">
<div class="card-header position-relative" id="clubListHeading">
<a class="font-weight-bold">
<i class="fa fa-users"></i> {% trans "Club managers" %}
</a>
</div>
{% render_table managers %}
</div>
<hr>
{% endif %}
{% if member_list.data %}
<div class="card">
<div class="card-header position-relative" id="clubListHeading">
<a class="stretched-link font-weight-bold" href="{% url 'member:club_members' pk=club.pk %}">
<i class="fa fa-users"></i> {% trans "Club members" %}
</a>
</div>
{% render_table member_list %}
</div>
<hr>
{% endif %}
{% if history_list.data %}
<div class="card">
<div class="card-header position-relative" id="historyListHeading">
<a class="stretched-link font-weight-bold" {% if "note.view_note"|has_perm:club.note %}
href="{% url 'note:transactions' pk=club.note.pk %}" {% endif %}>
<i class="fa fa-euro"></i> {% trans "Transaction history" %}
</a>
</div>
<div id="history_list">
{% render_table history_list %}
</div>
</div>
{% endif %}
{% endblock %} {% endblock %}
{% block extrajavascript %} {% block extrajavascript %}

View File

@ -1,11 +1,11 @@
{% extends "base.html" %} {% extends "member/base.html" %}
{% comment %} {% comment %}
SPDX-License-Identifier: GPL-3.0-or-later SPDX-License-Identifier: GPL-3.0-or-later
{% endcomment %} {% endcomment %}
{% load i18n crispy_forms_tags %} {% load i18n crispy_forms_tags %}
{% block contenttitle %}{% endblock %} {% block contenttitle %}{% endblock %}
{% block content %} {% block profile_content %}
<div class="card bg-light"> <div class="card bg-light">
<h3 class="card-header text-center"> <h3 class="card-header text-center">
{{ title }} {{ title }}

View File

@ -1,80 +0,0 @@
{% load i18n pretty_money perms %}
<div class="card bg-light">
<h4 class="card-header text-center">
Club {{ club.name }}
</h4>
<div class="card-top text-center">
<a href="{% url 'member:club_update_pic' club.pk %}">
<img src="{{ club.note.display_image.url }}" class="img-thumbnail mt-2">
</a>
</div>
<div class="card-body" id="profile_infos">
<dl class="row">
<dt class="col-xl-6">{% trans 'name'|capfirst %}</dt>
<dd class="col-xl-6">{{ club.name }}</dd>
{% if club.parent_club %}
<dt class="col-xl-6">
<a href="{% url 'member:club_detail' club.parent_club.pk %}">{% trans 'Club Parent'|capfirst %}</a>
</dt>
<dd class="col-xl-6"> {{ club.parent_club.name }}</dd>
{% endif %}
{% if club.require_memberships %}
{% if club.membership_start %}
<dt class="col-xl-6">{% trans 'membership start'|capfirst %}</dt>
<dd class="col-xl-6">{{ club.membership_start }}</dd>
{% endif %}
{% if club.membership_end %}
<dt class="col-xl-6">{% trans 'membership end'|capfirst %}</dt>
<dd class="col-xl-6">{{ club.membership_end }}</dd>
{% endif %}
{% if club.membership_duration %}
<dt class="col-xl-6">{% trans 'membership duration'|capfirst %}</dt>
<dd class="col-xl-6">{{ club.membership_duration }} {% trans "days" %}</dd>
{% endif %}
{% if club.membership_fee_paid == club.membership_fee_unpaid %}
<dt class="col-xl-6">{% trans 'membership fee'|capfirst %}</dt>
<dd class="col-xl-6">{{ club.membership_fee_paid|pretty_money }}</dd>
{% else %}
<dt class="col-xl-6">{% trans 'membership fee (paid students)'|capfirst %}</dt>
<dd class="col-xl-6">{{ club.membership_fee_paid|pretty_money }}</dd>
<dt class="col-xl-6">{% trans 'membership fee (unpaid students)'|capfirst %}</dt>
<dd class="col-xl-6">{{ club.membership_fee_unpaid|pretty_money }}</dd>
{% endif %}
{% endif %}
{% if "note.view_note"|has_perm:club.note %}
<dt class="col-xl-6">{% trans 'balance'|capfirst %}</dt>
<dd class="col-xl-6">{{ club.note.balance | pretty_money }}</dd>
{% endif %}
<dt class="col-xl-6"><a href="{% url 'member:club_alias' club.pk %}">{% trans 'aliases'|capfirst %}</a></dt>
<dd class="col-xl-6 text-truncate">{{ club.note.alias_set.all|join:", " }}</dd>
<dt class="col-xl-4">{% trans 'email'|capfirst %}</dt>
<dd class="col-xl-8"><a href="mailto:{{ club.email }}">{{ club.email }}</a></dd>
</dl>
</div>
{% if not club.weiclub %}
<div class="card-footer text-center">
{% if can_add_members %}
<a class="btn btn-primary btn-sm my-1" href="{% url 'member:club_add_member' club_pk=club.pk %}"
data-turbolinks="false"> {% trans "Add member" %}</a>
{% endif %}
{% if ".change_"|has_perm:club %}
<a class="btn btn-primary btn-sm my-1" href="{% url 'member:club_update' pk=club.pk %}" data-turbolinks="false">
{% trans "Edit" %}</a>
{% endif %}
{% url 'member:club_detail' club.pk as club_detail_url %}
{%if request.path_info != club_detail_url %}
<a class="btn btn-primary btn-sm my-1" href="{{ club_detail_url }}">{% trans 'View Profile' %}</a>
{% endif %}
</div>
{% endif %}
</div>

View File

@ -2,13 +2,13 @@
{% load i18n %} {% load i18n %}
{% load render_table from django_tables2 %} {% load render_table from django_tables2 %}
{% block profile_info %}
{% include "member/club_info.html" %}
{% endblock %}
{% block profile_content %} {% block profile_content %}
<input id="searchbar" type="text" class="form-control" placeholder="Nom/prénom/note ..."> <div class="card bg-light">
<div class="form-group"> <h3 class="card-header text-center">
{{ title }}
</h3>
<div class="card-body">
<input id="searchbar" type="text" class="form-control" placeholder="Nom/prénom/note…">
<div class="form-check"> <div class="form-check">
<label class="form-check-label" for="only_active"> <label class="form-check-label" for="only_active">
<input type="checkbox" class="checkboxinput form-check-input" id="only_active" <input type="checkbox" class="checkboxinput form-check-input" id="only_active"
@ -16,10 +16,8 @@
{% trans "Display only active memberships" %} {% trans "Display only active memberships" %}
</label> </label>
</div> </div>
</div> <div id="div_id_roles">
<div id="div_id_roles" class="form-group"> <label for="roles" class="col-form-label">{% trans "Filter roles:" %}</label>
<label for="id_roles" class="col-form-label">{% trans "Filter roles:" %}</label>
<div class="">
<select name="roles" class="selectmultiple form-control" id="roles" multiple=""> <select name="roles" class="selectmultiple form-control" id="roles" multiple="">
{% for role in applicable_roles %} {% for role in applicable_roles %}
<option value="{{ role.id }}" selected>{{ role.name }}</option> <option value="{{ role.id }}" selected>{{ role.name }}</option>
@ -27,8 +25,6 @@
</select> </select>
</div> </div>
</div> </div>
<hr>
<div id="memberships_table"> <div id="memberships_table">
{% if table.data %} {% if table.data %}
{% render_table table %} {% render_table table %}
@ -38,10 +34,11 @@
</div> </div>
{% endif %} {% endif %}
</div> </div>
</div>
{% endblock %} {% endblock %}
{% block extrajavascript %} {% block extrajavascript %}
<script type="text/javascript"> <script type="text/javascript">
$(document).ready(function () { $(document).ready(function () {
let searchbar_obj = $("#searchbar"); let searchbar_obj = $("#searchbar");
let only_active_obj = $("#only_active"); let only_active_obj = $("#only_active");
@ -51,19 +48,19 @@
let pattern = searchbar_obj.val(); let pattern = searchbar_obj.val();
let roles = []; let roles = [];
$("#roles option:selected").each(function() { $("#roles option:selected").each(function () {
roles.push($(this).val()); roles.push($(this).val());
}); });
let roles_str = roles.join(','); let roles_str = roles.join(',');
$("#memberships_table").load(location.pathname + "?search=" + pattern.replace(" ", "%20") $("#memberships_table").load(location.pathname + "?search=" + pattern.replace(" ", "%20") +
+ "&only_active=" + (only_active_obj.is(':checked') ? '1' : '0') "&only_active=" + (only_active_obj.is(':checked') ? '1' : '0') +
+ "&roles=" + roles_str + " #memberships_table"); "&roles=" + roles_str + " #memberships_table");
} }
searchbar_obj.keyup(reloadTable); searchbar_obj.keyup(reloadTable);
only_active_obj.change(reloadTable); only_active_obj.change(reloadTable);
roles_obj.change(reloadTable); roles_obj.change(reloadTable);
}); });
</script> </script>
{% endblock %} {% endblock %}

View File

@ -1,5 +0,0 @@
{% extends "member/club_detail.html" %}
{% block profile_content%}
{% include "member/picture_update.html" %}
{% endblock%}

View File

@ -1,42 +0,0 @@
{% load render_table from django_tables2 %}
{% load i18n %}
{% load perms %}
{% if managers.data %}
<div class="card">
<div class="card-header position-relative" id="clubListHeading">
<a class="font-weight-bold">
<i class="fa fa-users"></i> {% trans "Club managers" %}
</a>
</div>
{% render_table managers %}
</div>
<hr>
{% endif %}
{% if member_list.data %}
<div class="card">
<div class="card-header position-relative" id="clubListHeading">
<a class="stretched-link font-weight-bold" href="{% url 'member:club_members' pk=club.pk %}">
<i class="fa fa-users"></i> {% trans "Club members" %}
</a>
</div>
{% render_table member_list %}
</div>
<hr>
{% endif %}
{% if history_list.data %}
<div class="card">
<div class="card-header position-relative" id="historyListHeading">
<a class="stretched-link font-weight-bold" {% if "note.view_note"|has_perm:club.note %} href="{% url 'note:transactions' pk=club.note.pk %}" {% endif %}>
<i class="fa fa-euro"></i> {% trans "Transaction history" %}
</a>
</div>
<div id="history_list">
{% render_table history_list %}
</div>
</div>
{% endif %}

View File

@ -0,0 +1,56 @@
{% load i18n pretty_money perms %}
<dl class="row">
<dt class="col-xl-6">{% trans 'name'|capfirst %}</dt>
<dd class="col-xl-6">{{ club.name }}</dd>
{% if club.parent_club %}
<dt class="col-xl-6">
<a href="{% url 'member:club_detail' club.parent_club.pk %}">{% trans 'Club Parent'|capfirst %}</a>
</dt>
<dd class="col-xl-6"> {{ club.parent_club.name }}</dd>
{% endif %}
{% if club.require_memberships %}
{% if club.membership_start %}
<dt class="col-xl-6">{% trans 'membership start'|capfirst %}</dt>
<dd class="col-xl-6">{{ club.membership_start }}</dd>
{% endif %}
{% if club.membership_end %}
<dt class="col-xl-6">{% trans 'membership end'|capfirst %}</dt>
<dd class="col-xl-6">{{ club.membership_end }}</dd>
{% endif %}
{% if club.membership_duration %}
<dt class="col-xl-6">{% trans 'membership duration'|capfirst %}</dt>
<dd class="col-xl-6">{{ club.membership_duration }} {% trans "days" %}</dd>
{% endif %}
{% if club.membership_fee_paid == club.membership_fee_unpaid %}
<dt class="col-xl-6">{% trans 'membership fee'|capfirst %}</dt>
<dd class="col-xl-6">{{ club.membership_fee_paid|pretty_money }}</dd>
{% else %}
<dt class="col-xl-6">{% trans 'membership fee (paid students)'|capfirst %}</dt>
<dd class="col-xl-6">{{ club.membership_fee_paid|pretty_money }}</dd>
<dt class="col-xl-6">{% trans 'membership fee (unpaid students)'|capfirst %}</dt>
<dd class="col-xl-6">{{ club.membership_fee_unpaid|pretty_money }}</dd>
{% endif %}
{% endif %}
{% if "note.view_note"|has_perm:club.note %}
<dt class="col-xl-6">{% trans 'balance'|capfirst %}</dt>
<dd class="col-xl-6">{{ club.note.balance | pretty_money }}</dd>
{% endif %}
<dt class="col-xl-6">{% trans 'aliases'|capfirst %}</dt>
<dd class="col-xl-6">
<a class="small" href="{% url 'member:club_alias' club.pk %}">
{% trans 'Edit aliases' %} ({{ club.note.alias_set.all|length }})
</a>
</dd>
<dt class="col-xl-4">{% trans 'email'|capfirst %}</dt>
<dd class="col-xl-8"><a href="mailto:{{ club.email }}">{{ club.email }}</a></dd>
</dl>

View File

@ -0,0 +1,52 @@
{% load i18n pretty_money perms %}
<dl class="row">
<dt class="col-xl-6">{% trans 'name'|capfirst %}, {% trans 'first name' %}</dt>
<dd class="col-xl-6">{{ user_object.last_name }} {{ user_object.first_name }}</dd>
<dt class="col-xl-6">{% trans 'username'|capfirst %}</dt>
<dd class="col-xl-6">{{ user_object.username }}</dd>
{% if user_object.pk == user.pk %}
<dt class="col-xl-6">{% trans 'password'|capfirst %}</dt>
<dd class="col-xl-6">
<a class="small" href="{% url 'password_change' %}">
{% trans 'Change password' %}
</a>
</dd>
{% endif %}
<dt class="col-xl-6">{% trans 'aliases'|capfirst %}</dt>
<dd class="col-xl-6">
<a class="small" href="{% url 'member:user_alias' user_object.pk %}">
{% trans 'Edit aliases' %} ({{ user_object.note.alias_set.all|length }})
</a>
</dd>
<dt class="col-xl-6">{% trans 'section'|capfirst %}</dt>
<dd class="col-xl-6">{{ user_object.profile.section }}</dd>
<dt class="col-xl-6">{% trans 'email'|capfirst %}</dt>
<dd class="col-xl-6"><a href="mailto:{{ user_object.email }}">{{ user_object.email }}</a></dd>
<dt class="col-xl-6">{% trans 'phone number'|capfirst %}</dt>
<dd class="col-xl-6"><a href="tel:{{ user_object.profile.phone_number }}">{{ user_object.profile.phone_number }}</a>
</dd>
<dt class="col-xl-6">{% trans 'address'|capfirst %}</dt>
<dd class="col-xl-6">{{ user_object.profile.address }}</dd>
{% if "note.view_note"|has_perm:user_object.note %}
<dt class="col-xl-6">{% trans 'balance'|capfirst %}</dt>
<dd class="col-xl-6">{{ user_object.note.balance | pretty_money }}</dd>
<dt class="col-xl-6">{% trans 'paid'|capfirst %}</dt>
<dd class="col-xl-6">{{ user_object.profile.paid|yesno }}</dd>
{% endif %}
</dl>
{% if user_object.pk == user_object.pk %}
<a class="small float-right text-decoration-none" href="{% url 'member:auth_token' %}">
{% trans 'Manage auth token' %}
</a>
{% endif %}

View File

@ -1,8 +1,11 @@
{% extends "base.html" %} {% extends "member/base.html" %}
{% load i18n static pretty_money django_tables2 %} {% comment %}
SPDX-License-Identifier: GPL-3.0-or-later
{% endcomment %}
{% load i18n %}
{% block content %} {% block content %}
<div class="alert alert-info"> <div class="alert alert-info">
<h4>À quoi sert un jeton d'authentification ?</h4> <h4>À quoi sert un jeton d'authentification ?</h4>
Un jeton vous permet de vous connecter à <a href="/api/">l'API de la Note Kfet</a>.<br /> Un jeton vous permet de vous connecter à <a href="/api/">l'API de la Note Kfet</a>.<br />
@ -10,9 +13,9 @@
pour pouvoir vous identifier.<br /><br /> pour pouvoir vous identifier.<br /><br />
Une documentation de l'API arrivera ultérieurement. Une documentation de l'API arrivera ultérieurement.
</div> </div>
<div class="alert alert-info"> <div class="alert alert-info">
<strong>{%trans 'Token' %} :</strong> <strong>{%trans 'Token' %} :</strong>
{% if 'show' in request.GET %} {% if 'show' in request.GET %}
{{ token.key }} (<a href="?">cacher</a>) {{ token.key }} (<a href="?">cacher</a>)
@ -21,13 +24,13 @@
{% endif %} {% endif %}
<br /> <br />
<strong>{%trans 'Created' %} :</strong> {{ token.created }} <strong>{%trans 'Created' %} :</strong> {{ token.created }}
</div> </div>
<div class="alert alert-warning"> <div class="alert alert-warning">
<strong>Attention :</strong> regénérer le jeton va révoquer tout accès autorisé à l'API via ce jeton ! <strong>Attention :</strong> regénérer le jeton va révoquer tout accès autorisé à l'API via ce jeton !
</div> </div>
<a href="?regenerate"> <a href="?regenerate">
<button class="btn btn-primary">{% trans 'Regenerate token' %}</button> <button class="btn btn-primary">{% trans 'Regenerate token' %}</button>
</a> </a>
{% endblock %} {% endblock %}

View File

@ -1,13 +1,20 @@
{% extends "member/base.html" %}
{% load i18n crispy_forms_tags %} {% load i18n crispy_forms_tags %}
{% block profile_content %} {% block profile_content %}
<div class="text-center"> <div class="card bg-light">
<form method="post" enctype="multipart/form-data" id="formUpload"> <h3 class="card-header text-center">
{{ title }}
</h3>
<div class="card-body">
<div class="text-center">
<form method="post" enctype="multipart/form-data" id="formUpload">
{% csrf_token %} {% csrf_token %}
{{ form |crispy }} {{ form |crispy }}
</form> </form>
</div> </div>
<!-- MODAL TO CROP THE IMAGE --> <!-- MODAL TO CROP THE IMAGE -->
<div class="modal fade" id="modalCrop"> <div class="modal fade" id="modalCrop">
<div class="modal-dialog"> <div class="modal-dialog">
<div class="modal-content"> <div class="modal-content">
<div class="modal-body"> <div class="modal-body">
@ -27,16 +34,19 @@
</div> </div>
</div> </div>
</div> </div>
</div>
</div>
</div> </div>
{% endblock %} {% endblock %}
{% block extracss %} {% block extracss %}
<link href="https://cdnjs.cloudflare.com/ajax/libs/cropperjs/1.5.6/cropper.min.css" rel="stylesheet"> <link href="https://cdnjs.cloudflare.com/ajax/libs/cropperjs/1.5.6/cropper.min.css" rel="stylesheet">
{% endblock %} {% endblock %}
{% block extrajavascript%} {% block extrajavascript%}
<script src="https://cdnjs.cloudflare.com/ajax/libs/cropperjs/1.5.6/cropper.min.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/cropperjs/1.5.6/cropper.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/jquery-cropper@1.0.1/dist/jquery-cropper.min.js"></script> <script src="https://cdn.jsdelivr.net/npm/jquery-cropper@1.0.1/dist/jquery-cropper.min.js"></script>
<script> <script>
$(function () { $(function () {
/* SCRIPT TO OPEN THE MODAL WITH THE PREVIEW */ /* SCRIPT TO OPEN THE MODAL WITH THE PREVIEW */
@ -58,7 +68,7 @@
$("#modalCrop").on("shown.bs.modal", function () { $("#modalCrop").on("shown.bs.modal", function () {
$image.cropper({ $image.cropper({
viewMode: 1, viewMode: 1,
aspectRatio: 1/1, aspectRatio: 1 / 1,
minCropBoxWidth: 200, minCropBoxWidth: 200,
minCropBoxHeight: 200, minCropBoxHeight: 200,
ready: function () { ready: function () {
@ -89,7 +99,6 @@
$("#id_width").val(cropData["width"]); $("#id_width").val(cropData["width"]);
$("#formUpload").submit(); $("#formUpload").submit();
}); });
}); });
</script> </script>
{% endblock %} {% endblock %}

View File

@ -1,4 +1,7 @@
{% extends "member/profile_detail.html" %} {% extends "member/base.html" %}
{% comment %}
SPDX-License-Identifier: GPL-3.0-or-later
{% endcomment %}
{% load static django_tables2 i18n %} {% load static django_tables2 i18n %}
{% block profile_content %} {% block profile_content %}

View File

@ -1,4 +1,42 @@
{% extends "member/base.html" %} {% extends "member/base.html" %}
{% comment %}
SPDX-License-Identifier: GPL-3.0-or-later
{% endcomment %}
{% load render_table from django_tables2 %}
{% load i18n perms %}
{% block profile_content %}
{% if not object.profile.email_confirmed and "member.change_profile_email_confirmed"|has_perm:user_object.profile %}
<div class="alert alert-warning">
{% trans "This user doesn't have confirmed his/her e-mail address." %}
<a href="{% url "registration:email_validation_resend" pk=user_object.pk %}">
{% trans "Click here to resend a validation link." %}
</a>
</div>
{% endif %}
<div class="card bg-light mb-3">
<div class="card-header position-relative" id="clubListHeading">
<a class="font-weight-bold">
<i class="fa fa-users"></i> {% trans "View my memberships" %}
</a>
</div>
{% render_table club_list %}
</div>
<div class="card bg-light">
<div class="card-header position-relative" id="historyListHeading">
<a class="stretched-link font-weight-bold text-decoration-none"
{% if "note.view_note"|has_perm:user_object.note %}
href="{% url 'note:transactions' pk=user_object.note.pk %}" {% endif %}>
<i class="fa fa-euro"></i> {% trans "Transaction history" %}
</a>
</div>
<div id="history_list">
{% render_table history_list %}
</div>
</div>
{% endblock %}
{% block extrajavascript %} {% block extrajavascript %}
<script> <script>

View File

@ -1,71 +0,0 @@
{% load i18n pretty_money perms %}
<div class="card bg-light">
<h4 class="card-header text-center">
{% trans "Account #" %}{{ user_object.pk }}
</h4>
<div class="card-top text-center">
<a href="{% url 'member:user_update_pic' user_object.pk %}">
<img src="{{ user_object.note.display_image.url }}" class="img-thumbnail mt-2">
</a>
</div>
<div class="card-body" id="profile_infos">
<dl class="row">
<dt class="col-xl-6">{% trans 'name'|capfirst %}, {% trans 'first name' %}</dt>
<dd class="col-xl-6">{{ user_object.last_name }} {{ user_object.first_name }}</dd>
<dt class="col-xl-6">{% trans 'username'|capfirst %}</dt>
<dd class="col-xl-6">{{ user_object.username }}</dd>
{% if user_object.pk == user.pk %}
<dt class="col-xl-6">{% trans 'password'|capfirst %}</dt>
<dd class="col-xl-6">
<a class="small" href="{% url 'password_change' %}">
{% trans 'Change password' %}
</a>
</dd>
{% endif %}
<dt class="col-xl-6">{% trans 'section'|capfirst %}</dt>
<dd class="col-xl-6">{{ user_object.profile.section }}</dd>
<dt class="col-xl-6">{% trans 'email'|capfirst %}</dt>
<dd class="col-xl-6"><a href="mailto:{{ user_object.email }}">{{ user_object.email }}</a></dd>
<dt class="col-xl-6">{% trans 'phone number'|capfirst %}</dt>
<dd class="col-xl-6"><a
href="tel:{{ user_object.profile.phone_number }}">{{ user_object.profile.phone_number }}</a></dd>
<dt class="col-xl-6">{% trans 'address'|capfirst %}</dt>
<dd class="col-xl-6">{{ user_object.profile.address }}</dd>
{% if "note.view_note"|has_perm:user_object.note %}
<dt class="col-xl-6">{% trans 'balance'|capfirst %}</dt>
<dd class="col-xl-6">{{ user_object.note.balance | pretty_money }}</dd>
<dt class="col-xl-6">{% trans 'paid'|capfirst %}</dt>
<dd class="col-xl-6">{{ user_object.profile.paid|yesno }}</dd>
{% endif %}
</dl>
<h4><a href="{% url 'member:user_alias' user_object.pk %}">{% trans 'aliases'|capfirst %}</a></h4>
{% for alias in user_object.note.alias_set.all %}
<span class="badge badge-secondary">{{ alias }}</span>
{% endfor %}
</div>
<div class="card-footer">
<a class="btn btn-sm btn-secondary" href="{% url 'member:user_update_profile' user_object.pk %}">
<i class="fa fa-edit"></i> {% trans 'Update Profile' %}
</a>
{% url 'member:user_detail' user_object.pk as user_profile_url %}
{% if request.path_info != user_profile_url %}
<a class="btn btn-sm btn-primary" href="{{ user_profile_url }}">{% trans 'View Profile' %}</a>
{% endif %}
</div>
</div>
{% if user_object.pk == user_object.pk %}
<a class="small float-right text-decoration-none" href="{% url 'member:auth_token' %}">
{% trans 'Manage auth token' %}
</a>
{% endif %}

View File

@ -1,5 +0,0 @@
{% extends "member/profile_detail.html" %}
{% block profile_content%}
{% include "member/picture_update.html" %}
{% endblock%}

View File

@ -1,32 +0,0 @@
{% load render_table from django_tables2 %}
{% load i18n %}
{% load perms %}
{% if not object.profile.email_confirmed and "member.change_profile_email_confirmed"|has_perm:user_object.profile %}
<div class="alert alert-warning">
{% trans "This user doesn't have confirmed his/her e-mail address." %}
<a href="{% url "registration:email_validation_resend" pk=user_object.pk %}">{% trans "Click here to resend a validation link." %}</a>
</div>
{% endif %}
<div class="card">
<div class="card-header position-relative" id="clubListHeading">
<a class="font-weight-bold">
<i class="fa fa-users"></i> {% trans "View my memberships" %}
</a>
</div>
{% render_table club_list %}
</div>
<hr>
<div class="card">
<div class="card-header position-relative" id="historyListHeading">
<a class="stretched-link font-weight-bold" {% if "note.view_note"|has_perm:user_object.note %} href="{% url 'note:transactions' pk=user_object.note.pk %}" {% endif %}>
<i class="fa fa-euro"></i> {% trans "Transaction history" %}
</a>
</div>
<div id="history_list">
{% render_table history_list %}
</div>
</div>

View File

@ -1,11 +1,11 @@
{% extends "base.html" %} {% extends "member/base.html" %}
{% load i18n crispy_forms_tags %}
{% comment %} {% comment %}
SPDX-License-Identifier: GPL-3.0-or-later SPDX-License-Identifier: GPL-3.0-or-later
{% endcomment %} {% endcomment %}
{% load i18n crispy_forms_tags %}
{% block contenttitle %}{% endblock %} {% block contenttitle %}{% endblock %}
{% block content %} {% block profile_content %}
<div class="card bg-light"> <div class="card bg-light">
<h3 class="card-header text-center"> <h3 class="card-header text-center">
{{ title }} {{ title }}

View File

@ -273,7 +273,7 @@ class PictureUpdateView(ProtectQuerysetMixin, LoginRequiredMixin, FormMixin, Det
class ProfilePictureUpdateView(PictureUpdateView): class ProfilePictureUpdateView(PictureUpdateView):
model = User model = User
template_name = 'member/profile_picture_update.html' template_name = 'member/picture_update.html'
context_object_name = 'user_object' context_object_name = 'user_object'
@ -452,7 +452,7 @@ class ClubPictureUpdateView(PictureUpdateView):
Update the profile picture of a club. Update the profile picture of a club.
""" """
model = Club model = Club
template_name = 'member/club_picture_update.html' template_name = 'member/picture_update.html'
context_object_name = 'club' context_object_name = 'club'
def get_success_url(self): def get_success_url(self):

View File

@ -1,36 +1,38 @@
{% extends "member/base.html" %} {% extends "base.html" %}
{% comment %}
SPDX-License-Identifier: GPL-3.0-or-later
{% endcomment %}
{% load render_table from django_tables2 %} {% load render_table from django_tables2 %}
{% load crispy_forms_tags %} {% load crispy_forms_tags %}
{% block contenttitle %}{% endblock %}
{% block profile_info %} {# Use a fluid-width container #}
{% if note.club.weiclub %} {% block containertype %}container-fluid{% endblock %}
{% with club=note.club.weiclub %}
{% include "wei/weiclub_info.html" %}
{% endwith %}
{% elif note.club %}
{% with club=note.club %}
{% include "member/club_info.html" %}
{% endwith %}
{% elif note.user %}
{% with user_object=note.user %}
{% include "member/profile_info.html" %}
{% endwith %}
{% endif %}
{% endblock %}
{% block profile_content %}
{% crispy form %}
{% endblock %}
{% block content %} {% block content %}
{{ block.super }} <div class="row mt-4">
<div class="col-xl-4">
<div class="card bg-light mb-3">
<h3 class="card-header text-center">
{{ title }}
</h3>
<div class="card-body">
{% crispy form %}
</div>
</div>
</div>
<div class="col-xl-8">
<div class="card bg-light">
<div id="table"> <div id="table">
{% render_table table %} {% render_table table %}
</div> </div>
</div>
</div>
</div>
{% endblock %} {% endblock %}
{% block extrajavascript %} {% block extrajavascript %}
<script> <script>
function refreshHistory() { function refreshHistory() {
$("#history_list").load("{% url 'note:transactions' pk=object.pk %} #history_list"); $("#history_list").load("{% url 'note:transactions' pk=object.pk %} #history_list");
$("#profile_infos").load("{% url 'note:transactions' pk=object.pk %} #profile_infos"); $("#profile_infos").load("{% url 'note:transactions' pk=object.pk %} #profile_infos");
@ -40,7 +42,7 @@
let filters = ""; let filters = "";
filters += "source=" + $("#id_source_pk").val(); filters += "source=" + $("#id_source_pk").val();
filters += "&destination=" + $("#id_destination_pk").val(); filters += "&destination=" + $("#id_destination_pk").val();
filters += $("input[name='type']:checked").map(function() { filters += $("input[name='type']:checked").map(function () {
return "&type=" + $(this).val(); return "&type=" + $(this).val();
}).toArray().join(""); }).toArray().join("");
filters += "&reason=" + $("#id_reason").val(); filters += "&reason=" + $("#id_reason").val();
@ -57,9 +59,9 @@
refreshFilters(); refreshFilters();
} }
$(document).ready(function() { $(document).ready(function () {
$("input").change(refreshFilters); $("input").change(refreshFilters);
$("input").keyup(refreshFilters); $("input").keyup(refreshFilters);
}); });
</script> </script>
{% endblock %} {% endblock %}

View File

@ -1,8 +1,5 @@
{% extends "wei/base.html" %} {% extends "wei/base.html" %}
{# Use a fluid-width container #}
{% block containertype %}container-fluid{% endblock %}
{% block profile_info %} {% block profile_info %}
{% include "wei/weiclub_info.html" %} {% include "wei/weiclub_info.html" %}
{% endblock %} {% endblock %}

View File

@ -21,7 +21,7 @@ class AmountInput(NumberInput):
class Autocomplete(TextInput): class Autocomplete(TextInput):
template_name = "member/autocomplete_model.html" template_name = "autocomplete_model.html"
def __init__(self, model, resetable=False, attrs=None): def __init__(self, model, resetable=False, attrs=None):
super().__init__(attrs) super().__init__(attrs)