1
0
mirror of https://gitlab.com/animath/si/plateforme-corres2math.git synced 2024-12-05 01:26:54 +00:00

Factorize modal templates

This commit is contained in:
Yohann D'ANELLO 2020-09-24 21:43:45 +02:00
parent 471befb1f8
commit e1ca18085a
10 changed files with 86 additions and 155 deletions

View File

@ -1,21 +0,0 @@
{% load i18n %}
<div id="joinTeamModal" class="modal fade" tabindex="-1" role="dialog">
<div class="modal-dialog" role="document">
<form method="post" action="{% url "participation:join_team" %}">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title">{% trans "Join team" %}</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="modal-body"></div>
<div class="modal-footer">
<button type="submit" class="btn btn-primary">{% trans "Join" %}</button>
<button type="button" class="btn btn-secondary" data-dismiss="modal">{% trans "Close" %}</button>
</div>
</div>
</form>
</div>
</div>

View File

@ -38,7 +38,10 @@
</div>
</div>
{% include "participation/update_team_modal.html" %}
{% trans "Update team" as modal_title %}
{% trans "Update" as modal_button %}
{% url "participation:update_team" pk=team.pk as modal_action %}
{% include "base_modal.html" with modal_id="updateTeam" %}
{% endblock %}
{% block extrajavascript %}

View File

@ -1,21 +0,0 @@
{% load i18n %}
<div id="updateTeamModal" class="modal fade" tabindex="-1" role="dialog">
<div class="modal-dialog" role="document">
<form method="post" action="{% url "participation:update_team" pk=team.pk %}">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title">{% trans "Update team" %}</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="modal-body"></div>
<div class="modal-footer">
<button type="submit" class="btn btn-primary">{% trans "Update" %}</button>
<button type="button" class="btn btn-secondary" data-dismiss="modal">{% trans "Close" %}</button>
</div>
</div>
</form>
</div>
</div>

View File

@ -1,21 +0,0 @@
{% load crispy_forms_filters i18n %}
<div id="loginModal" class="modal fade" tabindex="-1" role="dialog">
<div class="modal-dialog" role="document">
<form method="post" action="{% url "login" %}">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title">{% trans "Log in" %}</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="modal-body"></div>
<div class="modal-footer">
<button type="submit" class="btn btn-primary">{% trans "Log in" %}</button>
<button type="button" class="btn btn-secondary" data-dismiss="modal">{% trans "Close" %}</button>
</div>
</div>
</form>
</div>
</div>

View File

@ -1,21 +0,0 @@
{% load i18n %}
<div id="updateUserModal" class="modal fade" tabindex="-1" role="dialog">
<div class="modal-dialog" role="document">
<form method="post" action="{% url "registration:update_user" pk=user.pk %}">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title">{% trans "Update user" %}</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="modal-body"></div>
<div class="modal-footer">
<button type="submit" class="btn btn-primary">{% trans "Update" %}</button>
<button type="button" class="btn btn-secondary" data-dismiss="modal">{% trans "Close" %}</button>
</div>
</div>
</form>
</div>
</div>

View File

@ -44,7 +44,11 @@
</div>
</div>
{% include "registration/update_user_modal.html" %}
{% trans "Update user" as modal_title %}
{% trans "Update" as modal_button %}
{% url "registration:update_user" pk=user_object.pk as modal_action %}
{% include "base_modal.html" with modal_id="updateUser" %}
{% endblock %}
{% block extrajavascript %}

View File

