Module: Interage::FontAwesomeHelper

Included in:
ApplicationHelper
Defined in:
lib/interage/font_awesome_helper.rb

Instance Method Summary collapse

Instance Method Details

#fa_classes(icon, options = {}) ⇒ Object



24
25
26
27
28
# File 'lib/interage/font_awesome_helper.rb', line 24

def fa_classes(icon, options = {})
  icon_classes = icon.to_s.split(' ').uniq.join(' fa-')

  "fa fa-#{icon_classes} #{options[:class]}".strip
end

#fa_fw_icon(icon, options = {}) ⇒ Object



13
14
15
# File 'lib/interage/font_awesome_helper.rb', line 13

def fa_fw_icon(icon, options = {})
  fa_icon("fw #{icon}", options)
end

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



9
10
11
# File 'lib/interage/font_awesome_helper.rb', line 9

def fa_icon(icon, options = {})
   :i, nil, options.merge(class: fa_classes(icon, options))
end

#fa_icon_text(icon, text, options = {}) ⇒ Object



17
18
19
20
21
22
# File 'lib/interage/font_awesome_helper.rb', line 17

def fa_icon_text(icon, text, options = {})
   :span do
    concat fa_fw_icon(icon, options)
    concat text
  end
end

#fa_iconsObject



5
6
7
# File 'lib/interage/font_awesome_helper.rb', line 5

def fa_icons
  t('icons_alias', default: {}).keys
end