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