Module: RailsTheme::Bootstrap::LinkHelper
- Defined in:
- app/helpers/rails_theme/bootstrap/link_helper.rb
Instance Method Summary collapse
- #iconed_link_to(text, url, options = {}) ⇒ Object
- #link_to_destroy(url, options = {}) ⇒ Object
- #link_to_edit(url, options = {}) ⇒ Object
- #link_to_new(url, options = {}) ⇒ Object
- #link_to_show(url, options = {}) ⇒ Object
Instance Method Details
#iconed_link_to(text, url, options = {}) ⇒ Object
4 5 6 7 8 |
# File 'app/helpers/rails_theme/bootstrap/link_helper.rb', line 4 def iconed_link_to text, url, = {} icon_class = .delete(:icon_class) text = content_tag(:i, nil, class: icon_class) << ' ' << text link_to text, url, end |
#link_to_destroy(url, options = {}) ⇒ Object
41 42 43 44 45 46 47 48 49 50 51 |
# File 'app/helpers/rails_theme/bootstrap/link_helper.rb', line 41 def link_to_destroy url, = {} icon_class = .delete(:icon_class) || 'icon-trash' = { method: :delete, data: { confirm: t('helpers.are_you_sure') }, class: 'btn', icon_class: icon_class, title: t('helpers.destroy') }.deep_merge iconed_link_to nil, url, end |
#link_to_edit(url, options = {}) ⇒ Object
31 32 33 34 35 36 37 38 39 |
# File 'app/helpers/rails_theme/bootstrap/link_helper.rb', line 31 def link_to_edit url, = {} icon_class = .delete(:icon_class) || 'icon-edit' = { class: 'btn', icon_class: icon_class, title: t('helpers.edit') }.deep_merge iconed_link_to nil, url, end |
#link_to_new(url, options = {}) ⇒ Object
21 22 23 24 25 26 27 28 29 |
# File 'app/helpers/rails_theme/bootstrap/link_helper.rb', line 21 def link_to_new url, = {} icon_class = .delete(:icon_class) || 'icon-plus' = { class: 'btn', icon_class: icon_class, title: t('helpers.new') }.deep_merge iconed_link_to nil, url, end |
#link_to_show(url, options = {}) ⇒ Object
10 11 12 13 14 15 16 17 18 19 |
# File 'app/helpers/rails_theme/bootstrap/link_helper.rb', line 10 def link_to_show url, = {} icon_class = .delete(:icon_class) || 'icon-eye-open' = { class: 'btn', icon_class: icon_class, title: t('helpers.show') }.deep_merge = { } iconed_link_to nil, url, end |