]> git.openstreetmap.org Git - rails.git/commitdiff
Fix application error on non-feature search results
authorJohn Firebaugh <john.firebaugh@gmail.com>
Mon, 2 Dec 2013 22:08:56 +0000 (14:08 -0800)
committerJohn Firebaugh <john.firebaugh@gmail.com>
Mon, 2 Dec 2013 22:08:56 +0000 (14:08 -0800)
Fixes #560

app/assets/javascripts/index/search.js

index c1c95a3e43aee61ce1698ee2dd3706d82f21e7ae..6b6f3231f2b0f3fca684e3d4a93ecf7931c2d449 100644 (file)
@@ -30,11 +30,16 @@ OSM.Search = function(map) {
       center = L.latLng(data.lat, data.lon);
 
     if (data.minLon && data.minLat && data.maxLon && data.maxLat) {
       center = L.latLng(data.lat, data.lon);
 
     if (data.minLon && data.minLat && data.maxLon && data.maxLat) {
-      map.fitBounds([[data.minLat, data.minLon],
-        [data.maxLat, data.maxLon]]);
+      map.fitBounds([[data.minLat, data.minLon], [data.maxLat, data.maxLon]]);
     } else {
       map.setView(center, data.zoom);
     }
     } else {
       map.setView(center, data.zoom);
     }
+
+    // Let clicks to object browser links propagate.
+    if (data.type && data.id) return;
+
+    e.preventDefault();
+    e.stopPropagation();
   }
 
   var marker = L.marker([0, 0], {icon: getUserIcon()});
   }
 
   var marker = L.marker([0, 0], {icon: getUserIcon()});