2015-08-07 14:05:08 -04:00
|
|
|
export default Ember.Controller.extend({
|
2014-09-23 17:12:01 -04:00
|
|
|
saved: false,
|
2013-04-04 12:59:44 -04:00
|
|
|
|
|
|
|
saveDisabled: function() {
|
2015-08-07 14:05:08 -04:00
|
|
|
if (this.get('model.isSaving')) { return true; }
|
|
|
|
if ((!this.get('allow_blank')) && Ember.isEmpty(this.get('model.value'))) { return true; }
|
2013-04-04 12:59:44 -04:00
|
|
|
return false;
|
2015-08-07 14:05:08 -04:00
|
|
|
}.property('model.iSaving', 'model.value'),
|
2013-04-04 12:59:44 -04:00
|
|
|
|
2013-09-16 14:08:55 -04:00
|
|
|
actions: {
|
2015-08-07 14:05:08 -04:00
|
|
|
saveChanges() {
|
|
|
|
const model = this.get('model');
|
|
|
|
model.save(model.getProperties('value')).then(() => this.set('saved', true));
|
2013-09-16 14:08:55 -04:00
|
|
|
}
|
2013-04-04 12:59:44 -04:00
|
|
|
}
|
2013-09-16 14:08:55 -04:00
|
|
|
});
|