Sha256: 8c1b187afae72343cb307c7826a73ad5ff05c73b4eea5933db958f535ffe9bce

Contents?: true

Size: 572 Bytes

Versions: 1

Compression:

Stored size: 572 Bytes

Contents

##
# Module to help generate icon helpers for SVG images
module Blacklight::IconHelperBehavior
  ##
  # 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.
  # @param [String, Symbol] icon_name
  # @return [String]
  def blacklight_icon(icon_name, options = {})
    Rails.cache.fetch([:blacklight_icons, icon_name, options]) do
      icon = Blacklight::Icon.new(icon_name, options)
      content_tag(:span, icon.svg.html_safe, icon.options)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
blacklight-7.0.0.rc1 app/helpers/blacklight/icon_helper_behavior.rb