]> git.openstreetmap.org Git - rails.git/blobdiff - app/views/site/index.html.erb
Extract layer configuration to map.js
[rails.git] / app / views / site / index.html.erb
index 5eb8ae228c3a3b4b53b743d4a3df22bc0279a8de..25f0c8585a2245034e9505e74afb96b86df27270 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' %>
 
       <td class="attribution_project"><%= t'site.index.license.project_url' %></td>
     </tr>
     <tr>
-      <td colspan="2" class="attribution_notice"><%=
-        t'site.index.license.notice',
-          :license_name => t('site.index.license.license_name'),
-          :project_name => t('site.index.license.project_name')
-        %></td>
+      <td colspan="2" class="attribution_notice"><%= t'site.index.license.copyright' %></td>
     </tr>
   </table>
 </div>
@@ -125,11 +121,6 @@ else
 end
 %>
 
-<%= javascript_include_tag 'openlayers.js' %>
-<%= javascript_include_tag 'map.js' %>
-
-<%= render :partial => 'resize' %>
-
 <script type="text/javascript">
   var marker;
   var map;
@@ -137,14 +128,6 @@ end
   function mapInit(){
     map = createMap("map");
 
-    <% unless STATUS == :api_offline or STATUS == :database_offline %>
-      map.dataLayer = new OpenLayers.Layer("<%= I18n.t 'browse.start_rjs.data_layer_name' %>", {
-          visibility: false,
-          displayInLayerSwitcher: false
-      });
-      map.addLayer(map.dataLayer);
-    <% end %>
-
     <% unless object_zoom %>
       <% if bbox %>
         var bbox = new OpenLayers.Bounds(<%= minlon %>, <%= minlat %>, <%= maxlon %>, <%= maxlat %>);
@@ -192,8 +175,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 () {
@@ -291,7 +277,7 @@ end
       e.preventDefault();
     });
 
-    <% if params[:action] == 'export' -%>
+    <% if params[:export] -%>
     $("#exportanchor").click();
     <% end -%>