model view controller - Ember.js - Creating a multistep wizard - How to? -


i need create wizard multiple steps. each step display form options, , depending on user choices, wizard should go step, keeping user preferences (choices) stored in place.

these preferences not saved in model, relevant step of model creation.

in order give context, goal of is:

  • make user few questions regarding opening hours of business. example: is open on weekends?, is different in summer?.
  • according answers these questions, final form displayed create timetable(s) model(s).

the question is, best way accomplish inside ember?

here –ember newbie– thoughts:

  • create template each wizard step.
  • keep track of current step. where? controller? route?
  • display these templates outlets, should rendered dynamically according current step. this lost. how this? should each step have different route or not?
  • keep track of user answers in controller.
  • once wizard finished, load form template, 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

sounds on right track.

create template each wizard step.

yes, start.

keep track of current step. where? controller? route?

either controller or route work. route makes sense if want bookmarkable urls each step , back/forward work , straightforward solution. assume you've chosen route.

display these templates outlets, should rendered dynamically according current step. lost. how this? should each step have different route or not?

since each step route, ember take care of rendering appropriate template automagically.

keep track of user answers in controller.

once wizard finished, load form template, read user preferences stored in controller.

think of "finished" step. each step gets it's own controller used record user responses. last controller uses "needs" access earlier controllers in order customize behavior based on responses wizard.


Comments

Popular posts from this blog

get url and add instance to a model with prefilled foreign key :django admin -

css - Make div keyboard-scrollable in jQuery Mobile? -

ruby on rails - Seeing duplicate requests handled with Unicorn -