Module: UiHelpers::LinkHelpers
- Included in:
- ActionViewExtension
- Defined in:
- lib/ui_helpers/helpers/link.rb
Instance Method Summary collapse
- #link_with_icon_to(name = nil, options = nil, html_options = nil, &block) ⇒ Object
- #link_with_icon_to_function(name, function, html_options = {}) ⇒ Object
Instance Method Details
#link_with_icon_to(name = nil, options = nil, html_options = nil, &block) ⇒ Object
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/ui_helpers/helpers/link.rb', line 3 def link_with_icon_to(name = nil, = nil, = nil, &block) if block_given? content, path, = capture(&block), name, else content, path, = name, , end ||= {} = .stringify_keys ["style"] = [["style"], "white-space: nowrap;"].compact.join(" ") icon = .delete("icon") content = UiHelpers::LinkIcon.new(self, icon).tag(:span) + content link_to(content, path, ) end |
#link_with_icon_to_function(name, function, html_options = {}) ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/ui_helpers/helpers/link.rb', line 20 def link_with_icon_to_function(name, function, ={}) content = name = = .stringify_keys ["style"] = [["style"], "white-space: nowrap;"].compact.join(" ") icon = .delete("icon") content = UiHelpers::LinkIcon.new(self, icon).tag(:span) + content link_to_function(content, function, ) end |