From: Tom Hughes Date: Wed, 22 Aug 2012 20:36:58 +0000 (+0100) Subject: Add an entry to the edit menu for turning on the notes layer X-Git-Tag: live~5616^2~104 X-Git-Url: https://git.openstreetmap.org./rails.git/commitdiff_plain/ea63736b5c1b6e1d1adbf043f025cc9cb4171bcb Add an entry to the edit menu for turning on the notes layer --- diff --git a/app/assets/javascripts/notes.js.erb b/app/assets/javascripts/notes.js.erb index 36eabeaee..6c598120a 100644 --- a/app/assets/javascripts/notes.js.erb +++ b/app/assets/javascripts/notes.js.erb @@ -68,6 +68,7 @@ function addNoteLayer(map, notesUrl, newNoteControls, minZoom) { map.noteLayer = new OpenLayers.Layer.Vector("Notes", { visibility: false, + displayInLayerSwitcher: false, projection: new OpenLayers.Projection("EPSG:4326"), styleMap: new OpenLayers.StyleMap(new OpenLayers.Style({ graphicWidth: 22, diff --git a/app/views/site/index.html.erb b/app/views/site/index.html.erb index 8aa318a3f..4b37fc8af 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"), "#", :id => "show_data" %>
  • <% end -%> <% end -%> @@ -152,10 +153,10 @@ end }); map.addLayer(map.dataLayer); - var noteLayer = addNoteLayer(map, "<%= notes_url :format => 'json' %>", $("#createnoteanchor"), 11); + map.noteLayer = addNoteLayer(map, "<%= notes_url :format => 'json' %>", $("#createnoteanchor"), 11); <% if params[:notes] == "yes" -%> - noteLayer.setVisibility(true); + map.noteLayer.setVisibility(true); <% end -%> <% end %> @@ -206,6 +207,10 @@ end } $(document).ready(function () { + $("#show_notes").click(function () { + map.noteLayer.setVisibility(true); + }); + $("#show_data").click(function () { $.ajax({ url: "<%= url_for :controller => :browse, :action => :start %>" }); }); diff --git a/config/locales/en.yml b/config/locales/en.yml index 8bc0992bb..1b553b6b4 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -225,6 +225,7 @@ en: view_data: "View data for current map view" manually_select: "Manually select a different area" start_rjs: + notes_layer_name: "Browse Notes" data_layer_name: "Browse Map Data" data_frame_title: "Data" zoom_or_select: "Zoom in or select an area of the map to view"