mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-15 19:52:01 +03:00
7251b1acac
no issue - moved navigation settings tests from old settings/design tests to a separate file and unskipped them - added happy-path acceptance tests for - rendering design screen - installing an official theme from the themes list - uploading a custom theme
52 lines
1.4 KiB
JavaScript
52 lines
1.4 KiB
JavaScript
import AuthenticatedRoute from 'ghost-admin/routes/authenticated';
|
|
import {inject as service} from '@ember/service';
|
|
|
|
export default class SettingsDesignRoute extends AuthenticatedRoute {
|
|
@service customThemeSettings;
|
|
@service feature;
|
|
@service modals;
|
|
@service settings;
|
|
@service themeManagement;
|
|
@service ui;
|
|
|
|
beforeModel() {
|
|
super.beforeModel(...arguments);
|
|
|
|
if (!this.session.user.isAdmin) {
|
|
return this.transitionTo('site');
|
|
}
|
|
|
|
if (!this.feature.customThemeSettings) {
|
|
return this.transitionTo('settings');
|
|
}
|
|
}
|
|
|
|
model() {
|
|
// background refresh of preview
|
|
// not doing it on the 'index' route so that we don't reload going to/from the index,
|
|
// any actions performed on child routes that need a refresh should trigger it explicitly
|
|
this.themeManagement.updatePreviewHtmlTask.perform();
|
|
|
|
// wait for settings to be loaded - we need the data to be present before display
|
|
return Promise.all([
|
|
this.settings.reload(),
|
|
this.customThemeSettings.load()
|
|
]);
|
|
}
|
|
|
|
activate() {
|
|
this.ui.contextualNavMenu = 'design';
|
|
}
|
|
|
|
deactivate() {
|
|
this.ui.contextualNavMenu = null;
|
|
}
|
|
|
|
buildRouteInfoMetadata() {
|
|
return {
|
|
titleToken: 'Settings - Design',
|
|
mainClasses: ['gh-main-fullwidth']
|
|
};
|
|
}
|
|
}
|