openstreetmap-website/app/views/site/key.html.erb
Tom Hughes 815c98c977 Select which key entries to show on the client
Rather than requesting a new key every time the zoom or layer
changes, serve up all the entries initially with appropriate
annotations to allow the client to decide which ones to show.
2012-08-31 10:29:32 +01:00

16 lines
620 B
Text

<div id="mapkey">
<table class="mapkey-table">
<% YAML.load_file("#{Rails.root}/config/key.yml").each do |name,data| %>
<% data.each do |entry| %>
<tr class="mapkey-table-entry" data-layer="<%= name %>" data-zoom-min="<%= entry['min_zoom'] %>" data-zoom-max="<%= entry['max_zoom'] %>">
<td class="mapkey-table-key">
<%= image_tag "key/#{name}/#{entry['image']}" %>
</td>
<td class="mapkey-table-value">
<%= [*t("site.key.table.entry.#{entry['name']}")].to_sentence %>
</td>
</tr>
<% end %>
<% end %>
</table>
</div>