Class: Caisson::Helpers::Form::Button
- Inherits:
-
Object
- Object
- Caisson::Helpers::Form::Button
- Defined in:
- lib/caisson/helpers/form/button.rb
Instance Method Summary collapse
-
#build(text, options = {}) ⇒ Object
************************************************************************************* PUBLIC INSTANCE METHODS *************************************************************************************.
- #build_button_to(text, url, options = {}) ⇒ Object
-
#initialize(core) ⇒ Button
constructor
************************************************************************************* CONSTRUCTOR *************************************************************************************.
Constructor Details
#initialize(core) ⇒ Button
************************************************************************************* CONSTRUCTOR *************************************************************************************
9 10 11 |
# File 'lib/caisson/helpers/form/button.rb', line 9 def initialize(core) @core = core end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(*args, &block) ⇒ Object (private)
60 |
# File 'lib/caisson/helpers/form/button.rb', line 60 def method_missing(*args, &block) return @core.send(*args, &block) end |
Instance Method Details
#build(text, options = {}) ⇒ Object
************************************************************************************* PUBLIC INSTANCE METHODS *************************************************************************************
17 18 19 20 21 22 23 24 25 |
# File 'lib/caisson/helpers/form/button.rb', line 17 def build(text, ={}) .reverse_merge!(class: '', confirm: nil, default: true, disabled: false, url: nil) if [:url] return link(text, .delete(:url), ) else return (text, ) end end |
#build_button_to(text, url, options = {}) ⇒ Object
27 28 29 30 31 32 33 34 35 |
# File 'lib/caisson/helpers/form/button.rb', line 27 def (text, url, ={}) .reverse_merge!(class: '', confirm: nil, disabled: false, method: 'get', url: nil, vars: {}) vars = .delete(:vars) return form_tag(url, method: [:method], class: "button_to") do (vars.map{ |k,v| hidden_field_tag(k, v) }.join("\n") + (text, )).html_safe end end |