From: Anton Khorev Date: Sat, 16 Dec 2023 12:50:13 +0000 (+0300) Subject: Add solid svg image helper X-Git-Tag: live~902^2~1 X-Git-Url: https://git.openstreetmap.org./rails.git/commitdiff_plain/0c472ad198d1f3bb31ea8ec6710a60c1cf8ffda3 Add solid svg image helper --- diff --git a/app/helpers/svg_helper.rb b/app/helpers/svg_helper.rb new file mode 100644 index 000000000..f2e02f742 --- /dev/null +++ b/app/helpers/svg_helper.rb @@ -0,0 +1,8 @@ +module SvgHelper + def solid_svg_image_tag(width, height, fill, **options) + svg = "" \ + "" \ + "" + image_tag "data:image/svg+xml,#{u(svg)}", **options + end +end diff --git a/app/views/site/key.html.erb b/app/views/site/key.html.erb index 608932b3e..ddb3cbbef 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"] %> - <%= image_tag "data:image/svg+xml,#{u("")}", :class => "d-block mx-auto" %> + <%= solid_svg_image_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 %>