]> git.openstreetmap.org Git - rails.git/commitdiff
Use a cookie to remember the last location viewed on the slippy map.
authorTom Hughes <tom@compton.nu>
Sat, 28 Jul 2007 00:07:31 +0000 (00:07 +0000)
committerTom Hughes <tom@compton.nu>
Sat, 28 Jul 2007 00:07:31 +0000 (00:07 +0000)
app/views/site/index.rhtml

index 5b9fd84f65ea4f376613229be7b22649c2f74b7f..aa808085f94af38170da2ae1b80abfaed0f6614c 100644 (file)
@@ -14,6 +14,8 @@
 <% lon = params['mlon'] %> 
 <% lat = params['mlat'] %>
 <% zoom =  params['zoom'] || '12' %>
 <% lon = params['mlon'] %> 
 <% lat = params['mlat'] %>
 <% zoom =  params['zoom'] || '12' %>
+<% elsif cookies.key?("location") %>
+<% lon,lat,zoom = cookies["location"].value.first.split(",") %>
 <% elsif @user and !@user.home_lon.nil? and !@user.home_lat.nil? %> 
 <% lon =  @user.home_lon %>
 <% lat =  @user.home_lat %>
 <% elsif @user and !@user.home_lon.nil? and !@user.home_lat.nil? %> 
 <% lon =  @user.home_lon %>
 <% lat =  @user.home_lat %>
@@ -73,6 +75,8 @@
     var zoom = map.getZoom();
 
     updatelinks(lonlat.lon, lonlat.lat, zoom);
     var zoom = map.getZoom();
 
     updatelinks(lonlat.lon, lonlat.lat, zoom);
+
+    document.cookie = "location=" + lonlat.lon + "," + lonlat.lat + "," + zoom;
   }
 
   function getStyle( el, property ) {
   }
 
   function getStyle( el, property ) {