Module: Merb::Helpers::Form

Defined in:
lib/merb-sexy-forms/form.rb

Instance Method Summary collapse

Instance Method Details

#button(contents, attrs = {}, &blk) ⇒ Object



39
40
41
# File 'lib/merb-sexy-forms/form.rb', line 39

def button(contents, attrs = {}, &blk)
  current_form_context.button(contents, attrs, &blk)
end

#sexy_form(attrs = {}, &blk) ⇒ Object



2
3
4
5
6
# File 'lib/merb-sexy-forms/form.rb', line 2

def sexy_form(attrs = {}, &blk)
  with_form_context_without_name(Merb::Helpers::SexyForm::Builder::Base) do
    current_form_context.form(attrs, &blk)
  end
end

#sexy_form_for(name, attrs = {}, &blk) ⇒ Object



8
9
10
11
12
# File 'lib/merb-sexy-forms/form.rb', line 8

def sexy_form_for(name, attrs = {}, &blk)
  with_form_context(name, Merb::Helpers::SexyForm::Builder::Base) do
    current_form_context.form(attrs, &blk)
  end
end

#submit(contents, attrs = {}, &blk) ⇒ Object



35
36
37
# File 'lib/merb-sexy-forms/form.rb', line 35

def submit(contents, attrs = {}, &blk)
  current_form_context.submit(contents, attrs, &blk)
end

#with_form_context_without_name(builder) ⇒ Object



14
15
16
17
18
19
# File 'lib/merb-sexy-forms/form.rb', line 14

def with_form_context_without_name(builder)
  form_contexts.push((builder || self._default_builder).new(nil, nil, self))
  ret = yield
  form_contexts.pop
  ret
end