Created
September 24, 2016 14:19
-
-
Save snewcomer/756f7e9577bfa8aa241d8f1b844acf4d to your computer and use it in GitHub Desktop.
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
/* app/routes/application.js */ | |
cancel(model, transitionToRoute) { | |
// relationshipsIsDirty is custom. hasDirtyAttributes comes with Ember Data | |
if (model.get('hasDirtyAttributes') || model.get('relationshipsIsDirty')) { | |
Ember.$('#crud').openModal(); | |
// other stuff....attach the model and transitionToRoute to a transition service to be used when user clicks yes/no in modal | |
} else { | |
if (model.get('isNew')) { | |
model.deleteRecord(); | |
} | |
this.transitionTo(transitionToRoute); | |
} | |
}, |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment