Cleaning up new species a bit

This commit is contained in:
Matthew Dillon 2015-06-03 16:43:47 -08:00
parent b58e86a3fd
commit 886fda6843
9 changed files with 82 additions and 26 deletions

View file

@ -3,18 +3,12 @@ import Ember from 'ember';
export default Ember.Component.extend({
classNames: ['grid-1'],
isEditing: false,
isNew: false,
actions: {
editSpecies: function() {
this.get('species').get('errors').clear();
if (this.get('isNew')) {
this.get('species').destroyRecord().then(this.sendAction());
}
this.toggleProperty('isEditing');
this.get('species').rollback();
save: function() {
this.sendAction('save');
},
cancel: function() {
this.sendAction('cancel');
},
saveSpecies: function() {
this.get('species').save().then(this.toggleProperty('isEditing'));
}
}
});