]> git.openstreetmap.org Git - rails.git/commitdiff
Obey the location hash for edit URLs with objects
authorJohn Firebaugh <john.firebaugh@gmail.com>
Fri, 6 Dec 2013 00:10:28 +0000 (16:10 -0800)
committerTom Hughes <tom@compton.nu>
Fri, 6 Dec 2013 00:21:50 +0000 (00:21 +0000)
For a link like http://osm.org/edit?node=n#map=19/37.77683/-122.41459,
select the feature but also respect the map location.

This is the fix for iD. It appears P2 requires internal code
modifications.

Refs #620

app/views/site/_id.html.erb

index 6409582cd1133cd43ebfe3e08c38f5a07e462f65..f88942669ecbb19595f5b6f62c4378ae68175e4e 100644 (file)
@@ -8,6 +8,10 @@
     var mapParams = OSM.mapParams();
     if (mapParams.object) {
       params.id = mapParams.object.type[0] + mapParams.object.id;
+      mapParams = OSM.parseHash(location.hash);
+      if (mapParams.center) {
+        params.map = mapParams.zoom + '/' + mapParams.center.lng + '/' + mapParams.center.lat;
+      }
     } else {
 <% if @lat && @lon -%>
       params.map = '16/<%= @lon %>/<%= @lat %>';