@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: Corres2math\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2020-09-24 18:52+0200\n"
"POT-Creation-Date: 2020-09-24 21:42+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: Yohann D'ANELLO <yohann.danello@animath.fr>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@ -30,11 +30,7 @@ msgid "This task failed successfully."
msgstr "Cette tâche a échoué avec succès."
#: apps/eastereggs/templates/eastereggs/xp_modal.html:16
#: apps/participation/templates/participation/create_team_modal.html:16
#: apps/participation/templates/participation/join_team_modal.html:16
#: apps/participation/templates/participation/update_team_modal.html:16
#: apps/registration/templates/registration/login_modal.html:16
#: apps/registration/templates/registration/update_user_modal.html:16
#: templates/base_modal.html:16
msgid "Close"
msgstr "Fermer"
@ -42,7 +38,7 @@ msgstr "Fermer"
msgid "Logs"
msgstr "Logs"
#: apps/logs/models.py:22 apps/registration/models.py:15
#: apps/logs/models.py:22 apps/registration/models.py:17
msgid "user"
msgstr "utilisateur"
@ -145,7 +141,7 @@ msgid "Team {name} ({trigram})"
msgstr "Équipe {name} ({trigram})"
#: apps/participation/models.py:45 apps/participation/models.py:56
#: apps/registration/models.py:76 apps/registration/models.py:114
#: apps/registration/models.py:78 apps/registration/models.py:123
msgid "team"
msgstr "équipe"
@ -217,25 +213,15 @@ msgid "videos"
msgstr "vidéos"
#: apps/participation/templates/participation/create_team.html:11
#: apps/participation/templates/participation/create_team_modal.html:15
#: templates/base.html:202
msgid "Create"
msgstr "Créer"
#: apps/participation/templates/participation/create_team_modal.html:8
#: apps/participation/views.py:15 templates/base.html:70
msgid "Create team"
msgstr "Créer une équipe"
#: apps/participation/templates/participation/join_team.html:11
#: apps/participation/templates/participation/join_team_modal.html:15
#: templates/base.html:198
msgid "Join"
msgstr "Rejoindre"
#: apps/participation/templates/participation/join_team_modal.html:8
#: apps/participation/views.py:41 templates/base.html:75
msgid "Join team"
msgstr "Rejoindre une équipe"
#: apps/participation/templates/participation/team_detail.html:6
#: apps/registration/templates/registration/user_detail.html:6
msgid "any"
@ -270,18 +256,23 @@ msgid "Grant Animath to publish our video:"
msgstr "Autoriser Animath à publier notre vidéo :"
#: apps/participation/templates/participation/team_detail.html:37
#: apps/participation/templates/participation/team_detail.html:42
#: apps/participation/templates/participation/update_team.html:12
#: apps/participation/templates/participation/update_team_modal.html:15
#: apps/registration/templates/registration/update_user.html:12
#: apps/registration/templates/registration/update_user_modal.html:15
#: apps/registration/templates/registration/user_detail.html:43
#: apps/registration/templates/registration/user_detail.html:49
msgid "Update"
msgstr "Modifier"
#: apps/participation/templates/participation/update_team_modal.html:8
#: apps/participation/templates/participation/team_detail.html:41
msgid "Update team"
msgstr "Modifier l'équipe"
#: apps/participation/views.py:15 templates/base.html:70
#: templates/base.html:201
msgid "Create team"
msgstr "Créer une équipe"
#: apps/participation/views.py:23 apps/participation/views.py:49
msgid "You don't participate, so you can't create a team."
msgstr "Vous ne participez pas, vous ne pouvez pas créer d'équipe."
@ -290,6 +281,11 @@ msgstr "Vous ne participez pas, vous ne pouvez pas créer d'équipe."
msgid "You are already in a team."
msgstr "Vous êtes déjà dans une équipe."
#: apps/participation/views.py:41 templates/base.html:75
#: templates/base.html:197
msgid "Join team"
msgstr "Rejoindre une équipe"
#: apps/participation/views.py:72
msgid "You are not in a team."
msgstr "Vous n'êtes pas dans une équipe."
@ -306,88 +302,92 @@ msgstr "rôle"
msgid "participant"
msgstr "participant"
#: apps/registration/forms.py:14 apps/registration/models.py:123
#: apps/registration/forms.py:14 apps/registration/models.py:132
msgid "coach"
msgstr "encadrant"
#: apps/registration/models.py:20
#: apps/registration/models.py:22
msgid "Grant Animath to contact me in the future about other actions"
msgstr ""
"Autoriser Animath à me recontacter à l'avenir à propos d'autres actions"
#: apps/registration/models.py:25
#: apps/registration/models.py:27
msgid "email confirmed"
msgstr "email confirmé"
#: apps/registration/models.py:29
#: apps/registration/models.py:31
msgid "Activate your Correspondances account"
msgstr "Activez votre compte des Correspondances"
#: apps/registration/models.py:65
#: apps/registration/models.py:67
msgid "registration"
msgstr "inscription"
#: apps/registration/models.py:66
#: apps/registration/models.py:68
msgid "registrations"
msgstr "inscriptions"
#: apps/registration/models.py:81
#: apps/registration/models.py:83
msgid "12th grade"
msgstr "Terminale"
#: apps/registration/models.py:82
#: apps/registration/models.py:84
msgid "11th grade"
msgstr "Première"
#: apps/registration/models.py:83
#: apps/registration/models.py:85
msgid "10th grade or lower"
msgstr "Seconde ou inférieur"
#: apps/registration/models.py:85
#: apps/registration/models.py:87
msgid "student class"
msgstr "classe"
#: apps/registration/models.py:90
#: apps/registration/models.py:92
msgid "school"
msgstr "école"
#: apps/registration/models.py:95
#: apps/registration/models.py:96
msgid "photo authorization"
msgstr ""
#: apps/registration/models.py:104
msgid "student"
msgstr "étudiant"
#: apps/registration/models.py:103
#: apps/registration/models.py:112
msgid "student registration"
msgstr "inscription d'élève"
#: apps/registration/models.py:104
#: apps/registration/models.py:113
msgid "student registrations"
msgstr "inscriptions d'élève"
#: apps/registration/models.py:118
#: apps/registration/models.py:127
msgid "professional activity"
msgstr "activité professionnelle"
#: apps/registration/models.py:131
#: apps/registration/models.py:140
msgid "coach registration"
msgstr "inscription d'encadrant"
#: apps/registration/models.py:132
#: apps/registration/models.py:141
msgid "coach registrations"
msgstr "inscriptions d'encadrants"
#: apps/registration/models.py:137
#: apps/registration/models.py:146
msgid "role of the administrator"
msgstr "rôle de l'administrateur"
#: apps/registration/models.py:142
#: apps/registration/models.py:151
msgid "admin"
msgstr "admin"
#: apps/registration/models.py:150
#: apps/registration/models.py:159
msgid "admin registration"
msgstr "inscription d'administrateur"
#: apps/registration/models.py:151
#: apps/registration/models.py:160
msgid "admin registrations"
msgstr "inscriptions d'administrateur"
@ -427,14 +427,6 @@ msgstr "Merci d'avoir utilisé la plateforme des Correspondances."
msgid "Log in again"
msgstr "Se reconnecter"
#: apps/registration/templates/registration/login_modal.html:8
#: apps/registration/templates/registration/login_modal.html:15
#: apps/registration/templates/registration/password_reset_complete.html:10
#: templates/base.html:108 templates/registration/login.html:7
#: templates/registration/login.html:8 templates/registration/login.html:25
msgid "Log in"
msgstr "Connexion"
#: apps/registration/templates/registration/mails/email_validation_email.html:12
#: apps/registration/templates/registration/mails/email_validation_email.txt:3
msgid "Hi"
@ -490,6 +482,13 @@ msgstr "Changer mon mot de passe"
msgid "Your password has been set. You may go ahead and log in now."
msgstr "Votre mot de passe a été changé. Vous pouvez désormais vous connecter."
#: apps/registration/templates/registration/password_reset_complete.html:10
#: templates/base.html:108 templates/base.html:192 templates/base.html:193
#: templates/registration/login.html:7 templates/registration/login.html:8
#: templates/registration/login.html:25
msgid "Log in"
msgstr "Connexion"
#: apps/registration/templates/registration/password_reset_confirm.html:9
msgid ""
"Please enter your new password twice so we can verify you typed it in "
@ -543,10 +542,6 @@ msgstr "Réinitialiser mon mot de passe"
msgid "Sign up"
msgstr "Inscription"
#: apps/registration/templates/registration/update_user_modal.html:8
msgid "Update user"
msgstr "Modifier l'utilisateur"
#: apps/registration/templates/registration/user_detail.html:14
msgid "Last name:"
msgstr "Nom de famille :"
@ -587,23 +582,27 @@ msgstr "Rôle :"
msgid "Grant Animath to contact me in the future about other actions:"
msgstr "Autorise Animath à recontacter à propos d'autres actions :"
#: apps/registration/views.py:55
#: apps/registration/templates/registration/user_detail.html:48
msgid "Update user"
msgstr "Modifier l'utilisateur"
#: apps/registration/views.py:56
msgid "Email validation"
msgstr "Validation de l'adresse mail"
#: apps/registration/views.py:57
#: apps/registration/views.py:58
msgid "Validate email"
msgstr "Valider l'adresse mail"
#: apps/registration/views.py:96
#: apps/registration/views.py:97
msgid "Email validation unsuccessful"
msgstr "Échec de la validation de l'adresse mail"
#: apps/registration/views.py:107
#: apps/registration/views.py:108
msgid "Email validation email sent"
msgstr "Mail de confirmation de l'adresse mail envoyé"
#: apps/registration/views.py:115
#: apps/registration/views.py:116
msgid "Resend email validation link"
msgstr "Renvoyé le lien de validation de l'adresse mail"

