Add solid svg image helper
This commit is contained in:
parent
dc622a32f3
commit
0c472ad198
2 changed files with 9 additions and 1 deletions
8
app/helpers/svg_helper.rb
Normal file
8
app/helpers/svg_helper.rb
Normal file
|
@ -0,0 +1,8 @@
|
|||
module SvgHelper
|
||||
def solid_svg_image_tag(width, height, fill, **options)
|
||||
svg = "<svg xmlns='http://www.w3.org/2000/svg' width='#{width}' height='#{height}'>" \
|
||||
"<rect width='100%' height='100%' fill='#{fill}' />" \
|
||||
"</svg>"
|
||||
image_tag "data:image/svg+xml,#{u(svg)}", **options
|
||||
end
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue