Module: Spark::IconHelper

Defined in:
app/helpers/spark/icon_helper.rb

Instance Method Summary collapse

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, options={}, &block)
  options[:height] ||= '100%'
  options[:width]  ||= '100%'
   :span, class: 'svg-wrapper inline-icon' do
    use_svg name, options, &block
  end
end

#small_icon(name, options = {}) ⇒ Object



22
23
24
# File 'app/helpers/spark/icon_helper.rb', line 22

def small_icon(name, options={})
  use_svg(name, options.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, options={})
  options[:height] ||= '1em'
  span_options = {}

  span_options['aria-label'] = status.titlecase
  span_options[:class] = 'status-icon inline-icon has-tooltip'
  options[:desc] ||= status

   :span, span_options do
    use_svg "status-#{status}", options
  end
end

#svg(name, options = {}, &block) ⇒ Object



34
35
36
37
38
# File 'app/helpers/spark/icon_helper.rb', line 34

def svg(name, options={}, &block)
   :span, class: 'svg-wrapper' do
    use_svg name, options, &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.embed(keys)
  end
end