Module: KonoUtilsBootstrapView4::ApplicationIconHelper

Included in:
KonoUtils::Object::Cell::Base
Defined in:
lib/kono_utils_bootstrap_view4/application_icon_helper.rb

Instance Method Summary collapse

Instance Method Details

#fa_icon(icon, text: nil, solid_regular: "s") ⇒ Object



18
19
20
21
22
23
24
25
26
27
# File 'lib/kono_utils_bootstrap_view4/application_icon_helper.rb', line 18

def fa_icon(icon, text: nil, solid_regular:"s")
  icon = (:i, nil, class: "fa#{solid_regular} fa-#{icon} fa-fw")
  elements = [icon]
  unless text.blank?
    elements << text
    elements.reverse!
  end

  safe_join(elements, " ")
end

#icon(style, name, text = nil, html_options = {}) ⇒ Object

Funzione clonata da una gemma, le fontawesome lo stiamo già impostando con webpack



6
7
8
9
10
11
12
13
14
15
16
# File 'lib/kono_utils_bootstrap_view4/application_icon_helper.rb', line 6

def icon(style, name, text = nil, html_options = {})
  text, html_options = nil, text if text.is_a?(Hash)

  content_class = "#{style} fa-#{name}"
  content_class << " #{html_options[:class]}" if html_options.key?(:class)
  html_options[:class] = content_class

  html = (:i, nil, html_options)
  html << ' ' << text.to_s unless text.blank?
  html
end