conveyal / otp.js

OTP Javascript Client & Data Bindings
MIT License
19 stars 20 forks source link

WIP Add multiple Routers support #67

Closed buma closed 4 years ago

buma commented 9 years ago

I started adding multiple routers support for #46. Idea is to query OTP server for a list of routers. And when one is chosen query to see which region it supports to show only map in correct location.

I added request and response object but I'm not sure how to add the rest of the code.

abyrd commented 9 years ago

Currently this PR contains only the domain model classes. @trevorgerhardt, @buma has reviewed backbone documentation but is unsure how/where to actually trigger the request to the OTP server. This is something that would need to happen only at page load/startup.

abyrd commented 9 years ago

@trevorgerhardt, more generally we need to add some new functionality to the client, but it's not clear how/where to insert code to update UI details based on information from the OTP server (e.g. get the list of available regions, get the list of available transportation modes on the server). Would you be able to give a quick course on how this works, or even implement these changes if they're minor?

trevorgerhardt commented 9 years ago

Do we want the user to be able to switch between routers? With a dropdown for example?

buma commented 9 years ago

Yes.

2015-07-31 15:58 GMT+02:00 Trevor Gerhardt notifications@github.com:

Do we want the user to be able to switch between routers? With a dropdown for example?

— Reply to this email directly or view it on GitHub https://github.com/conveyal/otp.js/pull/67#issuecomment-126699578.

trevorgerhardt commented 9 years ago

If we want to change which router we're querying then we need to expose that setting for other parts of the library that will want to use it. Have a default router, on page load query OTP, if there is more than one router expose the dropdown, on selection set the router and re-position the map. Save that selection for future usage.

Not sure if we need full blown router models/collections. I'd split it up into a simple view that controls the dropdown, a static configuration value that we can access throughout the library, and a function that we can call from client.js to kick off the query/population process and does all of the checking and setting of values.