]> git.openstreetmap.org Git - rails.git/blobdiff - app/views/site/index.rhtml
Improve the layout of the browse sidebar a bit.
[rails.git] / app / views / site / index.rhtml
index 46bc3bdd7ee80f9b2ba013a88a5a0873f5d97b19..656db99c80008a3b8757d061bf25d12f52dad4d1 100644 (file)
@@ -8,6 +8,14 @@
 <%= render :partial => 'key' %>
 <%= render :partial => 'search' %>
 
+<noscript>
+  <div id="noscript">
+    <p>You are either using a browser that doesn't support javascript, or you have disabled javascript.</p>
+    <p>OpenStreetMap uses javascript for its slippy map.</p>
+    <p>You may want to try the <a href="http://tah.openstreetmap.org/Browse/">Tiles@Home static tile browser</a> if you are unable to enable javascript.</p>
+  </div>
+</noscript>
+
 <div id="map">
 <div id="permalink"><a href="/" id="permalinkanchor">Permalink</a></div>
 </div> 
@@ -21,7 +29,7 @@
 <tr>
 <td colspan="2" align="center">
 Licensed under the Creative Commons Attribution-Share Alike 2.0 license
-by the OpenStreetMap project and it's contributors.
+by the OpenStreetMap project and its contributors.
 </td>
 </table>
 </div>
@@ -86,6 +94,10 @@ by the OpenStreetMap project and it's 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 %>);
 
@@ -118,6 +130,14 @@ by the OpenStreetMap project and it's contributors.
     handleResize();
   }
 
+  function toggleData() {
+    if (map.dataLayer.visibility) {
+      <%= remote_function :url => { :controller => 'browse', :action => 'start' } %>
+    } else {
+      closeSidebar();
+    }
+  }
+
   function getPosition() {
     return getMapCenter();
   }
@@ -180,5 +200,9 @@ by the OpenStreetMap project and it's contributors.
 
   window.onload = handleResize;
   window.onresize = handleResize;
+
+  <% if params['action'] == 'export' %>
+  <%= remote_function :url => { :controller => 'export', :action => 'start' } %>
+  <% end %>
 // -->
 </script>