-
Notifications
You must be signed in to change notification settings - Fork 51
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Rebasing memento on current state #23
Comments
interesting timing... i blogged about decorating a model w/ memento just a few minutes ago: http://derickbailey.com/2014/09/09/decorating-a-backbone-model-with-features-for-a-ui-component/ in your situation, this could work out the way you want without having to modify memento in any way. rather than having memento baked in to the model directly, you could use a decorator to add the feature where you need it. |
We're already doing that. I'm using Cocktail to mix this behavior in:
My problem is that there's no way to stop somebody from restoring past a certain "version". So when someone clicks "save", I can disable the "cancel" button when the model's sync comes back, but when they make some changes, the button becomes available again (enabled on |
ok. probably should add something like that in to memento... out of curiosity, where is that code happening, for the mixin? are you allowing people to make multiple edits / saves before moving away from the edit screen? In my own use of the decorator w/ memento, whenever the edit screen closes, the memento goes away and therefore cannot be rolled back any further. |
In this case, saving doesn't move you away from the edit screen. We have a collection of models, each has its own tab, but there is no "list" to go back to when saving, so you stay in the same screen and get a notification "flash" on top of the screen when save is successful. |
We're using Memento in combination with Stickit to drive our forms. In this particular case, we have a collection, which allows editing of a single model at a time. When you navigate away, the changes are obviously still there in the model, so when you come back to edit this model, you'll see the old state. This is all expected behavior, but here's where I'm running into a limitation:
memento.store()
so we have initial state.Would it be useful to have a method to set a new "starting point" so people can't
restore
to beyond that point, or have a configuration option to automatically do that when an entity is persisted?The text was updated successfully, but these errors were encountered: