Sha256: 8fe8d692d27ee20439a11bb6b239098dbf8aa7a62b08c1c0ce27e31e04092a36
Contents?: true
Size: 1.67 KB
Versions: 1
Compression:
Stored size: 1.67 KB
Contents
require "font_awesome5_rails/parsers/fa_icon_parser" require "font_awesome5_rails/parsers/fa_layered_icon_parser" require "font_awesome5_rails/parsers/fa_stacked_icon_parser" module FontAwesome5 module Rails module IconHelper def fa_icon(icon, options = {}) parser = FaIconParser.new(icon, options) if parser.text.nil? content_tag(:i, nil, class: parser.classes, style: parser.style, title: parser.title, data: parser.data) else content_tag(:i, nil, class: parser.classes, style: parser.style, title: parser.title, data: parser.data) + content_tag(:span, parser.text, class: "fa5-text#{' ' unless parser.sizes.blank?}#{parser.sizes}", style: parser.style) end end def fa_stacked_icon(icon, options = {}) parser = FaStackedIconParser.new(icon, options) tags = content_tag :span, class: parser.span_classes, title: parser.title do content_tag(:i, nil, class: (parser.reverse ? parser.second_icon_classes : parser.first_icon_classes) ) + content_tag(:i, nil, class: (parser.reverse ? parser.first_icon_classes : parser.second_icon_classes) ) end tags += parser.text unless parser.text.nil? tags end def fa_layered_icon(options = {}, &block) parser = FaLayeredIconParser.new(options) if parser.size.nil? content_tag(:span, class: parser.classes, title: parser.title, style: parser.style, &block) else content_tag :div, class: "fa-#{parser.size}" do content_tag(:span, class: parser.classes, title: parser.title, style: parser.style, &block) end end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
font_awesome5_rails-0.3.2 | app/helpers/font_awesome5/rails/icon_helper.rb |