Module: Blacklight::IconHelperBehavior
- Included in:
- BlacklightHelperBehavior
- Defined in:
- app/helpers/blacklight/icon_helper_behavior.rb
Overview
Module to help generate icon helpers for SVG images
Instance Method Summary collapse
-
#blacklight_icon(icon_name, options = {}) ⇒ String
Returns the raw SVG (String) for a Blacklight Icon located in app/assets/images/blacklight/*.svg.
Instance Method Details
#blacklight_icon(icon_name, options = {}) ⇒ String
Returns the raw SVG (String) for a Blacklight Icon located in app/assets/images/blacklight/*.svg. Caches them so we don't have to look up the svg everytime.
12 13 14 15 16 17 |
# File 'app/helpers/blacklight/icon_helper_behavior.rb', line 12 def blacklight_icon(icon_name, = {}) Rails.cache.fetch([:blacklight_icons, icon_name, ]) do icon = Blacklight::Icon.new(icon_name, **) tag.span(icon.svg.html_safe, **icon.) end end |