diff --git a/src/agenda_culturel/static/js/modal.js b/src/agenda_culturel/static/js/modal.js index 2837481..7122530 100644 --- a/src/agenda_culturel/static/js/modal.js +++ b/src/agenda_culturel/static/js/modal.js @@ -1,8 +1,16 @@ let visibleModal = null; +var escapeOk = true; + +const toggleModalNoEscape = (event) => { + toggleModal(event, true); + escapeOk = false; +} // Toggle modal -const toggleModal = (event) => { - event.preventDefault(); +const toggleModal = (event, avoidPrevent=false) => { + escapeOk = true; + if (!avoidPrevent) + event.preventDefault(); const modal = document.getElementById(event.currentTarget.getAttribute("data-target")); typeof modal != "undefined" && modal != null && isModalOpen(modal) ? closeModal(modal) @@ -28,15 +36,16 @@ const openModal = (modal) => { // Close modal const closeModal = (modal) => { - visibleModal = null; - document.documentElement.style.removeProperty("--scrollbar-width"); - modal.removeAttribute("open"); + if (escapeOk) { + visibleModal = null; + document.documentElement.style.removeProperty("--scrollbar-width"); + modal.removeAttribute("open"); + } }; // Close with a click outside document.addEventListener("click", (event) => { if (visibleModal != null) { - console.log("bordel"); const modalContent = visibleModal.querySelector("article"); const isClickInside = modalContent.contains(event.target); !isClickInside && closeModal(visibleModal); diff --git a/src/agenda_culturel/templates/agenda_culturel/event_form.html b/src/agenda_culturel/templates/agenda_culturel/event_form.html index a7a139a..a44b5ad 100644 --- a/src/agenda_culturel/templates/agenda_culturel/event_form.html +++ b/src/agenda_culturel/templates/agenda_culturel/event_form.html @@ -18,7 +18,11 @@ {% load static_content_extra %} +{% if object %}

Édition de l'événement {{ object.title }} ({{ object.start_day }})

+{% else %} +

Édition de l'événement importé

+{% endif %}
{% csrf_token %} {{ form.media }} diff --git a/src/agenda_culturel/templates/agenda_culturel/import.html b/src/agenda_culturel/templates/agenda_culturel/import.html index 5dbcce5..194f74a 100644 --- a/src/agenda_culturel/templates/agenda_culturel/import.html +++ b/src/agenda_culturel/templates/agenda_culturel/import.html @@ -14,6 +14,8 @@ + + {% endblock %} @@ -36,10 +38,14 @@ {% csrf_token %} {{ form.media }} {{ form.as_p }} - +
- + +
+ Veuillez patienter, lien en cours d'importation... +
+

Ajout manuel