From a7091bedbcf32295662a80db71bbcf5d09c88010 Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Wed, 13 Sep 2017 15:54:54 +0200 Subject: Ajax submission of forms --- templates/chimere/blocks/submited.html | 23 ----------- templates/chimere/edit.html | 75 +++++++++++++++++++++++++++++++--- templates/chimere/main_map.html | 8 ---- 3 files changed, 70 insertions(+), 36 deletions(-) diff --git a/templates/chimere/blocks/submited.html b/templates/chimere/blocks/submited.html index b0d2dac..e69de29 100644 --- a/templates/chimere/blocks/submited.html +++ b/templates/chimere/blocks/submited.html @@ -1,23 +0,0 @@ -{% load i18n %} -
-

Merci

-

pour votre contribution au projet !

- -

En proposant un nouvel élément, vous contribuez à enrichir la carte avec des données libres. Une fois validée, votre contribution sera disponible selon les termes de la licence Creative Commons Paternité - Pas d’Utilisation Commerciale 2.0 France. Vous devez être l’auteur des éléments que vous nous faites partager ou bien vous être assuré de l’accord de leur auteur pour cette mise à disposition. Ceci concerne les textes, photos et tout contenu multimedia.

-{% if contact_email %}

N’hésitez pas à nous contacter pour toute question : {{contact_email}}.

{% endif%} -
- diff --git a/templates/chimere/edit.html b/templates/chimere/edit.html index 6795d3f..4b839cf 100644 --- a/templates/chimere/edit.html +++ b/templates/chimere/edit.html @@ -7,7 +7,7 @@ {% if is_modification and is_superuser %}

{% trans "You are logged as an administrator. Your modifications will be taking into account immediately." %}

{% endif %}
{% block legend %}{% endblock %} -
+ {% csrf_token %}

* {% trans "indicates a mandatory field" %}

@@ -140,10 +140,75 @@ $('#upload_in_progress .modal-body').html(upload); $('#upload_in_progress').modal("show"); } + var success_msg = "

Merci pour votre contribution au projet !

"; + success_msg += "

Votre proposition va être examinée par un modérateur et être validée dans les jours à venir.

" + $(function(){ + if (typeof tinyMCE !== 'undefined'){ + tinyMCE.init({ + mode : "textareas", + theme: 'modern', + editor_selector : "mceEditor", + relative_urls : false, + toolbar_items_size: 'small', + menubar: '', + toolbar1: 'bold italic,underline | bullist,numlist', + toolbar2: "", + toolbar3: "" + }); + } + {% comment %} + {% if route %} + var edition_type = 'route'; + {% if itinerary_form %} + $("#chimere_itinerary_form").appendTo($("#itinerary_field")); + $('#main_map').chimere('updateRoutingInput');{% endif%} + {% else %} + var edition_type = 'marker'; + $('#main_map').chimere('updateMarkerInput'); + {% endif %} + {% endcomment %} + $('#modal-edit button.btn-primary').click(function(){ + // JS tests because if a file is submited there is no way + // to refill the form with (browser security issue) + if (typeof tinyMCE !== 'undefined') tinyMCE.triggerSave(); + validation = [{%if route%} + 'id_route'{%else%}'id_point'{% endif %}, + 'id_name', + 'id_categories',{% if event %} + 'id_start_date',{% endif %} + ]; + var validated = true; + for (var idx=0; idx - - {% comment %} -

- {% endcomment %}
diff --git a/templates/chimere/main_map.html b/templates/chimere/main_map.html index 0ea577b..378b5e1 100644 --- a/templates/chimere/main_map.html +++ b/templates/chimere/main_map.html @@ -63,14 +63,6 @@ {% routing %} -
-
{# dynamic content #} -
-
{# dynamic content #} -
-
{# dynamic content #} -
-

REVENIR AUX CATÉGORIES

-- cgit v1.2.3