]> git.openstreetmap.org Git - rails.git/commitdiff
Do not display two coordinates on 'where am I' click
authorIlya Zverev <zverik@textual.ru>
Mon, 3 Sep 2018 09:05:25 +0000 (12:05 +0300)
committerTom Hughes <tom@compton.nu>
Mon, 3 Sep 2018 16:46:26 +0000 (17:46 +0100)
Closes #1968

app/assets/javascripts/index/contextmenu.js
app/assets/javascripts/index/search.js
app/controllers/geocoder_controller.rb

index 1ee703e604579d01444a880ec12d7e5f26dcc9be..080a4de72b14691b5328a8b12976f061901b23db 100644 (file)
@@ -49,7 +49,7 @@ OSM.initializeContextMenu = function (map) {
           lat = latlng.lat.toFixed(precision),
           lng = latlng.lng.toFixed(precision);
 
-      OSM.router.route("/search?query=" + encodeURIComponent(lat + "," + lng));
+      OSM.router.route("/search?whereami=1&query=" + encodeURIComponent(lat + "," + lng));
     }
   });
 
index 52af38c54f338b1d76290f8195108d48a0cf5de9..ea6140e582db78dea993eccdbde6eb1659124bb9 100644 (file)
@@ -34,7 +34,7 @@ OSM.Search = function(map) {
     e.preventDefault();
     var center = map.getCenter().wrap(),
       precision = OSM.zoomPrecision(map.getZoom());
-    OSM.router.route("/search?query=" + encodeURIComponent(
+    OSM.router.route("/search?whereami=1&query=" + encodeURIComponent(
       center.lat.toFixed(precision) + "," + center.lng.toFixed(precision)
     ));
   });
index d92da72b1d71b4159c66748124fd1c8a841bf425..da5245687f73db3fb97871fac05a47876420f017 100644 (file)
@@ -305,7 +305,9 @@ class GeocoderController < ApplicationController
         params.merge!(dms_to_decdeg(latlon)).delete(:query)
 
       elsif latlon = query.match(/^\s*([+-]?\d+(\.\d*)?)\s*[\s,]\s*([+-]?\d+(\.\d*)?)\s*$/)
-        params.merge!(:lat => latlon[1].to_f, :lon => latlon[3].to_f, :latlon_digits => true).delete(:query)
+        params.merge!(:lat => latlon[1].to_f, :lon => latlon[3].to_f).delete(:query)
+
+        params[:latlon_digits] = true unless params[:whereami]
       end
     end