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

Display the calendar in a modal for non-admin users

This commit is contained in:
Yohann D'ANELLO 2020-10-20 14:35:04 +02:00
parent 9571cfc19d
commit 1d0246af8f
4 changed files with 20 additions and 7 deletions

View File

@ -23,7 +23,7 @@ def register_phases(apps, schema_editor):
)
Phase.objects.get_or_create(
phase_number=4,
description="Soumission de la vidéo de synthèse de l'échange",
description="Synthèse de l'échange",
)

View File

@ -11,11 +11,13 @@
{% endblock %}
{% block content %}
{% render_table table %}
<div id="form-content">
{% render_table table %}
{% trans "Update phase" as modal_title %}
{% trans "Update" as modal_button %}
{% include "base_modal.html" with modal_id="updatePhase" %}
{% trans "Update phase" as modal_title %}
{% trans "Update" as modal_button %}
{% include "base_modal.html" with modal_id="updatePhase" %}
</div>
{% endblock %}
{% block extrajavascript %}

View File

@ -236,7 +236,7 @@ msgstr "vidéos"
#: apps/participation/models.py:178
msgid "phase number"
msgstr "numéro de phase"
msgstr "phase"
#: apps/participation/models.py:183
msgid "phase description"

View File

@ -64,7 +64,11 @@
<a href="{% url "index" %}" class="nav-link"><i class="fas fa-home"></i> {% trans "Home" %}</a>
</li>
<li class="nav-item active">
<a href="{% url "participation:calendar" %}" class="nav-link"><i class="fas fa-calendar"></i> {% trans "Calendar" %}</a>
{% if user.registration.is_admin %}
<a href="{% url "participation:calendar" %}" class="nav-link"><i class="fas fa-calendar"></i> {% trans "Calendar" %}</a>
{% else %}
<a href="#" class="nav-link" data-toggle="modal" data-target="#calendarModal"><i class="fas fa-calendar"></i> {% trans "Calendar" %}</a>
{% endif %}
</li>
{% if user.is_authenticated and user.registration.participates %}
{% if not user.registration.team %}
@ -208,6 +212,8 @@
</footer>
{% trans "Calendar" as modal_title %}
{% include "base_modal.html" with modal_id="calendar" modal_additional_class="modal-lg" %}
{% 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 %}
@ -230,6 +236,11 @@
$(".invalid-feedback").addClass("d-block");
$(document).ready(function () {
$('a[data-target="#calendarModal"]').click(function() {
let modalBody = $("#calendarModal div.modal-body");
if (!modalBody.html().trim())
modalBody.load("{% url "participation:calendar" %} #form-content")
});
$('button[data-target="#searchModal"]').click(function() {
let modalBody = $("#searchModal div.modal-body");
let q = encodeURI($("#search-term").val());