Save measurement
This commit is contained in:
parent
15474c76f3
commit
b2fa171d17
7 changed files with 25 additions and 11 deletions
|
@ -1,5 +1,6 @@
|
|||
import Ember from 'ember';
|
||||
import SaveModel from '../../../../mixins/save-model';
|
||||
import ajaxError from '../../../../utils/ajax-error';
|
||||
|
||||
const { Controller } = Ember;
|
||||
|
||||
|
@ -14,5 +15,14 @@ export default Controller.extend(SaveModel, {
|
|||
characteristic: this.store.createRecord('characteristic', { sortOrder: -999 }),
|
||||
});
|
||||
},
|
||||
|
||||
saveMeasurement: function(measurement) {
|
||||
measurement.save().then(() => {
|
||||
this.get('flashMessages').clearMessages();
|
||||
}, () => {
|
||||
ajaxError(measurement.get('errors'), this.get('flashMessages'));
|
||||
});
|
||||
},
|
||||
|
||||
},
|
||||
});
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
speciesList=speciesList
|
||||
add-characteristic=(action "addCharacteristic")
|
||||
allCharacteristics=allCharacteristics
|
||||
save-measurement=(action "saveMeasurement")
|
||||
on-save=(action "save")
|
||||
on-cancel=(action "cancel")
|
||||
}}
|
||||
|
|
Reference in a new issue