diff options
Diffstat (limited to 'chimere/static')
| -rw-r--r-- | chimere/static/chimere/css/forms.css | 3 | ||||
| -rw-r--r-- | chimere/static/chimere/js/importer_interface.js | 70 |
2 files changed, 47 insertions, 26 deletions
diff --git a/chimere/static/chimere/css/forms.css b/chimere/static/chimere/css/forms.css index 0a22e74..a931092 100644 --- a/chimere/static/chimere/css/forms.css +++ b/chimere/static/chimere/css/forms.css @@ -155,8 +155,7 @@ div.bottomform{ } .form-row.field-route, -.form-row.field-point, -.form-row.field-filtr.field-map{ +.form-row.field-point{ float:right; width:50%; } diff --git a/chimere/static/chimere/js/importer_interface.js b/chimere/static/chimere/js/importer_interface.js index 9cc1f3c..a423411 100644 --- a/chimere/static/chimere/js/importer_interface.js +++ b/chimere/static/chimere/js/importer_interface.js @@ -1,8 +1,26 @@ +var init_widget_list = []; + django.jQuery(function($) { + var labels = { + OSM: { + "source": "Expression Overpass :" + } + }; + var helps = { + OSM: { + "source": "Une seule expression est permise. Par exemple : node[\"railway\"=\"station\"](41.55,1,42,1.2)", + "filtr": "Les propriétés OSM peuvent être associées à des attributs" + + "en définissant le dictionnaire adéquat. (cf. documentation)" + } + }; + var default_label = {}; + var default_help = {}; var importer_form_filter = { - OSM:new Array('field-filtr', 'field-default_name', 'field-categories', - 'field-source', 'field-overwrite', - 'field-automatic_update', 'field-default_status'), + OSM:new Array('field-source', 'field-source_file', 'field-default_name', + 'field-filtr', 'field-zipped', 'field-origin', + 'field-license', 'field-categories', 'field-overwrite', + 'field-get_description', 'field-automatic_update', + 'field-default_status', 'field-default_localisation'), KML:new Array('field-source', 'field-source_file', 'field-default_name', 'field-filtr', 'field-zipped', 'field-origin', 'field-license', 'field-categories', 'field-overwrite', @@ -61,22 +79,9 @@ django.jQuery(function($) { } else { $('.help-kml').hide(); } - if (importer_val == 'OSM'){ - $('.form-row.field-filtr').addClass('field-map'); - $('#map_edit_area').show(); - if(!$('#id_source').val()){ - $('#id_source').val(default_xapi); - } - $('#id_filtr').attr('readonly', true); - $('.help-osm').show(); - $('.input-osm').show(); - if (!osm_map_initialized){ - init_map_form(); - osm_map_initialized = true; - } - } - else if (importer_val == 'XSLT' || importer_val == 'XXLT' - || importer_val == 'JSON' || importer_val == 'ICAL'){ + if (importer_val == 'XSLT' || importer_val == 'XXLT' + || importer_val == 'JSON' || importer_val == 'ICAL' || + importer_val == 'OSM'){ $('#importerkeycategories_set-group').show(); $('#key_categories-group').show(); $('#importerkeycategories_set-group .form-row').show(); @@ -84,8 +89,6 @@ django.jQuery(function($) { $('.form-row.field-filtr').addClass('field-map'); $('#map_edit').show(); $('#map_edit_area').hide(); - $('.help-osm').hide(); - $('.input-osm').hide(); if (!edit_map_initialized){ init_map_edit(); edit_map_initialized = true; @@ -95,9 +98,28 @@ django.jQuery(function($) { $('#id_filtr').attr('readonly', false); $('#map_edit_area').hide(); $('#map_edit').hide(); - $('.help-osm').hide(); - $('.input-osm').hide(); - if($('#id_source').val() == default_xapi) $('#id_source').val(''); + } + for (key in default_label){ // restore default label + $(".field-" + key + " label").html(default_label[key]); + } + if (importer_val in labels){ + for (key in labels[importer_val]){ + if (!(key in default_label)){ + default_label[key] = $(".field-" + key + " label").html(); + } + $(".field-" + key + " label").html(labels[importer_val][key]); + } + } + for (key in default_help){ // restore default help + $(".field-" + key + " .help").html(default_help[key]); + } + if (importer_val in helps){ + for (key in helps[importer_val]){ + if (!(key in default_help)){ + default_help[key] = $(".field-" + key + " .help").html(); + } + $(".field-" + key + " .help").html(helps[importer_val][key]); + } } refresh_default_desc(); } |
