2014-09-23 17:12:01 -04:00
|
|
|
export default Ember.ObjectController.extend({
|
|
|
|
saving: false,
|
|
|
|
saved: false,
|
2013-04-04 12:59:44 -04:00
|
|
|
|
|
|
|
saveDisabled: function() {
|
2013-06-26 10:57:35 -04:00
|
|
|
if (this.get('saving')) { return true; }
|
2014-09-23 17:12:01 -04:00
|
|
|
if ((!this.get('content.allow_blank')) && Ember.empty(this.get('content.content'))) { return true; }
|
2013-04-04 12:59:44 -04:00
|
|
|
return false;
|
|
|
|
}.property('saving', 'content.content'),
|
|
|
|
|
2013-09-16 14:08:55 -04:00
|
|
|
actions: {
|
|
|
|
saveChanges: function() {
|
|
|
|
var self = this;
|
|
|
|
self.setProperties({saving: true, saved: false});
|
2014-09-23 17:12:01 -04:00
|
|
|
self.get('model').save().then(function () {
|
2013-09-16 14:08:55 -04:00
|
|
|
self.setProperties({saving: false, saved: true});
|
|
|
|
});
|
|
|
|
}
|
2013-04-04 12:59:44 -04:00
|
|
|
}
|
2013-09-16 14:08:55 -04:00
|
|
|
});
|