From: Anton Khorev Date: Tue, 19 Dec 2023 12:41:10 +0000 (+0300) Subject: Use inline svg for solid map key images X-Git-Tag: live~930^2 X-Git-Url: https://git.openstreetmap.org./rails.git/commitdiff_plain/f92183e52043a4bfa4e96392a2b7d767db1690d3 Use inline svg for solid map key images --- diff --git a/app/helpers/svg_helper.rb b/app/helpers/svg_helper.rb index f2e02f742..abb512f0d 100644 --- a/app/helpers/svg_helper.rb +++ b/app/helpers/svg_helper.rb @@ -1,8 +1,7 @@ module SvgHelper - def solid_svg_image_tag(width, height, fill, **options) - svg = "" \ - "" \ - "" - image_tag "data:image/svg+xml,#{u(svg)}", **options + def solid_svg_tag(width, height, fill, **options) + tag.svg :width => width, :height => height, **options do + tag.rect :width => "100%", :height => "100%", :fill => fill + end end end diff --git a/app/views/site/key.html.erb b/app/views/site/key.html.erb index ddb3cbbef..8b61b92bf 100644 --- a/app/views/site/key.html.erb +++ b/app/views/site/key.html.erb @@ -5,7 +5,7 @@ <%= tag.tr :class => "mapkey-table-entry", :data => { :layer => layer_name, :zoom_min => entry["min_zoom"], :zoom_max => entry["max_zoom"] } do %> <% if entry["width"] && entry["height"] && entry["fill"] %> - <%= solid_svg_image_tag entry["width"], entry["height"], entry["fill"], :class => "d-block mx-auto" %> + <%= solid_svg_tag entry["width"], entry["height"], entry["fill"], :class => "d-block mx-auto" %> <% else %> <%= image_tag "key/#{layer_name}/#{entry['image']}", :class => "d-block mx-auto" %> <% end %>