Module: Spark::IconHelper
- Defined in:
- app/helpers/spark/icon_helper.rb
Instance Method Summary collapse
- #inline_icon(name, options = {}, &block) ⇒ Object
- #small_icon(name, options = {}) ⇒ Object
- #status_icon(status, options = {}) ⇒ Object
- #svg(name, options = {}, &block) ⇒ Object
- #svg_symbols(*keys) ⇒ Object
Instance Method Details
#inline_icon(name, options = {}, &block) ⇒ Object
26 27 28 29 30 31 32 |
# File 'app/helpers/spark/icon_helper.rb', line 26 def inline_icon(name, ={}, &block) [:height] ||= '100%' [:width] ||= '100%' content_tag :span, class: 'svg-wrapper inline-icon' do use_svg name, , &block end end |
#small_icon(name, options = {}) ⇒ Object
22 23 24 |
# File 'app/helpers/spark/icon_helper.rb', line 22 def small_icon(name, ={}) use_svg(name, .merge({width: '25px'})) end |
#status_icon(status, options = {}) ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'app/helpers/spark/icon_helper.rb', line 9 def status_icon (status, ={}) [:height] ||= '1em' = {} ['aria-label'] = status.titlecase [:class] = 'status-icon inline-icon has-tooltip' [:desc] ||= status content_tag :span, do use_svg "status-#{status}", end end |
#svg(name, options = {}, &block) ⇒ Object
34 35 36 37 38 |
# File 'app/helpers/spark/icon_helper.rb', line 34 def svg(name, ={}, &block) content_tag :span, class: 'svg-wrapper' do use_svg name, , &block end end |
#svg_symbols(*keys) ⇒ Object
3 4 5 6 7 |
# File 'app/helpers/spark/icon_helper.rb', line 3 def svg_symbols(*keys) unless Rails.env.production? Esvg.(keys) end end |