Module: FontAwesomeHelper::Helpers

Defined in:
lib/font-awesome-helper/helpers.rb

Constant Summary collapse

FA_CLASS_PREFIX =
'fa'

Instance Method Summary collapse

Instance Method Details

#fa_icon(names, options = {}) ⇒ Object



5
6
7
8
# File 'lib/font-awesome-helper/helpers.rb', line 5

def fa_icon(names, options = {})
  icon = FaIcon.new(names, options)
  (block_given? ? yield(icon.to_tag) : icon.to_tag).html_safe
end

#fa_li(names, options = {}) ⇒ Object



16
17
18
19
# File 'lib/font-awesome-helper/helpers.rb', line 16

def fa_li(names, options = {})
  content = fa_icon(names + ' li') { |i| "#{i}#{yield}" }
   :li, content, options
end

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



10
11
12
13
14
# File 'lib/font-awesome-helper/helpers.rb', line 10

def fa_ul(options = {}, &block)
  classes = %W(#{FA_CLASS_PREFIX}-ul)
  classes += options.delete(:class).split(' ') if options.key? :class
   :ul, class: classes.join(' '), &block
end