Module: Fontawesome5::Rails::Helper
- Defined in:
- lib/fontawesome5/rails/helper.rb
Instance Method Summary collapse
- #fa_icon(icon_name, opt = {}) ⇒ Object
- #fa_icon_text(icon_name, text = '', opt = {class: 'mr-2'}) ⇒ Object
- #fab_icon(icon_name, opt = {}) ⇒ Object
- #fab_icon_text(icon_name, text = '', opt = {class: 'mr-2'}) ⇒ Object
- #far_icon(icon_name, opt = {}) ⇒ Object
- #far_icon_text(icon_name, text = '', opt = {class: 'mr-2'}) ⇒ Object
- #fas_icon(icon_name, opt = {}) ⇒ Object
- #fas_icon_text(icon_name, text = '', opt = {class: 'mr-2'}) ⇒ Object
Instance Method Details
#fa_icon(icon_name, opt = {}) ⇒ Object
4 5 6 7 8 9 10 |
# File 'lib/fontawesome5/rails/helper.rb', line 4 def fa_icon(icon_name, opt = {}) opt.reverse_merge!(style_prefix: 'far', text: '', icon_size: '1x', class: 'mr-0') capture do concat(content_tag(:i, '', class: "#{opt[:style_prefix]} fa-#{icon_name} fa-#{opt[:icon_size]} #{opt[:class]}")) concat(opt[:text]) end end |
#fa_icon_text(icon_name, text = '', opt = {class: 'mr-2'}) ⇒ Object
27 28 29 30 |
# File 'lib/fontawesome5/rails/helper.rb', line 27 def fa_icon_text(icon_name, text = '', opt = {class: 'mr-2'}) opt.reverse_merge!(style_prefix: 'far', text: text, icon_size: '1x', class: opt[:class]) fa_icon(icon_name, opt) end |
#fab_icon(icon_name, opt = {}) ⇒ Object
22 23 24 25 |
# File 'lib/fontawesome5/rails/helper.rb', line 22 def fab_icon(icon_name, opt = {}) opt.reverse_merge!(style_prefix: 'fab', text: '', icon_size: '1x', class: 'mr-0') fa_icon(icon_name, opt) end |
#fab_icon_text(icon_name, text = '', opt = {class: 'mr-2'}) ⇒ Object
42 43 44 45 |
# File 'lib/fontawesome5/rails/helper.rb', line 42 def fab_icon_text(icon_name, text = '', opt = {class: 'mr-2'}) opt.reverse_merge!(style_prefix: 'fab', text: text, icon_size: '1x', class: opt[:class]) fa_icon(icon_name, opt) end |
#far_icon(icon_name, opt = {}) ⇒ Object
12 13 14 15 |
# File 'lib/fontawesome5/rails/helper.rb', line 12 def far_icon(icon_name, opt = {}) opt.reverse_merge!(style_prefix: 'far', text: '', icon_size: '1x', class: 'mr-0') fa_icon(icon_name, opt) end |
#far_icon_text(icon_name, text = '', opt = {class: 'mr-2'}) ⇒ Object
32 33 34 35 |
# File 'lib/fontawesome5/rails/helper.rb', line 32 def far_icon_text(icon_name, text = '', opt = {class: 'mr-2'}) opt.reverse_merge!(style_prefix: 'far', text: text, icon_size: '1x', class: opt[:class]) fa_icon(icon_name, opt) end |
#fas_icon(icon_name, opt = {}) ⇒ Object
17 18 19 20 |
# File 'lib/fontawesome5/rails/helper.rb', line 17 def fas_icon(icon_name, opt = {}) opt.reverse_merge!(style_prefix: 'fas', text: '', icon_size: '1x', class: 'mr-0') fa_icon(icon_name, opt) end |
#fas_icon_text(icon_name, text = '', opt = {class: 'mr-2'}) ⇒ Object
37 38 39 40 |
# File 'lib/fontawesome5/rails/helper.rb', line 37 def fas_icon_text(icon_name, text = '', opt = {class: 'mr-2'}) opt.reverse_merge!(style_prefix: 'fas', text: text, icon_size: '1x', class: opt[:class]) fa_icon(icon_name, opt) end |