Module: JqueryUiForm::Helpers::FormHelper

Defined in:
lib/jquery_ui_form/helpers/form_helper.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#autofocusObject

Returns the value of attribute autofocus.



4
5
6
# File 'lib/jquery_ui_form/helpers/form_helper.rb', line 4

def autofocus
  @autofocus
end

Instance Method Details

#jquery_fields_for(name, *args, &block) ⇒ Object



16
17
18
19
20
# File 'lib/jquery_ui_form/helpers/form_helper.rb', line 16

def jquery_fields_for(name, *args, &block)
  options = args.last.is_a?(Hash) ? args.pop : {}
  options[:builder] ||= JqueryUiForm::FormBuilder
  fields_for(name, *(args << options), &block)
end

#jquery_form_for(name, *args, &block) ⇒ Object



5
6
7
8
9
10
11
12
13
14
# File 'lib/jquery_ui_form/helpers/form_helper.rb', line 5

def jquery_form_for(name, *args, &block)
  options = args.last.is_a?(Hash) ? args.pop : {}
  options[:builder] ||= JqueryUiForm::FormBuilder
  options[:html] ||= {}
  options[:html][:novalidate] ||= options.delete(:novalidate)
  self.autofocus = options.delete(:autofocus)
  self.autofocus = true if self.autofocus.nil?
  (options[:html][:class] ||= "") << " ui-form"
  form_for(name, *(args << options), &block)
end