Module: IconHelper
- Defined in:
- app/helpers/icon_helper.rb
Defined Under Namespace
Classes: IconCreator
Instance Method Summary collapse
- #icon(type = nil, options = {}) ⇒ Object
- #icon_list(options = {}, &block) ⇒ Object
- #icon_list_item(content_or_options, options = {}, &block) ⇒ Object
Instance Method Details
#icon(type = nil, options = {}) ⇒ Object
96 97 98 99 100 |
# File 'app/helpers/icon_helper.rb', line 96 def icon(type=nil, ={}) raise 'Please provide an icon type!' if type.blank? IconCreator.new(type, ).render end |
#icon_list(options = {}, &block) ⇒ Object
102 103 104 105 106 |
# File 'app/helpers/icon_helper.rb', line 102 def icon_list(={}, &block) prepend_class(, 'fa-ul') content_tag :ul, , &block end |
#icon_list_item(content_or_options, options = {}, &block) ⇒ Object
108 109 110 111 112 113 114 115 116 |
# File 'app/helpers/icon_helper.rb', line 108 def icon_list_item(, ={}, &block) content, = (, ) = .delete(:icon_html) icon = icon(.delete(:type), ) content_tag :li, do (icon + (content.presence || capture(&block))).html_safe end end |