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.
16 lines
620 B
Text
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>
|