1
0
mirror of https://gitlab.crans.org/bde/nk20 synced 2024-11-26 18:37:12 +00:00

Member templates inherit from member/base.html

This commit is contained in:
Alexandre Iooss 2020-08-25 15:39:57 +02:00
parent 63dc184ce4
commit 2e659c63cd
20 changed files with 192 additions and 203 deletions

View File

@ -4,10 +4,6 @@
{% load i18n %} {% load i18n %}
{% load pretty_money %} {% load pretty_money %}
{% block profile_info %}
{% include "member/club_info.html" %}
{% endblock %}
{% block profile_content %} {% block profile_content %}
{% if additional_fee_renewal %} {% if additional_fee_renewal %}
<div class="alert alert-warning"> <div class="alert alert-warning">

View File

@ -11,24 +11,39 @@ 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" %} {% if user_object %}
{% include "member/includes/profile_info.html" %}
{% elif club %}
{% include "member/includes/club_info.html" %}
{% elif note.club.weiclub %}
{% with club=note.club.weiclub %}
{% include "wei/weiclub_info.html" %}
{% endwith %}
{% elif note.club %}
{% with club=note.club %}
{% include "member/includes/club_info.html" %}
{% endwith %}
{% elif note.user %}
{% with user_object=note.user %}
{% include "member/includes/profile_info.html" %}
{% endwith %}
{% endif %}
{% endblock %} {% endblock %}
</div> </div>
<div class="col-xl-8"> <div class="col-xl-8">
{% block profile_content %} {% block profile_content %}
{% include "member/profile_tables.html" %}
{% endblock %} {% 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,4 @@
{% extends "member/club_detail.html" %} {% extends "member/base.html" %}
{% load static django_tables2 i18n %} {% load static django_tables2 i18n %}
{% block profile_content %} {% block profile_content %}

View File

@ -1,11 +1,47 @@
{% extends "member/base.html" %} {% extends "member/base.html" %}
{% load render_table from django_tables2 %}
{% block profile_info %} {% load i18n perms %}
{% include "member/club_info.html" %}
{% endblock %}
{% 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

@ -2,10 +2,6 @@
{% 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 ..."> <input id="searchbar" type="text" class="form-control" placeholder="Nom/prénom/note ...">
<div class="form-group"> <div class="form-group">

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

@ -1,5 +1,5 @@
{% extends "base.html" %} {% extends "member/base.html" %}
{% load i18n static pretty_money django_tables2 %} {% load i18n %}
{% block content %} {% block content %}
<div class="alert alert-info"> <div class="alert alert-info">

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 () {
@ -91,5 +101,5 @@
}); });
}); });
</script> </script>
{% endblock %} {% endblock %}

View File

@ -1,4 +1,4 @@
{% extends "member/profile_detail.html" %} {% extends "member/base.html" %}
{% load static django_tables2 i18n %} {% load static django_tables2 i18n %}
{% block profile_content %} {% block profile_content %}

View File

@ -1,4 +1,40 @@
{% extends "member/base.html" %} {% extends "member/base.html" %}
{% 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">
<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>
{% endblock %}
{% block extrajavascript %} {% block extrajavascript %}
<script> <script>

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 %} {% 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 %}
{% 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

@ -2,22 +2,6 @@
{% load render_table from django_tables2 %} {% load render_table from django_tables2 %}
{% load crispy_forms_tags %} {% load crispy_forms_tags %}
{% block profile_info %}
{% if note.club.weiclub %}
{% 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 %} {% block profile_content %}
{% crispy form %} {% crispy form %}
{% 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)