Class: Alchemy::Forms::Builder

Inherits:
SimpleForm::FormBuilder
  • Object
show all
Defined in:
lib/alchemy/forms/builder.rb

Instance Method Summary collapse

Instance Method Details

#input(attribute_name, options = {}, &block) ⇒ Object

Renders a simple_form input, but uses input alchemy_wrapper



7
8
9
10
# File 'lib/alchemy/forms/builder.rb', line 7

def input(attribute_name, options = {}, &block)
  options[:wrapper] = :alchemy
  super
end

#submit(label, options = {}) ⇒ Object

Renders a button tag wrapped in a div with ‘submit’ class.



14
15
16
17
18
19
# File 'lib/alchemy/forms/builder.rb', line 14

def submit(label, options = {})
  options = {class: 'submit'}.update(options[:wrapper_html] || {})
  template.('div', options) do
    template.('button', label, options[:input_html])
  end
end