11
I need to create a wizard with multiple steps. Each step will display a form with options, and depending on the user choices, the wizard should go to a certain step, as well as keeping user preferences (choices) stored in some place.
These preferences are not saved in the model, they are only relevant to the step of model creation.
In order to give some context, the goal of this is:
- Make the user a few questions regarding the opening hours of his business. For example: Is it open on weekends?, Is it different in summer?.
- According to the answers to these questions, a final form will be displayed to create the timetable(s) model(s).
The question is, which would be the best way to accomplish this inside Ember?
Here are my –Ember newbie– thoughts:
- Create a template for each wizard step.
- Keep track of the current step. Where? Controller? Route?
- Display these templates into
outlets, which should be rendered dynamically according to the current step. This is where I get completely lost. How to do this? Should each step have a different route or not? - Keep track of user answers in the controller.
- Once the wizard is finished, load the form template, which will read user preferences stored in controller.
Versions being used:
- Ember.VERSION : 1.0.0-rc.1 application.js:9268
- Handlebars.VERSION : 1.0.0-rc.3 application.js:9268
- jQuery.VERSION : 1.9.1