X-Git-Url: https://git.openstreetmap.org/rails.git/blobdiff_plain/fc98b97e591acf043e1a6721d6327719dd53a53f..88105d9c643519e02082ba9cc5044bb0dfdcb7b9:/app/views/site/index.rhtml diff --git a/app/views/site/index.rhtml b/app/views/site/index.rhtml index d6247158d..656db99c8 100644 --- a/app/views/site/index.rhtml +++ b/app/views/site/index.rhtml @@ -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(); }