Module: BMC::FontAwesomeHelper

Included in:
AllHelpers
Defined in:
app/helpers/bmc/font_awesome_helper.rb

Instance Method Summary collapse

Instance Method Details

#_bmc_fa_icon(id, fa_style: nil, size: nil, spin: false, **options) ⇒ Object



14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'app/helpers/bmc/font_awesome_helper.rb', line 14

def _bmc_fa_icon(id, fa_style: nil, size: nil, spin: false, **options)
  id = id.to_s.tr("_", "-").to_sym

  css_classes = options.delete(:class).to_s.split
  css_classes << "icon"
  css_classes << "fa-#{id}"
  css_classes << fa_style
  css_classes << "fa-#{size}" if size
  css_classes << "fa-spin" if spin

  attributes = options.merge(class: css_classes.sort.join(" ")).sort.to_h

  tag.span(**attributes)
end

#fa_b(id) ⇒ Object



10
11
12
# File 'app/helpers/bmc/font_awesome_helper.rb', line 10

def fa_b(id, **)
  _bmc_fa_icon(id, fa_style: "fab", **)
end

#fa_r(id) ⇒ Object



6
7
8
# File 'app/helpers/bmc/font_awesome_helper.rb', line 6

def fa_r(id, **)
  _bmc_fa_icon(id, fa_style: "far", **)
end

#fa_s(id) ⇒ Object



2
3
4
# File 'app/helpers/bmc/font_awesome_helper.rb', line 2

def fa_s(id, **)
  _bmc_fa_icon(id, fa_style: "fas", **)
end