Module: JqueryUiForm::Helpers::WrapperHelper

Included in:
FormBuilder
Defined in:
lib/jquery_ui_form/helpers/wrapper_helper.rb

Instance Method Summary collapse

Instance Method Details

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



34
35
36
37
# File 'lib/jquery_ui_form/helpers/wrapper_helper.rb', line 34

def buttons(options = {}, &block)
  options[:mode] = "buttons"
  wrapper(options, &block)
end

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



24
25
26
27
# File 'lib/jquery_ui_form/helpers/wrapper_helper.rb', line 24

def column(options = {}, &block)
  options[:mode] = "column"
  wrapper(options, &block)
end

#fieldset(*args, &block) ⇒ Object



13
14
15
16
17
18
19
20
21
22
# File 'lib/jquery_ui_form/helpers/wrapper_helper.rb', line 13

def fieldset(*args, &block)
  legend = ""
  legend = args.shift unless args.first.is_a?(Hash)
  html_options = args.extract_options!
  html_options[:class] = "#{html_options[:class]} ui-fieldset"
  template.(:fieldset,html_options) do
    template.concat(template.(:legend, legend, html_options[:html_legend])) unless legend.blank?
    yield
  end
end

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



29
30
31
32
# File 'lib/jquery_ui_form/helpers/wrapper_helper.rb', line 29

def row(options = {}, &block)
  options[:mode] = "row"
  wrapper(options, &block)
end

#wrapper(*args, &block) ⇒ Object



5
6
7
8
9
10
11
# File 'lib/jquery_ui_form/helpers/wrapper_helper.rb', line 5

def wrapper(*args, &block)
  html_options = args.extract_options!
  html_options[:class] = "#{html_options[:class]} ui-form-#{html_options.delete(:mode) || 'wrapper'}"
  template.(:div, html_options) do
    yield
  end
end