View File

@ -189,10 +189,19 @@
</div>
</footer>
{% include "registration/login_modal.html" %}
{% trans "Log in" as modal_title %}
{% trans "Log in" as modal_button %}
{% url "login" as modal_action %}
{% include "base_modal.html" with modal_id="login" %}
{% if user.is_authenticated %}
{% include "participation/create_team_modal.html" %}
{% include "participation/join_team_modal.html" %}
{% trans "Join team" as modal_title %}
{% trans "Join" as modal_button %}
{% url "participation:join_team" as modal_action %}
{% include "base_modal.html" with modal_id="joinTeam" %}
{% trans "Create team" as modal_title %}
{% trans "Create" as modal_button %}
{% url "participation:create_team" as modal_action %}
{% include "base_modal.html" with modal_id="createTeam" modal_button_type="success" %}
{% endif %}
<script>

View File

@ -1,18 +1,18 @@
{% load i18n %}
<div id="createTeamModal" class="modal fade" tabindex="-1" role="dialog">
<div id="{{ modal_id }}Modal" class="modal fade" tabindex="-1" role="dialog">
<div class="modal-dialog" role="document">
<form method="post" action="{% url "participation:create_team" %}">
<form method="post" action="{{ modal_action }}" enctype="{{ modal_enctype|default:"application/x-www-form-urlencoded" }}">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title">{% trans "Create team" %}</h5>
<h5 class="modal-title">{{ modal_title }}</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="modal-body"></div>
<div class="modal-footer">
<button type="submit" class="btn btn-success">{% trans "Create" %}</button>
<button type="submit" class="btn btn-{{ modal_button_type|default:"primary" }}">{{ modal_button }}</button>
<button type="button" class="btn btn-secondary" data-dismiss="modal">{% trans "Close" %}</button>
</div>
</div>

View File

@ -11,7 +11,7 @@ deps =
-r{toxinidir}/requirements.txt
coverage
commands =
coverage run --omit='*migrations*,apps/scripts*' --source=apps,tfjm ./manage.py test apps/
coverage run --omit='*migrations*,apps/scripts*' --source=apps ./manage.py test apps/
coverage report -m
[testenv:linters]