Skip to content

Instantly share code, notes, and snippets.

@snewcomer
Created September 24, 2016 14:19
Show Gist options
  • Save snewcomer/756f7e9577bfa8aa241d8f1b844acf4d to your computer and use it in GitHub Desktop.
Save snewcomer/756f7e9577bfa8aa241d8f1b844acf4d to your computer and use it in GitHub Desktop.
/* 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