Display the search results in a modal

This commit is contained in:
Yohann D'ANELLO 2020-10-15 16:03:08 +02:00
parent 980b2c9d8e
commit f1e5b63b75
4 changed files with 139 additions and 100 deletions

View File

@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: Corres2math\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2020-10-11 18:43+0200\n"
"POT-Creation-Date: 2020-10-15 16:01+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,7 +30,7 @@ msgid "This task failed successfully."
msgstr "Cette tâche a échoué avec succès."
#: apps/eastereggs/templates/eastereggs/xp_modal.html:16
#: templates/base_modal.html:16
#: templates/base_modal.html:18
msgid "Close"
msgstr "Fermer"
@ -38,7 +38,7 @@ msgstr "Fermer"
msgid "Logs"
msgstr "Logs"
#: apps/logs/models.py:22 apps/registration/models.py:16
#: apps/logs/models.py:22 apps/registration/models.py:17
msgid "user"
msgstr "utilisateur"
@ -99,7 +99,7 @@ msgstr "changelogs"
msgid "Changelog of type \"{action}\" for model {model} at {timestamp}"
msgstr "Changelog de type \"{action}\" pour le modèle {model} le {timestamp}"
#: apps/participation/forms.py:14 apps/participation/models.py:23
#: apps/participation/forms.py:14 apps/participation/models.py:24
msgid "The trigram must be composed of three uppercase letters."
msgstr "Le trigramme doit être composé de trois lettres majuscules."
@ -115,27 +115,27 @@ msgstr "Je m'engage à participer à l'intégralité des Correspondances."
msgid "Message to address to the team:"
msgstr "Message à adresser à l'équipe :"
#: apps/participation/models.py:16
#: apps/participation/models.py:17
msgid "name"
msgstr "nom"
#: apps/participation/models.py:22
#: apps/participation/models.py:23
msgid "trigram"
msgstr "trigramme"
#: apps/participation/models.py:30
#: apps/participation/models.py:31
msgid "access code"
msgstr "code d'accès"
#: apps/participation/models.py:31
#: apps/participation/models.py:32
msgid "The access code let other people to join the team."
msgstr "Le code d'accès permet aux autres participants de rejoindre l'équipe."
#: apps/participation/models.py:35
#: apps/participation/models.py:36
msgid "Grant Animath to publish my video"
msgstr "Autoriser Animath à publier ma vidéo"
#: apps/participation/models.py:36
#: apps/participation/models.py:37
msgid ""
"Give the authorisation to publish the video on the main website to promote "
"the action."
@ -143,90 +143,90 @@ msgstr ""
"Donner l'autorisation de publier la vidéo sur le site principal pour "
"promouvoir les Correspondances."
#: apps/participation/models.py:60
#: apps/participation/models.py:64
#, python-brace-format
msgid "Team {name} ({trigram})"
msgstr "Équipe {name} ({trigram})"
#: apps/participation/models.py:63 apps/participation/models.py:74
#: apps/registration/models.py:85 apps/registration/models.py:130
#: apps/participation/models.py:67 apps/participation/models.py:78
#: apps/registration/models.py:89 apps/registration/models.py:134
msgid "team"
msgstr "équipe"
#: apps/participation/models.py:64
#: apps/participation/models.py:68
msgid "teams"
msgstr "équipes"
#: apps/participation/models.py:78
#: apps/participation/models.py:82
#, python-brace-format
msgid "Problem #{problem:d}"
msgstr "Problème n°{problem:d}"
#: apps/participation/models.py:81
#: apps/participation/models.py:85
msgid "problem number"
msgstr "numéro de problème"
#: apps/participation/models.py:87 apps/participation/models.py:135
#: apps/participation/models.py:91 apps/participation/models.py:142
msgid "valid"
msgstr "valide"
#: apps/participation/models.py:88 apps/participation/models.py:136
#: apps/participation/models.py:92 apps/participation/models.py:143
msgid "The video got the validation of the administrators."
msgstr "La vidéo a été validée par les administrateurs."
#: apps/participation/models.py:97
#: apps/participation/models.py:101
msgid "solution video"
msgstr "vidéo de solution"
#: apps/participation/models.py:106
#: apps/participation/models.py:110
msgid "received participation"
msgstr "participation reçue"
#: apps/participation/models.py:115
#: apps/participation/models.py:119
msgid "synthesis video"
msgstr "vidéo de synthèse"
#: apps/participation/models.py:119
#: apps/participation/models.py:126
#, python-brace-format
msgid "Participation of the team {name} ({trigram})"
msgstr "Participation de l'équipe {name} ({trigram})"
#: apps/participation/models.py:122
#: apps/participation/models.py:129
msgid "participation"
msgstr "participation"
#: apps/participation/models.py:123
#: apps/participation/models.py:130
msgid "participations"
msgstr "participations"
#: apps/participation/models.py:128
#: apps/participation/models.py:135
msgid "link"
msgstr "lien"
#: apps/participation/models.py:129
#: apps/participation/models.py:136
msgid "The full video link."
msgstr "Le lien complet de la vidéo."
#: apps/participation/models.py:158
#: apps/participation/models.py:165
#, python-brace-format
msgid "Video of team {name} ({trigram})"
msgstr "Vidéo de l'équipe {name} ({trigram})"
#: apps/participation/models.py:162
#: apps/participation/models.py:169
msgid "video"
msgstr "vidéo"
#: apps/participation/models.py:163
#: apps/participation/models.py:170
msgid "videos"
msgstr "vidéos"
#: apps/participation/templates/participation/create_team.html:11
#: templates/base.html:207
#: templates/base.html:220
msgid "Create"
msgstr "Créer"
#: apps/participation/templates/participation/join_team.html:11
#: templates/base.html:203
#: templates/base.html:216
msgid "Join"
msgstr "Rejoindre"
@ -370,65 +370,65 @@ msgstr "Invalider"
msgid "Update team"
msgstr "Modifier l'équipe"
#: apps/participation/views.py:25 templates/base.html:70
#: templates/base.html:206
#: apps/participation/views.py:28 templates/base.html:70
#: templates/base.html:219
msgid "Create team"
msgstr "Créer une équipe"
#: apps/participation/views.py:32 apps/participation/views.py:62
#: apps/participation/views.py:35 apps/participation/views.py:65
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."
#: apps/participation/views.py:34 apps/participation/views.py:64
#: apps/participation/views.py:37 apps/participation/views.py:67
msgid "You are already in a team."
msgstr "Vous êtes déjà dans une équipe."
#: apps/participation/views.py:55 templates/base.html:75
#: templates/base.html:202
#: apps/participation/views.py:58 templates/base.html:75
#: templates/base.html:215
msgid "Join team"
msgstr "Rejoindre une équipe"
#: apps/participation/views.py:90 apps/participation/views.py:232
#: apps/participation/views.py:93 apps/participation/views.py:247
msgid "You are not in a team."
msgstr "Vous n'êtes pas dans une équipe."
#: apps/participation/views.py:91 apps/participation/views.py:233
#: apps/participation/views.py:94 apps/participation/views.py:248
msgid "You don't participate, so you don't have any team."
msgstr "Vous ne participez pas, vous n'avez donc pas d'équipe."
#: apps/participation/views.py:130
#: apps/participation/views.py:133
msgid "You don't participate, so you can't request the validation of the team."
msgstr ""
"Vous ne participez pas, vous ne pouvez pas demander la validation de "
"l'équipe."
#: apps/participation/views.py:133
#: apps/participation/views.py:136
msgid "The validation of the team is already done or pending."
msgstr "La validation de l'équipe est déjà faite ou en cours."
#: apps/participation/views.py:146
#: apps/participation/views.py:149
msgid "You are not an administrator."
msgstr "Vous n'êtes pas administrateur."
#: apps/participation/views.py:149
#: apps/participation/views.py:152
msgid "This team has no pending validation."
msgstr "L'équipe n'a pas de validation en attente."
#: apps/participation/views.py:159
#: apps/participation/views.py:174
msgid "You must specify if you validate the registration or not."
msgstr "Vous devez spécifier si vous validez l'inscription ou non."
#: apps/participation/views.py:216 apps/registration/views.py:213
#: apps/participation/views.py:231 apps/registration/views.py:213
#, python-brace-format
msgid "Photo authorization of {student}.{ext}"
msgstr "Autorisation de droit à l'image de {student}.{ext}"
#: apps/participation/views.py:220
#: apps/participation/views.py:235
#, python-brace-format
msgid "Photo authorizations of team {trigram}.zip"
msgstr "Autorisations de droit à l'image de l'équipe {trigram}.zip"
#: apps/participation/views.py:242
#: apps/participation/views.py:257
msgid "The team is not validated yet."
msgstr "L'équipe n'est pas encore validée."
@ -440,7 +440,7 @@ msgstr "rôle"
msgid "participant"
msgstr "participant"
#: apps/registration/forms.py:16 apps/registration/models.py:139
#: apps/registration/forms.py:16 apps/registration/models.py:143
msgid "coach"
msgstr "encadrant"
@ -448,88 +448,88 @@ msgstr "encadrant"
msgid "The uploaded file must be a PDF, PNG of JPEG file."
msgstr "Le fichier envoyé doit être au format PDF, PNG ou JPEG."
#: apps/registration/models.py:21
#: 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:26
#: apps/registration/models.py:27
msgid "email confirmed"
msgstr "email confirmé"
#: apps/registration/models.py:30
#: apps/registration/models.py:31
msgid "Activate your Correspondances account"
msgstr "Activez votre compte des Correspondances"
#: apps/registration/models.py:70
#: apps/registration/models.py:74
msgid "registration"
msgstr "inscription"
#: apps/registration/models.py:71
#: apps/registration/models.py:75
msgid "registrations"
msgstr "inscriptions"
#: apps/registration/models.py:90
#: apps/registration/models.py:94
msgid "12th grade"
msgstr "Terminale"
#: apps/registration/models.py:91
#: apps/registration/models.py:95
msgid "11th grade"
msgstr "Première"
#: apps/registration/models.py:92
#: apps/registration/models.py:96
msgid "10th grade or lower"
msgstr "Seconde ou inférieur"
#: apps/registration/models.py:94
#: apps/registration/models.py:98
msgid "student class"
msgstr "classe"
#: apps/registration/models.py:99
#: apps/registration/models.py:103
msgid "school"
msgstr "école"
#: apps/registration/models.py:103
#: apps/registration/models.py:107
msgid "photo authorization"
msgstr "autorisation de droit à l'image"
#: apps/registration/models.py:111
#: apps/registration/models.py:115
msgid "student"
msgstr "étudiant"
#: apps/registration/models.py:119
#: apps/registration/models.py:123
msgid "student registration"
msgstr "inscription d'élève"
#: apps/registration/models.py:120
#: apps/registration/models.py:124
msgid "student registrations"
msgstr "inscriptions d'élève"
#: apps/registration/models.py:134
#: apps/registration/models.py:138
msgid "professional activity"
msgstr "activité professionnelle"
#: apps/registration/models.py:147
#: apps/registration/models.py:151
msgid "coach registration"
msgstr "inscription d'encadrant"
#: apps/registration/models.py:148
#: apps/registration/models.py:152
msgid "coach registrations"
msgstr "inscriptions d'encadrants"
#: apps/registration/models.py:153
#: apps/registration/models.py:157
msgid "role of the administrator"
msgstr "rôle de l'administrateur"
#: apps/registration/models.py:158
#: apps/registration/models.py:162
msgid "admin"
msgstr "admin"
#: apps/registration/models.py:166
#: apps/registration/models.py:170
msgid "admin registration"
msgstr "inscription d'administrateur"
#: apps/registration/models.py:167
#: apps/registration/models.py:171
msgid "admin registrations"
msgstr "inscriptions d'administrateur"
@ -617,7 +617,7 @@ 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:113 templates/base.html:197 templates/base.html:198
#: templates/base.html:123 templates/base.html:210 templates/base.html:211
#: templates/registration/login.html:7 templates/registration/login.html:8
#: templates/registration/login.html:25
msgid "Log in"
@ -772,11 +772,11 @@ msgstr "Mail de confirmation de l'adresse mail envoyé"
msgid "Resend email validation link"
msgstr "Renvoyé le lien de validation de l'adresse mail"
#: corres2math/settings.py:150
#: corres2math/settings.py:151
msgid "English"
msgstr "Anglais"
#: corres2math/settings.py:151
#: corres2math/settings.py:152
msgid "French"
msgstr "Français"
@ -853,23 +853,27 @@ msgstr "Faire un don"
msgid "Administration"
msgstr "Administration"
#: templates/base.html:104
#: templates/base.html:105
msgid "Search..."
msgstr "Chercher ..."
#: templates/base.html:114
msgid "Return to admin view"
msgstr "Retourner à l'interface administrateur"
#: templates/base.html:109
#: templates/base.html:119
msgid "Register"
msgstr "S'inscrire"
#: templates/base.html:125
#: templates/base.html:135
msgid "My account"
msgstr "Mon compte"
#: templates/base.html:128
#: templates/base.html:138
msgid "Log out"
msgstr "Déconnexion"
#: templates/base.html:144
#: templates/base.html:154
#, python-format
msgid ""
"Your email address is not validated. Please click on the link you received "
@ -880,10 +884,14 @@ msgstr ""
"avez reçu par mail. Vous pouvez renvoyer un mail en cliquant sur <a href="
"\"%(send_email_url)s\">ce lien</a>."
#: templates/base.html:167
#: templates/base.html:177
msgid "Contact us"
msgstr "Nous contacter"
#: templates/base.html:208
msgid "Search results"
msgstr "Résultats de la recherche"
#: templates/registration/logged_out.html:8
msgid "Thanks for spending some quality time with the Web site today."
msgstr "Merci d'avoir utilisé la plateforme des Correspondances."
@ -904,3 +912,11 @@ msgstr ""
#: templates/registration/login.html:23
msgid "Forgotten your password or username?"
msgstr "Mot de passe oublié ?"
#: templates/search/search.html:6 templates/search/search.html:11
msgid "Search"
msgstr "Chercher"
#: templates/search/search.html:16
msgid "Results"
msgstr "Résultats"

