Skip to content

Instantly share code, notes, and snippets.

@cloke
Created August 14, 2014 22:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save cloke/5ae1b7f81220b4165175 to your computer and use it in GitHub Desktop.
Save cloke/5ae1b7f81220b4165175 to your computer and use it in GitHub Desktop.
transition
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