Module: UiHelpers::ButtonHelpers
- Included in:
- ActionViewExtension
- Defined in:
- lib/ui_helpers/helpers/button.rb
Instance Method Summary collapse
- #ui_button_tag(content_or_options = nil, options = nil, &block) ⇒ Object
- #ui_button_to(name = nil, options = nil, html_options = nil, &block) ⇒ Object
- #ui_button_to_function(name, function = nil, html_options = {}) ⇒ Object
- #ui_link_to(name = nil, options = nil, html_options = nil, &block) ⇒ Object
- #ui_link_to_function(name, function, html_options = {}) ⇒ Object
- #ui_submit_tag(value = "Save changes", options = {}) ⇒ Object
Instance Method Details
#ui_button_tag(content_or_options = nil, options = nil, &block) ⇒ Object
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/ui_helpers/helpers/button.rb', line 3 def ( = nil, = nil, &block) if block_given? && .is_a?(Hash) content, = capture(&block), else content, = , end ||= {} = .stringify_keys = .delete("ui")||{} [:text] = content = UiHelpers::Button.new(self, ) .merge!(.) (.content, ) end |
#ui_button_to(name = nil, options = nil, html_options = nil, &block) ⇒ Object
53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 |
# File 'lib/ui_helpers/helpers/button.rb', line 53 def (name = nil, = nil, = nil, &block) # no icon support for input elements if block_given? content, path, = capture(&block), name, else content, path, = name, , end ||= {} = .stringify_keys = .delete("ui")||{} = UiHelpers::Button.new(self, ) .merge!(.) (content, path, ) end |
#ui_button_to_function(name, function = nil, html_options = {}) ⇒ Object
71 72 73 74 75 76 77 78 79 80 81 82 |
# File 'lib/ui_helpers/helpers/button.rb', line 71 def (name, function=nil, ={}) content = name = = .stringify_keys = .delete("ui")||{} = UiHelpers::Button.new(self, ) .merge!(.) (content, function, ) end |
#ui_link_to(name = nil, options = nil, html_options = nil, &block) ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/ui_helpers/helpers/button.rb', line 21 def ui_link_to(name = nil, = nil, = nil, &block) if block_given? content, path, = capture(&block), name, else content, path, = name, , end ||= {} = .stringify_keys = .delete("ui")||{} [:text] = content = UiHelpers::Button.new(self, ) .merge!(.) link_to(.content, path, ) end |
#ui_link_to_function(name, function, html_options = {}) ⇒ Object
39 40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/ui_helpers/helpers/button.rb', line 39 def ui_link_to_function(name, function, ={}) content = name = = .stringify_keys = .delete("ui")||{} [:text] = content = UiHelpers::Button.new(self, ) .merge!(.) link_to_function(.content, function, ) end |
#ui_submit_tag(value = "Save changes", options = {}) ⇒ Object
84 85 86 87 88 89 90 91 92 93 94 |
# File 'lib/ui_helpers/helpers/button.rb', line 84 def ui_submit_tag(value = "Save changes", = {}) content = value = .stringify_keys = .delete("ui")||{} = UiHelpers::Button.new(self, ) .merge!(.) submit_tag(content, ) end |