]> git.openstreetmap.org Git - rails.git/blob - app/views/browse/_map.html.erb
Add anchors to note comments on the browse page
[rails.git] / app / views / browse / _map.html.erb
1 <iframe id="linkloader" style="display: none">
2 </iframe>
3
4 <div id="browse_map" class='clearfix content_map'>
5   <% if map.instance_of? Changeset or (map.instance_of? Node and map.version > 1) or map.visible? %>
6
7   <% content_for :head do %>
8     <%= javascript_include_tag "browse" %>
9   <% end %>
10
11   <%
12      if map.instance_of? Changeset
13        bbox = map.bbox.to_unscaled
14        data = {
15          :type   => "changeset",
16          :id     => map.id,
17          :minlon => bbox.min_lon,
18          :minlat => bbox.min_lat,
19          :maxlon => bbox.max_lon,
20          :maxlat => bbox.max_lat
21        }
22      elsif map.instance_of? Note
23        data = {
24          :type => "note",
25          :id   => map.id,
26          :lon  => map.lon,
27          :lat  => map.lat
28        }
29      else
30        data = {
31          :type    => map.class.name.downcase,
32          :id      => map.id,
33          :version => map.version,
34          :visible => map.visible
35        }
36      end
37   %>
38   <%= content_tag "div", "", :id => "small_map", :data => data %>
39   <span id="loading"><%= t 'browse.map.loading' %></span>
40
41 <ul class='secondary-actions clearfix'>
42   <li>
43     <% if map.instance_of? Note -%>
44       <%= link_to t("browse.map.larger.area"),
45                   root_path(:notes => "yes"),
46                   :id => "area_larger_map",
47                   :class => "geolink bbox" %>
48     <% else -%>
49       <%= link_to t("browse.map.larger.area"),
50                   root_path(:box => "yes"),
51                   :id => "area_larger_map",
52                   :class => "geolink bbox" %>
53     <% end -%>
54   </li>
55   <li>
56     <%= link_to h(t("browse.map.edit.area")) + content_tag(:span, "▼", :class => "menuicon"),
57                 edit_path,
58                 :id => "area_edit",
59                 :data => { :editor => preferred_editor },
60                 :class => "geolink bbox" %>
61   </li>
62 </ul>
63
64   <% unless map.instance_of? Changeset %>
65   <ul class='secondary-actions clearfix'>
66     <li>
67       <%= link_to t("browse.map.larger." + map.class.to_s.downcase),
68                   root_path,
69                   :id => "object_larger_map",
70                   :class => "geolink object" %>
71     </li>
72     <li>
73       <%= link_to h(t("browse.map.edit." + map.class.to_s.downcase)) + content_tag(:span, "▼", :class => "menuicon"),
74                   edit_path,
75                   :id => "object_edit",
76                   :data => { :editor => preferred_editor },
77                   :class => "geolink object" %>
78     </li>
79   </ul>
80   <% end %>
81
82   <% else %>
83     <%= t 'browse.map.deleted' %>
84   <% end %>
85 </div>
86
87 <div id="area_edit_menu" class="menu">
88   <ul>
89     <% Editors::RECOMMENDED_EDITORS.each do |editor| %>
90       <li><%= link_to t('layouts.edit_with', :editor => t("editor.#{editor}.description")),
91                       edit_path(:editor => editor),
92                       :data => {:editor => editor},
93                       :class => "geolink bbox" %></li>
94     <% end %>
95   </ul>
96 </div>
97
98 <div id="object_edit_menu" class="menu">
99   <ul>
100     <% Editors::RECOMMENDED_EDITORS.each do |editor| %>
101       <li><%= link_to t('layouts.edit_with', :editor => t("editor.#{editor}.description")),
102                       edit_path(:editor => editor),
103                       :data => {:editor => editor},
104                       :class => "geolink object" %></li>
105     <% end %>
106   </ul>
107 </div>