Ghost/ghost/admin/app/controllers/settings/design/index.js
Kevin Ansfield 8ec5b83097 Fixed save button on design settings screen
refs https://github.com/TryGhost/Team/issues/1130

- when moving the design settings screen from a modal to normal routes the save process was misplaced and the template not updated
- moved all the design settings behaviour over to the index controller where it belongs and updated the template to use `this.saveTask` rather than `@data.saveTask` as was used in the modal
2021-10-12 15:19:27 +01:00

34 lines
884 B
JavaScript

import Controller from '@ember/controller';
import {inject as service} from '@ember/service';
import {task} from 'ember-concurrency-decorators';
export default class SettingsDesignIndexController extends Controller {
@service config;
@service customThemeSettings;
@service notifications;
@service settings;
@service themeManagement;
@task
*saveTask() {
try {
if (this.settings.get('errors').length !== 0) {
return;
}
yield Promise.all([
this.settings.save(),
this.customThemeSettings.save()
]);
// ensure task button switches to success state
return true;
} catch (error) {
if (error) {
this.notifications.showAPIError(error);
throw error;
}
}
}
}