Ghost/ghost/admin/app/controllers/settings/apps/amp.js
Kevin Ansfield ad98a9a072 🎨 refactor settings screens to use ember-concurrency & gh-task-button
refs https://github.com/TryGhost/Ghost/issues/7865
- updates all settings screens to use EC tasks and `gh-task-button` to get save-state save buttons
- removes now-unused `settings-save` mixin
- moves the order of button color CSS so that grey buttons can change to green/red after completing
- removes the heading from `apps-loading` template so that there's no odd flash when loading slack/amp screens directly
2017-03-08 10:00:03 -07:00

32 lines
693 B
JavaScript

import Controller from 'ember-controller';
import injectService from 'ember-service/inject';
import {task} from 'ember-concurrency';
export default Controller.extend({
notifications: injectService(),
// will be set by route
settings: null,
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);
}
}
});