Module: Spina::Admin::IconsHelper

Defined in:
app/helpers/spina/admin/icons_helper.rb

Defined Under Namespace

Classes: FileNotFound

Instance Method Summary collapse

Instance Method Details

#heroicon(name, style: :outline, **options) ⇒ Object



8
9
10
11
12
13
14
15
16
# File 'app/helpers/spina/admin/icons_helper.rb', line 8

def heroicon(name, style: :outline, **options)
  name = heroicons_naming_v1_to_v2(name)
  file = read_file(Spina::Engine.root.join("app/assets/icons/heroicons", style.to_s, "#{name}.svg"))
  return "" if file.nil?
  doc = Nokogiri::XML(file)
  svg = doc.root
  svg[:class] = options[:class]
  ActiveSupport::SafeBuffer.new(svg.to_s)
end