You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

18 lines
656 B

# Font Awesome Helper
module IconHelper
# accept name without 'fa-' prefix, style: (solid by default), size:, class: and 'aria-hidden':
def fa_icon(name, html_options = {})
html_options[:style] ||= :solid
html_options['aria-hidden'] ||= true
content_class = "fa-#{unsymbolize(html_options[:style])} fa-#{unsymbolize(name)}"
content_class << " fa-#{unsymbolize(html_options[:size])}" if html_options.key? :size
content_class << " #{html_options[:class]}" if html_options.key? :class
tag.i(class: content_class, 'aria-hidden': html_options['aria-hidden'])
end
private
def unsymbolize(symbol) = symbol.to_s.dasherize
end