From 44f6f286ca41bf833a2829abf9c01fda6f4ad721 Mon Sep 17 00:00:00 2001 From: Anton Khorev Date: Mon, 12 May 2025 12:10:11 +0300 Subject: [PATCH] Add links to external map legends --- app/views/map_keys/show.html.erb | 7 +++++++ config/key.yml | 3 +++ config/locales/en.yml | 1 + 3 files changed, 11 insertions(+) diff --git a/app/views/map_keys/show.html.erb b/app/views/map_keys/show.html.erb index 76d4be2fc..00a8ef72c 100644 --- a/app/views/map_keys/show.html.erb +++ b/app/views/map_keys/show.html.erb @@ -17,4 +17,11 @@ <% end %> <% end %> + <% @key.each do |layer_name, layer_data| %> + <% if layer_data["legend"] %> + <%= tag.div :data => { :layer => layer_name }, :class => "mt-3 text-center" do %> + <%= link_to t(".see_external_legend"), layer_data["legend"], :target => "_blank", :rel => "noopener" %> + <% end %> + <% end %> + <% end %> diff --git a/config/key.yml b/config/key.yml index 2fac4649c..7d6322bdf 100644 --- a/config/key.yml +++ b/config/key.yml @@ -1,4 +1,5 @@ mapnik: + legend: https://wiki.openstreetmap.org/wiki/OpenStreetMap_Carto/Symbols entries: # transportation: roads.mss - { min_zoom: 6, name: motorway, width: 52, height: 1, line: "#e66e89", line-width: 1 } @@ -106,6 +107,7 @@ mapnik: - { min_zoom: 15, name: destination, image: destination.png } - { min_zoom: 12, name: construction, image: construction.png } cyclosm: + legend: https://www.cyclosm.org/legend.html entries: # bicycle routes: roads.mss, road-colors.mss - { min_zoom: 2, name: international_bike_route, width: 50, height: 1, fill: "#ff00ff", opacity: 0.75 } @@ -145,6 +147,7 @@ cyclosm: - { min_zoom: 17, name: local_bike_route, width: 50, height: 10, fill: "#0000ff", opacity: 0.25 } - { min_zoom: 18, name: local_bike_route, width: 50, height: 14, fill: "#0000ff", opacity: 0.25 } cyclemap: + legend: https://www.opencyclemap.org/docs/ entries: - { min_zoom: 5, name: motorway, width: 50, height: 2, fill: "#9a9ab1" } - { min_zoom: 9, name: motorway, width: 50, height: 3, fill: "#9a9ab1" } diff --git a/config/locales/en.yml b/config/locales/en.yml index 19794a770..d0cca87e8 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -2642,6 +2642,7 @@ en: bicycle_parking: "Bicycle parking" bicycle_parking_small: "Small bicycle parking" toilets: "Toilets" + see_external_legend: "See external map legend" traces: visibility: private: "Private (only shared as anonymous, unordered points)" -- 2.39.5