Sha256: 3474b0bbce1b5649336b506b24076e4eb6c066c96589634f2bb0fb4d7c17f166
Contents?: true
Size: 985 Bytes
Versions: 1
Compression:
Stored size: 985 Bytes
Contents
module FontAwesome module Rails module IconHelper def fa_icon(icon, options = {}) classes = [options[:type].nil? ? "fas" : options[:type].to_s] classes << "fa-#{icon}" classes += options[:class].split(" ") unless options[:class].nil? classes += options[:size].split(" ").map{|s| "fa-#{s}"} unless options[:size].nil? classes += options[:animation].split(" ").map{|s| "fa-#{s}"} unless options[:animation].nil? classes = classes.uniq.join(" ") tags = [] if options[:text].nil? tags << content_tag(:i, nil, class: classes, style: options[:style], data: options[:data]) else content_tag :span do tags << content_tag(:i, nil, class: classes, style: options[:style], data: options[:data]) tags << content_tag(:span, options[:text], style: "padding-left: 5px;#{options[:style]}") end end tags.join.html_safe end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
font_awesome5_rails-0.2.0 | app/helpers/font_awesome/rails/icon_helper.rb |