Module: FontAwesomeHelper::Helpers
- Defined in:
- lib/font-awesome-helper/helpers.rb
Constant Summary collapse
- FA_CLASS_PREFIX =
'fa'
Instance Method Summary collapse
- #fa_icon(names, options = {}) ⇒ Object
- #fa_li(names, options = {}) ⇒ Object
- #fa_ul(options = {}, &block) ⇒ Object
Instance Method Details
#fa_icon(names, options = {}) ⇒ Object
5 6 7 8 |
# File 'lib/font-awesome-helper/helpers.rb', line 5 def fa_icon(names, = {}) icon = FaIcon.new(names, ) (block_given? ? yield(icon.to_tag) : icon.to_tag).html_safe end |
#fa_li(names, options = {}) ⇒ Object
16 17 18 19 |
# File 'lib/font-awesome-helper/helpers.rb', line 16 def fa_li(names, = {}) content = fa_icon(names + ' li') { |i| "#{i}#{yield}" } content_tag :li, content, end |
#fa_ul(options = {}, &block) ⇒ Object
10 11 12 13 14 |
# File 'lib/font-awesome-helper/helpers.rb', line 10 def fa_ul( = {}, &block) classes = %W(#{FA_CLASS_PREFIX}-ul) classes += .delete(:class).split(' ') if .key? :class content_tag :ul, class: classes.join(' '), &block end |