Module: FontAwesome5::Rails::IconHelper

Defined in:
app/helpers/font_awesome5/rails/icon_helper.rb

Instance Method Summary collapse

Instance Method Details

#fa5_icon(icon, options = {}) ⇒ Object Also known as: fa_icon



9
10
11
12
# File 'app/helpers/font_awesome5/rails/icon_helper.rb', line 9

def fa5_icon(icon, options = {})
  parser = FaIconParser.new(icon, options)
  parser.
end

#fa5_stacked_icon(icon, options = {}) ⇒ Object Also known as: fa_stacked_icon



15
16
17
18
19
20
21
22
23
24
# File 'app/helpers/font_awesome5/rails/icon_helper.rb', line 15

def fa5_stacked_icon(icon, options = {})
  parser = FaStackedIconParser.new(icon, options)

  tags =  :span, class: parser.span_classes, title: parser.title do
    (:i, nil, class: (parser.reverse ? parser.second_icon_classes : parser.first_icon_classes), **parser.more_options(:base_options) ) +
    (:i, nil, class: (parser.reverse ? parser.first_icon_classes : parser.second_icon_classes), **parser.more_options(:icon_options) )
  end
  tags += parser.text unless parser.text.nil?
  tags
end

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



27
28
29
30
31
32
33
34
35
36
# File 'app/helpers/font_awesome5/rails/icon_helper.rb', line 27

def fa_layered_icon(options = {}, &block)
  parser = FaLayeredIconParser.new(options)
  if parser.size.nil?
    (:span, class: parser.classes, title: parser.title, style: parser.style, &block)
  else
     :div, class: "fa-#{parser.size}" do
      (:span, class: parser.classes, title: parser.title, style: parser.style, &block)
    end
  end
end