mardi 3 février 2015

Ember flow control concept

I was wondering what is the best way to deal with the client side workflow. One example would be if we have a 5 step wizard (ie payment), and we want each step to communicate with the server: inputting new data in the db, validating, changing statuses, and returning some data.


(just a random example:) Lets say we have 2 cases of a web store: there are products where the buyer needs to be 21+, and products anyone can buy. If someone has a 21+ product in their cart, they would go to a 'proof of age' page, step 1 of a checkout wizard. Otherwise they would go to step 2. The server is responsible of telling the client which step to proceed to upon checkout.


What kind of format should this instruction be in? It can be an ember model, but then I would be needing probably hundreds of models for each 'instruction' in the application, and it seems to break the convention over configuration thing. There must be an easier and more practical way of doing this, but this my first SPA and I am a bit overwhelmed with these kinds of stuff.


I also thought of generating templates of each step on the server, and then returning those and compiling them. Also, each step under the wizard can have its own sub-route/template/controller.


I was just wondering what the general idea and approach would be, and a few resources where I could research some more as I cant find anything yet...





Aucun commentaire:

Enregistrer un commentaire