Created
August 14, 2014 22:29
-
-
Save cloke/5ae1b7f81220b4165175 to your computer and use it in GitHub Desktop.
transition
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
willTransition: (transition) -> | |
context = @get 'context' | |
return false unless context | |
if context.get('isDirty') && !confirm 'You have unsaved changes are you sure you want to continue?' | |
transition.abort() | |
return false | |
if context.get('isNew') | |
context.deleteRecord() | |
else if context.get('isDeleted') | |
# do nothing | |
else | |
context.rollback() | |
context.reload() | |
true |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment