From bfc5f255441685871f3de56cdede9448288cc7cc Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Thu, 8 Aug 2013 20:16:40 +0200 Subject: Configure Nominatim widget for edit page --- chimere/static/chimere/css/styles.css | 5 +++++ chimere/static/chimere/js/jquery.chimere-ol.js | 12 ++++++++++++ chimere/static/chimere/js/nominatim-widget.js | 7 ++++++- chimere/templates/chimere/blocks/live_coordinates.html | 4 +--- chimere/templates/chimere/blocks/nominatim_widget.html | 6 +++++- chimere/templates/chimere/edit.html | 3 ++- chimere/views.py | 5 +++-- chimere/widgets.py | 5 ++--- 8 files changed, 36 insertions(+), 11 deletions(-) diff --git a/chimere/static/chimere/css/styles.css b/chimere/static/chimere/css/styles.css index 22138ae..0f17640 100644 --- a/chimere/static/chimere/css/styles.css +++ b/chimere/static/chimere/css/styles.css @@ -31,6 +31,7 @@ h2, h3, th, .action li, .action li a, color:#aaa; } +.nominatim-search, #chimere_total_label td.l{ color:#000; } @@ -611,6 +612,10 @@ ul.share li{ font-style:italic; } +.nominatim-search{ + font-style:normal; +} + .simple #panel{ top:5px; bottom:auto; diff --git a/chimere/static/chimere/js/jquery.chimere-ol.js b/chimere/static/chimere/js/jquery.chimere-ol.js index ff07132..98fbb48 100644 --- a/chimere/static/chimere/js/jquery.chimere-ol.js +++ b/chimere/static/chimere/js/jquery.chimere-ol.js @@ -987,6 +987,18 @@ if (typeof(OpenLayers) != 'undefined'){ settings.map.getProjectionObject()); settings.layerVectors.addFeatures(feats); }, + pointInputChange: function(nominatim_id){ + methods.putEditMarker(new OpenLayers.LonLat( + $('#'+nominatim_id+'_lon').val(), + $('#'+nominatim_id+'_lat').val() + ).transform(EPSG_DISPLAY_PROJECTION, + settings.map.getProjectionObject()), false); + var bounds = settings.layerMarkers.getDataExtent(); + if (bounds) { + settings.map.zoomToExtent(bounds); + settings.map.zoomTo(13); + } + }, routingInputChange: function(nominatim_id){ $('#map_menu_clear').show(); switch(nominatim_id){ diff --git a/chimere/static/chimere/js/nominatim-widget.js b/chimere/static/chimere/js/nominatim-widget.js index 99f7034..d61443f 100644 --- a/chimere/static/chimere/js/nominatim-widget.js +++ b/chimere/static/chimere/js/nominatim-widget.js @@ -1,4 +1,5 @@ var default_nominatim_lbl = ''; +var routing = false; var nominatim_widget_options = { source: function (request, response) { $.ajax({ @@ -30,7 +31,11 @@ var nominatim_widget_options = { $('#chimere_'+$(this).attr('id').substring(10)+'_label').html( ui.item.label); $('#'+$(this).attr('id')).val(default_nominatim_lbl); - jQuery("#map").chimere("routingInputChange", $(this).attr('id')); + if (routing){ + jQuery("#"+chimere_init_options['map_id']).chimere("routingInputChange", $(this).attr('id')); + } else { + jQuery("#"+chimere_init_options['map_id']).chimere("pointInputChange", $(this).attr('id')); + } return false; }, open: function() { diff --git a/chimere/templates/chimere/blocks/live_coordinates.html b/chimere/templates/chimere/blocks/live_coordinates.html index 4392dca..3ce34bf 100644 --- a/chimere/templates/chimere/blocks/live_coordinates.html +++ b/chimere/templates/chimere/blocks/live_coordinates.html @@ -15,9 +15,6 @@ if({{default_map}}) chimere_init_options['selected_map_layer'] = {{default_map}}; - - -

@@ -29,6 +26,7 @@

+