Module: EffectiveIconsHelper

Defined in:
app/helpers/effective_icons_helper.rb

Instance Method Summary collapse

Instance Method Details

#approve_icon_to(path, options = {}) ⇒ Object



45
46
47
# File 'app/helpers/effective_icons_helper.rb', line 45

def approve_icon_to(path, options = {})
  icon_to('ok', path, { title: 'Approve' }.merge(options))
end

#destroy_icon_to(path, options = {}) ⇒ Object



32
33
34
35
# File 'app/helpers/effective_icons_helper.rb', line 32

def destroy_icon_to(path, options = {})
  defaults = { title: 'Destroy', data: { method: :delete, confirm: 'Delete this item?' } }
  icon_to('trash', path, defaults.merge(options))
end

#edit_icon_to(path, options = {}) ⇒ Object



28
29
30
# File 'app/helpers/effective_icons_helper.rb', line 28

def edit_icon_to(path, options = {})
  icon_to('edit', path, { title: 'Edit' }.merge(options))
end

#icon(svg, options = {}) ⇒ Object

icon(‘check’, class: ‘big-4’) icon(‘check’, class: ‘small-3’)



7
8
9
10
11
12
13
14
# File 'app/helpers/effective_icons_helper.rb', line 7

def icon(svg, options = {})
  svg = svg.to_s.chomp('.svg')

  options.reverse_merge!(nocomment: true)
  options[:class] = [options[:class], "eb-icon eb-icon-#{svg}"].compact.join(' ')

  inline_svg_tag("icons/#{svg}.svg", options)
end

#icon_to(svg, url, options = {}) ⇒ Object



16
17
18
# File 'app/helpers/effective_icons_helper.rb', line 16

def icon_to(svg, url, options = {})
  link_to(icon(svg), url, options)
end

#new_icon_to(path, options = {}) ⇒ Object



20
21
22
# File 'app/helpers/effective_icons_helper.rb', line 20

def new_icon_to(path, options = {})
  icon_to('plus', path, { title: 'New' }.merge(options))
end

#ok_icon_to(path, options = {}) ⇒ Object



41
42
43
# File 'app/helpers/effective_icons_helper.rb', line 41

def ok_icon_to(path, options = {})
  icon_to('ok', path, { title: 'OK' }.merge(options))
end

#remove_icon_to(path, options = {}) ⇒ Object



49
50
51
# File 'app/helpers/effective_icons_helper.rb', line 49

def remove_icon_to(path, options = {})
  icon_to('remove', path, { title: 'Remove' }.merge(options))
end

#settings_icon_to(path, options = {}) ⇒ Object



37
38
39
# File 'app/helpers/effective_icons_helper.rb', line 37

def settings_icon_to(path, options = {})
  icon_to('cog', path, { title: 'Settings' }.merge(options))
end

#show_icon_to(path, options = {}) ⇒ Object



24
25
26
# File 'app/helpers/effective_icons_helper.rb', line 24

def show_icon_to(path, options = {})
  icon_to('eye', path, { title: 'Show' }.merge(options))
end