Module: FontAwesome::Sass::Rails::ViewHelpers

Defined in:
lib/font_awesome/sass/rails/helpers.rb

Instance Method Summary collapse

Instance Method Details

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



5
6
7
8
9
10
11
12
13
14
15
16
# File 'lib/font_awesome/sass/rails/helpers.rb', line 5

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_options['aria-hidden'] ||= true

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