X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/5c39e5870d5b31262644ef8e7d1b73dbe6f4e0b7..4d91fe3dd95c1058cb8d24fd4c900223e30b9059:/app/views/site/index.html.erb diff --git a/app/views/site/index.html.erb b/app/views/site/index.html.erb index 8f8d8737b..58bc59c20 100644 --- a/app/views/site/index.html.erb +++ b/app/views/site/index.html.erb @@ -6,6 +6,7 @@ <% unless STATUS == :api_offline or STATUS == :database_offline -%> <% content_for :editmenu do -%> +
  • <%= link_to t("browse.start_rjs.notes_layer_name"), "#", :id => "show_notes" %>
  • <%= link_to t("browse.start_rjs.data_layer_name"), { :controller => :browse, :action => :start }, :id => "show_data" %>
  • <% end -%> <% end -%> @@ -25,6 +26,7 @@ @@ -48,9 +50,27 @@ var map; var params = OSM.mapParams(); + <% if @user %> + var loginName = "<%= @user.display_name %>" + <% 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); + + map.noteLayer = addNoteLayer(map, "<%= notes_url :format => 'json' %>", $("#createnoteanchor"), 11); + + <% if params[:notes] == "yes" -%> + map.noteLayer.setVisibility(true); + <% end -%> + <% end %> + if (!params.object_zoom) { if (params.bbox) { var bbox = new OpenLayers.Bounds(params.minlon, params.minlat, params.maxlon, params.maxlat); @@ -91,6 +111,10 @@ } $(document).ready(function () { + $("#show_notes").click(function () { + map.noteLayer.setVisibility(true); + }); + $("#show_data").click(function (e) { $.ajax({ url: $(this).attr('href'), success: function (sidebarHtml) { startBrowse(sidebarHtml);