]> git.openstreetmap.org Git - rails.git/blobdiff - app/views/site/index.html.erb
Use custom events to resize the map on sidebar open/close
[rails.git] / app / views / site / index.html.erb
index f604267d87c6b5da3fca1affe02631af954bd96f..877bc177190a471cd747a52ceb4c21031783b274 100644 (file)
@@ -6,11 +6,11 @@
 
 <% unless STATUS == :api_offline or STATUS == :database_offline -%>
   <% content_for :editmenu do -%>
-    <li><%= link_to t("browse.start_rjs.data_layer_name"), "#", :id => "show_data" %></li>
+    <li><%= link_to t("browse.start_rjs.data_layer_name"), { :controller => :browse, :action => :start }, :id => "show_data" %></li>
   <% end -%>
 <% end -%>
 
-<%= render :partial => 'sidebar', :locals => { :onopen => "resizeMap();", :onclose => "resizeMap();" } %>
+<%= render :partial => 'sidebar' %>
 <%= render :partial => 'key' %>
 <%= render :partial => 'search' %>
 
@@ -125,9 +125,6 @@ else
 end
 %>
 
-<%= javascript_include_tag 'openlayers.js' %>
-<%= javascript_include_tag 'map.js' %>
-
 <%= render :partial => 'resize' %>
 
 <script type="text/javascript">
@@ -192,8 +189,11 @@ end
   }
 
   $(document).ready(function () {
-    $("#show_data").click(function () {
-      $.ajax({ url: "<%= url_for :controller => :browse, :action => :start %>" });
+    $("#show_data").click(function (e) {
+      $.ajax({ url: $(this).attr('href'), success: function (sidebarHtml) {
+        startBrowse(sidebarHtml);
+      }});
+      e.preventDefault();
     });
 
     $("body").on("click", "a.set_position", function () {
@@ -285,12 +285,14 @@ end
 
   $(document).ready(function () {
     $("#exportanchor").click(function (e) {
-      $.ajax({ url: "<%= url_for :controller => :export, :action => :start %>" });
+      $.ajax({ url: "<%= url_for :controller => :export, :action => :start %>", success: function (sidebarHtml) {
+        startExport(sidebarHtml);
+      }});
       e.preventDefault();
     });
 
     <% if params[:action] == 'export' -%>
-    $.ajax({ url: "<%= url_for :controller => :export, :action => :start %>" });
+    $("#exportanchor").click();
     <% end -%>
 
     <% if params[:query] -%>