Sha256: b2e4844751fb4eaa2f7075113628abc20d20797e709d7714de9d8d5773266915

Contents?: true

Size: 823 Bytes

Versions: 1

Compression:

Stored size: 823 Bytes

Contents

module JqueryUiForm 
  module Helpers
    module FormHelper
      attr_accessor :autofocus
      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
      
      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
      
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
jquery-ui-form-0.2.8 lib/jquery_ui_form/helpers/form_helper.rb