Ghost/ghost/admin/app/controllers/settings/apps/amp.js
Aileen Nowak f1c8680f53 🐛 Make cmd+s work for all save-buttons (#700)
closes TryGhost/Ghost#8443
- Fixes a bug where the keyboard shortcut `cmd+s` would cause a `Maximum call stack size` error and not save.
- Wherever there is a `save` button, the keyboard shortcut to save works now.
2017-05-18 11:48:37 +01:00

37 lines
817 B
JavaScript

import Controller from 'ember-controller';
import injectService from 'ember-service/inject';
import {task} from 'ember-concurrency';
import {alias} from 'ember-computed';
export default Controller.extend({
notifications: injectService(),
settings: injectService(),
model: alias('settings.amp'),
save: task(function* () {
let amp = this.get('model');
let settings = this.get('settings');
settings.set('amp', amp);
try {
return yield settings.save();
} catch (error) {
this.get('notifications').showAPIError(error);
throw error;
}
}).drop(),
actions: {
update(value) {
this.set('model', value);
},
save() {
this.get('save').perform();
}
}
});