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



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

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.



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

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