From f92183e52043a4bfa4e96392a2b7d767db1690d3 Mon Sep 17 00:00:00 2001 From: Anton Khorev Date: Tue, 19 Dec 2023 15:41:10 +0300 Subject: [PATCH] Use inline svg for solid map key images --- app/helpers/svg_helper.rb | 9 ++++----- app/views/site/key.html.erb | 2 +- 2 files changed, 5 insertions(+), 6 deletions(-) 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 %> -- 2.39.5