Module: EffectiveIconsHelper

Defined in:
app/helpers/effective_icons_helper.rb

Instance Method Summary collapse

Instance Method Details

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



43
44
45
# File 'app/helpers/effective_icons_helper.rb', line 43

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

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



30
31
32
33
# File 'app/helpers/effective_icons_helper.rb', line 30

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



26
27
28
# File 'app/helpers/effective_icons_helper.rb', line 26

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’)



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

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("icons/#{svg}.svg", options)
end

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



14
15
16
# File 'app/helpers/effective_icons_helper.rb', line 14

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

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



18
19
20
# File 'app/helpers/effective_icons_helper.rb', line 18

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

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



39
40
41
# File 'app/helpers/effective_icons_helper.rb', line 39

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

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



47
48
49
# File 'app/helpers/effective_icons_helper.rb', line 47

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

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



35
36
37
# File 'app/helpers/effective_icons_helper.rb', line 35

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

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



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

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