2021-01-21 12:11:51 +03:00
|
|
|
import AuthenticatedRoute from 'ghost-admin/routes/authenticated';
|
2021-08-04 13:22:19 +03:00
|
|
|
import {inject as service} from '@ember/service';
|
2021-01-21 12:11:51 +03:00
|
|
|
|
|
|
|
export default class DashboardRoute extends AuthenticatedRoute {
|
2021-08-04 13:22:19 +03:00
|
|
|
@service feature;
|
2022-02-01 20:32:38 +03:00
|
|
|
@service modals;
|
2021-08-04 13:22:19 +03:00
|
|
|
|
2022-02-01 20:32:38 +03:00
|
|
|
beforeModel(transition) {
|
2021-02-24 17:33:00 +03:00
|
|
|
super.beforeModel(...arguments);
|
2021-08-04 13:22:19 +03:00
|
|
|
|
2021-07-12 15:55:56 +03:00
|
|
|
if (!this.session.user.isAdmin) {
|
2021-07-08 16:37:31 +03:00
|
|
|
return this.transitionTo('site');
|
|
|
|
}
|
2022-02-01 20:32:38 +03:00
|
|
|
|
|
|
|
if (this.feature.improvedOnboarding && transition.to?.queryParams?.firstStart === 'true') {
|
|
|
|
this.modals.open('modals/get-started');
|
|
|
|
|
|
|
|
// clear the query param so it doesn't stick around
|
|
|
|
transition.abort();
|
|
|
|
const queryParams = Object.assign({}, transition.to.queryParams, {firstStart: false});
|
|
|
|
this.transitionTo('dashboard', {queryParams});
|
|
|
|
}
|
2021-02-24 17:33:00 +03:00
|
|
|
}
|
|
|
|
|
2021-02-16 20:12:24 +03:00
|
|
|
buildRouteInfoMetadata() {
|
|
|
|
return {
|
|
|
|
mainClasses: ['gh-main-wide']
|
|
|
|
};
|
|
|
|
}
|
2021-02-23 17:34:13 +03:00
|
|
|
|
|
|
|
setupController() {
|
|
|
|
this.controller.initialise();
|
|
|
|
}
|
2021-01-21 12:11:51 +03:00
|
|
|
}
|