summaryrefslogtreecommitdiff
path: root/templates/chimere/edit.html
diff options
context:
space:
mode:
Diffstat (limited to 'templates/chimere/edit.html')
-rw-r--r--templates/chimere/edit.html75
1 files changed, 70 insertions, 5 deletions
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 %}<div class='warning'><p>{% trans "You are logged as an administrator. Your modifications will be taking into account immediately." %}</p></div>{% endif %}
<div class='edit'>
{% block legend %}{% endblock %}
- <form enctype="multipart/form-data" method='post' action='.'>
+ <form enctype="multipart/form-data" method='post' action='{% url "editmarker" %}' id='proposition_form'>
{% csrf_token %}
<p>* {% trans "indicates a mandatory field" %}</p>
@@ -140,10 +140,75 @@
$('#upload_in_progress .modal-body').html(upload);
$('#upload_in_progress').modal("show");
}
+ var success_msg = "<h3>Merci pour votre contribution au projet !</h3>";
+ success_msg += "<p>Votre proposition va être examinée par un modérateur et être validée dans les jours à venir.</p>"
+ $(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<validation.length ;idx++){
+ var input_id = validation[idx];
+ var val = jQuery('#'+input_id).val();
+ if (!val || val == '0' ||
+ (input_id == 'id_submiter_email' &&
+ !isValidEmailAddress(val))){
+ jQuery('#'+input_id).parent().addClass('warning');
+ jQuery('#'+input_id).parent().addClass('error');
+ validated = false;
+ } else {
+ jQuery('#'+input_id).parent().removeClass('warning');
+ jQuery('#'+input_id).parent().removeClass('error');
+ }
+ }
+ if (!validated){
+ alert("{%trans "There are missing/erroneous fields."%}");
+ return false;
+ }
+ $("#proposition_form").ajaxForm();
+ displayProgress();
+ $("#proposition_form").ajaxSubmit({
+ success:function(msg){
+ $('#upload_in_progress').modal("hide");
+ $("#modal-edit").modal("hide");
+ $("#modal-default-message .modal-body").html(success_msg);
+ $('#modal-default-message').modal("show");
+ }
+ });
+ return false;
+ });
+ });
</script>
-
- {% comment %}
- <p><input type='submit' onclick='saveExtent();displayProgress();' value="{% trans 'Propose'%}"/></p>
- {% endcomment %}
</form>
</div>