Module: Interage::FontAwesomeHelper
- Included in:
- ApplicationHelper
- Defined in:
- lib/interage/font_awesome_helper.rb
Constant Summary collapse
- FA_ICON_TEXT_CLASS =
'text'
Instance Method Summary collapse
- #fa_classes(icon, options = {}) ⇒ Object
- #fa_fw_icon(icon, options = {}) ⇒ Object
- #fa_icon(icon, options = {}) ⇒ Object
- #fa_icon_text(icon, text, options = {}) ⇒ Object
- #fa_icons ⇒ Object
Instance Method Details
#fa_classes(icon, options = {}) ⇒ Object
28 29 30 31 32 |
# File 'lib/interage/font_awesome_helper.rb', line 28 def fa_classes(icon, = {}) icon_classes = icon.to_s.split.uniq.join(' fa-') "fa fa-#{icon_classes} #{[:class]}".strip end |
#fa_fw_icon(icon, options = {}) ⇒ Object
17 18 19 |
# File 'lib/interage/font_awesome_helper.rb', line 17 def fa_fw_icon(icon, = {}) fa_icon("fw #{icon}", ) end |
#fa_icon(icon, options = {}) ⇒ Object
11 12 13 14 15 |
# File 'lib/interage/font_awesome_helper.rb', line 11 def fa_icon(icon, = {}) = .merge(class: fa_classes(icon, )) content_tag(:i, nil, ) end |
#fa_icon_text(icon, text, options = {}) ⇒ Object
21 22 23 24 25 26 |
# File 'lib/interage/font_awesome_helper.rb', line 21 def fa_icon_text(icon, text, = {}) content_tag :span do concat fa_fw_icon(icon, ) concat content_tag(:span, text, class: FA_ICON_TEXT_CLASS) end end |
#fa_icons ⇒ Object
7 8 9 |
# File 'lib/interage/font_awesome_helper.rb', line 7 def fa_icons t('icons_alias', default: {}).keys end |