zeus.ugent.be/lib/helpers/font_awesome.rb

15 lines
410 B
Ruby
Raw Permalink Normal View History

2016-08-04 19:17:45 +02:00
module FontAwesomeHelper
2016-12-12 14:34:43 +01:00
def fa(icon, opts = {})
2016-08-04 19:17:45 +02:00
classes = ['fa', "fa-#{icon}"]
2016-12-12 14:34:43 +01:00
classes << "fa-#{opts[:size]}" if opts[:size]
classes << 'fa-li' if opts[:li]
classes << "fa-stack-#{opts[:stack]}" if opts[:stack]
classes << 'fa-inverse' if opts[:inverse]
2017-10-11 00:33:37 +02:00
classes << 'fa-fw' if opts[:fw]
2016-12-12 14:34:43 +01:00
classes << opts[:class]
2016-08-04 19:17:45 +02:00
2016-12-12 14:34:43 +01:00
"<i class='#{classes.reject(&:nil?).join(' ')}'></i>"
2016-08-04 19:17:45 +02:00
end
end