View File

@ -100,11 +100,11 @@
</ul>
<ul class="navbar-nav ml-auto">
{% if user.registration.is_admin %}
<form class="navbar-form" action="{% url "haystack_search" %}" role="search">
<form class="navbar-form" role="search" onsubmit="event.preventDefault()">
<div class="input-group">
<input type="text" class="form-control" placeholder="Rechercher" name="q" id="search-term" value="{{ request.GET.q }}">
<input type="text" class="form-control" placeholder="{% trans "Search..." %}" name="q" id="search-term" value="{{ request.GET.q }}">
<div class="input-group-btn">
<button class="btn btn-default" type="submit"><i class="fa fa-search"></i></button>
<button class="btn btn-default" data-toggle="modal" data-target="#searchModal"><i class="fa fa-search"></i></button>
</div>
</div>
</form>
@ -204,6 +204,9 @@
</div>
</footer>
{% trans "Search results" as modal_title %}
{% include "base_modal.html" with modal_id="search" modal_form_method="get" modal_additional_class="modal-lg" %}
{% trans "Log in" as modal_title %}
{% trans "Log in" as modal_button %}
{% url "login" as modal_action %}
@ -224,6 +227,11 @@
$(".invalid-feedback").addClass("d-block");
$(document).ready(function () {
$('button[data-target="#searchModal"]').click(function() {
let modalBody = $("#searchModal div.modal-body");
let q = $("#search-term").val();
modalBody.load("{% url "haystack_search" %}?q=" + q + " #search-results");
});
$('a[data-target="#loginModal"]').click(function() {
let modalBody = $("#loginModal div.modal-body");
if (!modalBody.html().trim())

View File

@ -1,8 +1,8 @@
{% load i18n %}
<div id="{{ modal_id }}Modal" class="modal fade" tabindex="-1" role="dialog">
<div class="modal-dialog" role="document">
<form method="post" action="{{ modal_action }}" enctype="{{ modal_enctype|default:"application/x-www-form-urlencoded" }}">
<div class="modal-dialog {{ modal_additional_class }}" role="document">
<form method="{{ modal_form_method|default:"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">{{ modal_title }}</h5>
@ -12,7 +12,9 @@
</div>
<div class="modal-body">{{ modal_content }}</div>
<div class="modal-footer">
<button type="submit" class="btn btn-{{ modal_button_type|default:"primary" }}">{{ modal_button }}</button>
{% if modal_button %}
<button type="submit" class="btn btn-{{ modal_button_type|default:"primary" }}">{{ modal_button }}</button>
{% endif %}
<button type="button" class="btn btn-secondary" data-dismiss="modal">{% trans "Close" %}</button>
</div>
</div>

View File

@ -1,22 +1,35 @@
{% extends 'base.html' %}
{% load crispy_forms_filters %}
{% load crispy_forms_filters i18n %}
{% block content %}
<h3>Results</h3>
<h2>{% trans "Search" %}</h2>
{% for result in page.object_list %}
<p>
<a href="{{ result.object.get_absolute_url }}">{{ result.object }}</a>
</p>
{% empty %}
<p>No results found.</p>
{% endfor %}
<form>
{% csrf_token %}
{{ form|crispy }}
<button type="submit" class="btn btn-primary">{% trans "Search" %}</button>
</form>
{% if page.has_previous or page.has_next %}
<div>
{% if page.has_previous %}<a href="?q={{ query }}&amp;page={{ page.previous_page_number }}">{% endif %}&laquo; Previous{% if page.has_previous %}</a>{% endif %}
|
{% if page.has_next %}<a href="?q={{ query }}&amp;page={{ page.next_page_number }}">{% endif %}Next &raquo;{% if page.has_next %}</a>{% endif %}
</div>
{% endif %}
<hr>
<h3>{% trans "Results" %}</h3>
<div id="search-results">
{% for result in page.object_list %}
<p>
<a href="{{ result.object.get_absolute_url }}">{{ result.object }}</a>
</p>
{% empty %}
<p>No results found.</p>
{% endfor %}
{% if page.has_previous or page.has_next %}
<div>
{% if page.has_previous %}<a href="?q={{ query }}&amp;page={{ page.previous_page_number }}">{% endif %}&laquo; Previous{% if page.has_previous %}</a>{% endif %}
|
{% if page.has_next %}<a href="?q={{ query }}&amp;page={{ page.next_page_number }}">{% endif %}Next &raquo;{% if page.has_next %}</a>{% endif %}
</div>
{% endif %}
</div>
{% endblock %}