At drivers can create rides from one point to another, optionally via up to three points.

Creating a new ride

When a valid route has been chosen, the user presses the green Next button to choose dates in the next step. The last step of the wizard allows filling in price and other details.

Creating a new ride

This is currently implemented using only jQuery. Data is either held by the form fields or stored in data attributes (only the lat/lng values for the geocoded fields). Validation is simply some JS that runs when going to the next wizard page.

This has worked OK so far althought the JS i a bit of a mess (and with some duplication between this and the edit page). But soon we will be adding a more detailed pricing system, allowing the driver to select individual prices for the different legs of a ride. This will make validation much more complicated and create a coupling between different wizard pages.

Generally, it is safe to assume that the complexity of this UI is only going up. Also, there is a corresponding edit page which is very similar except not laid out as a wizard. I am hoping to share more logic between the two going forward.

So my current client side “model” is getting out of hand quickly and I am looking for a more structured approach. Having almost no experience with JS frameworks, I would really appreciate help on these issues:

  1. Would Backbone.js be a good match here? Most tutorials and examples I have found are about SPAs (single page apps), so I’m still wondering if it even makes sense to create a mini-Backbone app just for at single complex Rails view.

  2. Do I need to use the Backbone router? Maybe it would make sense to let each wizard page have its own URL?

  3. Must I rewrite my controller to be RESTful? Right now I’m just populating a form from the controller and reading it back on POST. Does it make sense to keep this model, just using my Backbone models to fill out the form, or should I rethink this view completely?

  4. Should I be considering other JS frameworks? I’m unsure if Backbone is too opinionated or restrictive as a tool on a website that will still, for the foreseeable future at least, be a traditional server side app.

I would really appreciate your comments, either in the form below or to Thanks!