Sha256: d60077c876f3ba831e2da6852d0487636d99244e6ec1689a3639d99c475b1573

Contents?: true

Size: 711 Bytes

Versions: 8

Compression:

Stored size: 711 Bytes

Contents

module HatTrick
  module FormHelper
    def wizard_form_for(record, *args, &proc)
      options = args.extract_options!
      options[:html] = { :class => 'wizard' }

      wizard = controller.send(:hat_trick_wizard)
      wizard.start unless wizard.started?

      options[:url] = wizard.current_form_url
      options[:method] = wizard.current_form_method.to_sym

      output = ActiveSupport::SafeBuffer.new
      output.safe_concat(wizard_partial)

      # now run the default FormBuilder & append to output
      output << self.form_for(record, *(args << options), &proc)
    end

    private

    def wizard_partial
      controller.render_to_string(:partial => 'hat_trick/wizard_meta')
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
hat-trick-0.4.0 lib/hat_trick/form_helper.rb
hat-trick-0.3.0 lib/hat_trick/form_helper.rb
hat-trick-0.2.2 lib/hat_trick/form_helper.rb
hat-trick-0.2.1 lib/hat_trick/form_helper.rb
hat-trick-0.2.0 lib/hat_trick/form_helper.rb
hat-trick-0.1.5 lib/hat_trick/form_helper.rb
hat-trick-0.1.4 lib/hat_trick/form_helper.rb
hat-trick-0.1.3 lib/hat_trick/form_helper.rb