Skip to content

Commit

Permalink
Add an entry to the edit menu for turning on the notes layer
Browse files Browse the repository at this point in the history
  • Loading branch information
tomhughes committed Aug 22, 2012
1 parent 6206ab7 commit ea63736
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
1 change: 1 addition & 0 deletions app/assets/javascripts/notes.js.erb
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
9 changes: 7 additions & 2 deletions app/views/site/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
<% unless STATUS == :api_offline or STATUS == :database_offline -%>
<% content_for :editmenu do -%>
<li><%= link_to t("browse.start_rjs.notes_layer_name"), "#", :id => "show_notes" %></li>
<li><%= link_to t("browse.start_rjs.data_layer_name"), "#", :id => "show_data" %></li>
<% end -%>
<% end -%>
Expand Down Expand Up @@ -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 %>
Expand Down Expand Up @@ -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 %>" });
});
Expand Down
1 change: 1 addition & 0 deletions config/locales/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down

0 comments on commit ea63736

Please sign in to comment.