]> git.openstreetmap.org Git - rails.git/blobdiff - app/views/site/index.rhtml
Merge 7922:8377 from trunk.
[rails.git] / app / views / site / index.rhtml
index a79ea10c39f867705bac09a1365f2dec46c7d259..482ed85b89880744e8d556d5082c41a0f627889c 100644 (file)
@@ -94,6 +94,10 @@ by the OpenStreetMap project and its contributors.
   function mapInit(){
     map = createMap("map");
 
   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 %>);
 
     <% if bbox %>
     var bbox = new OpenLayers.Bounds(<%= minlon %>, <%= minlat %>, <%= maxlon %>, <%= maxlat %>);
 
@@ -126,6 +130,14 @@ by the OpenStreetMap project and its contributors.
     handleResize();
   }
 
     handleResize();
   }
 
+  function toggleData() {
+    if (map.dataLayer.visibility) {
+      <%= remote_function :url => { :controller => 'browse', :action => 'start' } %>
+    } else {
+      closeSidebar();
+    }
+  }
+
   function getPosition() {
     return getMapCenter();
   }
   function getPosition() {
     return getMapCenter();
   }