mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-22 02:11:44 +03:00
8ec5b83097
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
34 lines
884 B
JavaScript
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;
|
|
}
|
|
}
|
|
}
|
|
}
|