Module: MyHelper
- Defined in:
- app/helpers/my_helper.rb
Overview
Helper methods for user context
Instance Method Summary collapse
- #my_destroy_icon(entity, options = {}) ⇒ Object
- #my_edit_icon(entity, options = {}) ⇒ Object
- #my_icon_with_link(source, path, title = '', options = {}) ⇒ Object
Instance Method Details
#my_destroy_icon(entity, options = {}) ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 |
# File 'app/helpers/my_helper.rb', line 16 def my_destroy_icon(entity, = {}) title = .delete(:title) { t(:edit) } key = entity.respond_to?(:uuid) ? entity.uuid : entity.id path = "/my/#{entity.class.table_name}/#{key}" default = { class: 'danger', data: { confirm: t(:are_you_sure) }, method: :delete, } my_icon_with_link('biovision/icons/destroy.svg', path, title.to_s, default.merge()) end |
#my_edit_icon(entity, options = {}) ⇒ Object
7 8 9 10 11 12 |
# File 'app/helpers/my_helper.rb', line 7 def my_edit_icon(entity, = {}) title = .delete(:title) { t(:edit) } key = entity.respond_to?(:uuid) ? entity.uuid : entity.id path = "/my/#{entity.class.table_name}/#{key}/edit" my_icon_with_link('biovision/icons/edit.svg', path, title.to_s, ) end |
#my_icon_with_link(source, path, title = '', options = {}) ⇒ Object
31 32 33 |
# File 'app/helpers/my_helper.rb', line 31 def my_icon_with_link(source, path, title = '', = {}) link_to(image_tag(source, alt: title), path, ) end |