]> git.openstreetmap.org Git - rails.git/blobdiff - app/views/site/index.rhtml
Merge 7744:7922 from trunk.
[rails.git] / app / views / site / index.rhtml
index d6247158d3bcc7d5c31a3124f4801e5c910e911b..656db99c80008a3b8757d061bf25d12f52dad4d1 100644 (file)
@@ -94,6 +94,10 @@ by the OpenStreetMap project and its contributors.
   function mapInit(){
     map = createMap("map");
 
+    map.dataLayer = new OpenLayers.Layer("Data", { "visibility": false });
+    map.dataLayer.events.register("visibilitychanged", map.dataLayer, toggleData);
+    map.addLayer(map.dataLayer);
+
     <% if bbox %>
     var bbox = new OpenLayers.Bounds(<%= minlon %>, <%= minlat %>, <%= maxlon %>, <%= maxlat %>);
 
@@ -126,6 +130,14 @@ by the OpenStreetMap project and its contributors.
     handleResize();
   }
 
+  function toggleData() {
+    if (map.dataLayer.visibility) {
+      <%= remote_function :url => { :controller => 'browse', :action => 'start' } %>
+    } else {
+      closeSidebar();
+    }
+  }
+
   function getPosition() {
     return getMapCenter();
   }