jamesplease / gistbook

[No longer hosted] A place to write about technical subjects on the web.
MIT License
88 stars 16 forks source link

Warn when navigating away from an unsaved Gistbook #198

Open jamesplease opened 9 years ago

jamesplease commented 9 years ago

Right now it's too easy to lose your changes to a Gistbook.

Update I thought that this could be handled in the Router alone, but that is unsufficient. Backbone.Intercept is causing the URL to be updated no matter what, even when the route prevents the active route, and therefore, the ui, from changing.

Update2 If I overwrite bb.intercept's navigate method to call the router's navigate method, then check the route there instead of later on, then all should be well.

:dancers:

jamesplease commented 9 years ago

For me to check the route in the router's navigate method, I'll need to match the route from the URI. That sucks. I'd like to implement a route-by-name feature so that I can do a quicker, less-terrible lookup.