Module: IconHelper

Defined in:
app/helpers/icon_helper.rb

Defined Under Namespace

Classes: IconCreator

Instance Method Summary collapse

Instance Method Details

#icon(type = nil, options = {}) ⇒ Object



96
97
98
99
100
# File 'app/helpers/icon_helper.rb', line 96

def icon(type=nil, options={})
  raise 'Please provide an icon type!' if type.blank?

  IconCreator.new(type, options).render
end

#icon_list(options = {}, &block) ⇒ Object



102
103
104
105
106
# File 'app/helpers/icon_helper.rb', line 102

def icon_list(options={}, &block)
  prepend_class(options, 'fa-ul')

   :ul, options, &block
end

#icon_list_item(content_or_options, options = {}, &block) ⇒ Object



108
109
110
111
112
113
114
115
116
# File 'app/helpers/icon_helper.rb', line 108

def icon_list_item(content_or_options, options={}, &block)
  content, options = parse_content_or_options(content_or_options, options)
  icon_options     = options.delete(:icon_html)
  icon             = icon(icon_options.delete(:type), icon_options)

   :li, options do
    (icon + (content.presence || capture(&block))).html_safe
  end
end