Class: Alchemy::Forms::Builder
- Inherits:
-
SimpleForm::FormBuilder
- Object
- SimpleForm::FormBuilder
- Alchemy::Forms::Builder
- Defined in:
- lib/alchemy/forms/builder.rb
Instance Method Summary collapse
-
#input(attribute_name, options = {}, &block) ⇒ Object
Renders a simple_form input, but uses input alchemy_wrapper.
-
#submit(label, options = {}) ⇒ Object
Renders a button tag wrapped in a div with ‘submit’ class.
Instance Method Details
#input(attribute_name, options = {}, &block) ⇒ Object
Renders a simple_form input, but uses input alchemy_wrapper
8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/alchemy/forms/builder.rb', line 8 def input(attribute_name, = {}, &block) [:wrapper] = :alchemy if object.respond_to?(:attribute_fixed?) && object.attribute_fixed?(attribute_name) [:disabled] = true [:input_html] = .fetch(:input_html, {}).merge( 'data-alchemy-tooltip' => Alchemy.t(:attribute_fixed, attribute_name) ) end super end |
#submit(label, options = {}) ⇒ Object
Renders a button tag wrapped in a div with ‘submit’ class.
23 24 25 26 27 28 29 30 |
# File 'lib/alchemy/forms/builder.rb', line 23 def submit(label, = {}) = { wrapper_html: {class: 'submit'} }.update() template.content_tag('div', .delete(:wrapper_html)) do template.content_tag('button', label, .delete(:input_html)) end end |