Created
July 11, 2012 13:15
-
-
Save vfilby/3090336 to your computer and use it in GitHub Desktop.
I am looking to have a wizard with three steps. The first to collect information necessary to build the model. It is necessary that I do this in steps because the model form is build dynamically based on the step 1 and step 2.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class NewWidgetController < ApplicationController | |
include Wicked::Wizard | |
steps :select_data_set, :select_type, :widget_settings | |
def show | |
render_wizard | |
end | |
def update | |
case step | |
when :select_data_set | |
# Catch form values and send them to the next step | |
# How do I render the next wizard step with the additional parameters? | |
when :select_type | |
# Catch form values and send them to the next step | |
when :widget_settings | |
# Build model and create | |
end | |
render_wizard | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- title "Choose your ammunition..." | |
= form_tag new_widget_path, :url => wizard_path, :method => :put, :class=>'form-horizontal' do | |
.control-group | |
= label_tag "Data set", nil, :class=>'control-label' | |
.controls | |
- options = DataSet.all.map { |data_set| [data_set.name,data_set.id] } | |
= select_tag :type, options_for_select(options) | |
.form-actions | |
= submit_tag :next, :class=>'btn btn-primary' | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment