]> git.openstreetmap.org Git - rails.git/commitdiff
Fix URL updating in Potlatch 1
authorTom Hughes <tom@compton.nu>
Sun, 1 Dec 2013 22:37:04 +0000 (22:37 +0000)
committerTom Hughes <tom@compton.nu>
Sun, 1 Dec 2013 22:37:04 +0000 (22:37 +0000)
Potlatch 1 has hard coded calls to updatelinks, so rename the
updatelinks function to updateLinks and add an updatelinks function
using the old style argument list for Potlatch 1 to call.

app/assets/javascripts/application.js
app/assets/javascripts/index.js
app/views/site/_potlatch.html.erb
app/views/site/_potlatch2.html.erb
app/views/site/id.html.erb

index bc8719700aa217b53aff1bd8676db0fcc44f9e2d..37172f4398849e9bc990ac5f5c77d3375e07e159 100644 (file)
@@ -58,7 +58,7 @@ function remoteEditHandler(bbox, select) {
  * Called as the user scrolls/zooms around to maniplate hrefs of the
  * view tab and various other links
  */
  * Called as the user scrolls/zooms around to maniplate hrefs of the
  * view tab and various other links
  */
-function updatelinks(loc, zoom, layers, object) {
+function updateLinks(loc, zoom, layers, object) {
   $(".geolink").each(function(index, link) {
     var href = link.href.split(/[?#]/)[0],
       args = querystring.parse(link.search.substring(1)),
   $(".geolink").each(function(index, link) {
     var href = link.href.split(/[?#]/)[0],
       args = querystring.parse(link.search.substring(1)),
index 43b7fefe0b4caddd7d4ec2f1d9cefcf143307a50..273ce581a252fd1b02dc0b5d0cca1a1e35b7fe4b 100644 (file)
@@ -144,7 +144,7 @@ $(document).ready(function () {
   expiry.setYear(expiry.getFullYear() + 10);
 
   map.on('moveend layeradd layerremove', function() {
   expiry.setYear(expiry.getFullYear() + 10);
 
   map.on('moveend layeradd layerremove', function() {
-    updatelinks(
+    updateLinks(
       map.getCenter().wrap(),
       map.getZoom(),
       map.getLayersCode(),
       map.getCenter().wrap(),
       map.getZoom(),
       map.getLayersCode(),
index d48fd799d2629ca98a6c3ebdb5b6070c0d97b280..32dc99e8e4a13982e9fe21a993aac0f246a2e278 100644 (file)
 
   function markChanged(a) { changesaved=a; }
 
 
   function markChanged(a) { changesaved=a; }
 
+  function updatelinks(lon,lat,zoom,layers,minlon,minlat,maxlon,maxlat,object) {
+    updateLinks({ lon: lon, lat: lat }, zoom);
+
+    var hash = OSM.formatHash({ lon: lon, lat: lat, zoom: zoom });
+    if (hash !== location.hash) {
+      location.replace(hash);
+    }
+  }
+
   function doSWF(lat,lon,sc) {
     if (sc < 11) sc = 11;
 
   function doSWF(lat,lon,sc) {
     if (sc < 11) sc = 11;
 
index faff8de1e56749a7c70e9d1f7d61a187c5ac8a3f..2f8e10a5bea1c096619d73324887230f6e0d2eab 100644 (file)
@@ -66,7 +66,7 @@
     // 700,600 for fixed size, 100%,100% for resizable
 
     if (lat && lon) {
     // 700,600 for fixed size, 100%,100% for resizable
 
     if (lat && lon) {
-      updatelinks({ lon: lon, lat: lat }, zoom);
+      updateLinks({ lon: lon, lat: lat }, zoom);
     }
   }
 
     }
   }
 
@@ -88,7 +88,7 @@
   });
 
   var mapMoved = $.throttle(250, function(lon, lat, zoom) {
   });
 
   var mapMoved = $.throttle(250, function(lon, lat, zoom) {
-    updatelinks({ lon: lon, lat: lat }, zoom);
+    updateLinks({ lon: lon, lat: lat }, zoom);
 
     var hash = OSM.formatHash({ lon: lon, lat: lat, zoom: zoom });
     if (hash !== location.hash) {
 
     var hash = OSM.formatHash({ lon: lon, lat: lat, zoom: zoom });
     if (hash !== location.hash) {
index fa47bb00ce69a59c6fa24320cbaf941a6485e8d3..38f2e0d3d5d1ba4290eb1072db739547d54a788f 100644 (file)
@@ -37,7 +37,7 @@
         center = id.map().center(),
         llz = { lon: center[0], lat: center[1], zoom: zoom };
 
         center = id.map().center(),
         llz = { lon: center[0], lat: center[1], zoom: zoom };
 
-      parent.updatelinks(llz, zoom);
+      parent.updateLinks(llz, zoom);
 
       // Manually resolve URL to avoid iframe JS context weirdness.
       // http://bl.ocks.org/jfirebaugh/5439412
 
       // Manually resolve URL to avoid iframe JS context weirdness.
       // http://bl.ocks.org/jfirebaugh/5439412