Module: EffectiveIconsHelper
- Defined in:
- app/helpers/effective_icons_helper.rb
Instance Method Summary collapse
- #approve_icon_to(path, options = {}) ⇒ Object
- #destroy_icon_to(path, options = {}) ⇒ Object
- #edit_icon_to(path, options = {}) ⇒ Object
-
#icon(svg, options = {}) ⇒ Object
icon(‘check’, class: ‘big-4’) icon(‘check’, class: ‘small-3’).
- #icon_to(svg, url, options = {}) ⇒ Object
- #new_icon_to(path, options = {}) ⇒ Object
- #ok_icon_to(path, options = {}) ⇒ Object
- #remove_icon_to(path, options = {}) ⇒ Object
- #settings_icon_to(path, options = {}) ⇒ Object
- #show_icon_to(path, options = {}) ⇒ Object
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, = {}) icon_to('ok', path, { title: 'Approve' }.merge()) 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, = {}) defaults = { title: 'Destroy', data: { method: :delete, confirm: 'Delete this item?' } } icon_to('trash', path, defaults.merge()) end |
#edit_icon_to(path, options = {}) ⇒ Object
28 29 30 |
# File 'app/helpers/effective_icons_helper.rb', line 28 def edit_icon_to(path, = {}) icon_to('edit', path, { title: 'Edit' }.merge()) 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, = {}) svg = svg.to_s.chomp('.svg') .reverse_merge!(nocomment: true) [:class] = [[:class], "eb-icon eb-icon-#{svg}"].compact.join(' ') inline_svg_tag("icons/#{svg}.svg", ) end |
#icon_to(svg, url, options = {}) ⇒ Object
16 17 18 |
# File 'app/helpers/effective_icons_helper.rb', line 16 def icon_to(svg, url, = {}) link_to(icon(svg), url, ) end |
#new_icon_to(path, options = {}) ⇒ Object
20 21 22 |
# File 'app/helpers/effective_icons_helper.rb', line 20 def new_icon_to(path, = {}) icon_to('plus', path, { title: 'New' }.merge()) end |
#ok_icon_to(path, options = {}) ⇒ Object
41 42 43 |
# File 'app/helpers/effective_icons_helper.rb', line 41 def ok_icon_to(path, = {}) icon_to('ok', path, { title: 'OK' }.merge()) end |
#remove_icon_to(path, options = {}) ⇒ Object
49 50 51 |
# File 'app/helpers/effective_icons_helper.rb', line 49 def remove_icon_to(path, = {}) icon_to('remove', path, { title: 'Remove' }.merge()) end |
#settings_icon_to(path, options = {}) ⇒ Object
37 38 39 |
# File 'app/helpers/effective_icons_helper.rb', line 37 def settings_icon_to(path, = {}) icon_to('cog', path, { title: 'Settings' }.merge()) end |
#show_icon_to(path, options = {}) ⇒ Object
24 25 26 |
# File 'app/helpers/effective_icons_helper.rb', line 24 def show_icon_to(path, = {}) icon_to('eye', path, { title: 'Show' }.merge()) end |