Ghost/ghost/admin/app/routes/dashboard-labs.js
Kevin Ansfield cf6ef942a5 Added dashboardTwo labs flag
no issue

- added `dashboardTwo` feature flag and labs screen toggle
- added `dashboard-labs` route with duplicated dashboard controller/template
- added redirect to `dashboard` route so it transitions to `dashboard-labs` when the feature is enabled
2021-08-04 11:22:19 +01:00

29 lines
655 B
JavaScript

import AuthenticatedRoute from 'ghost-admin/routes/authenticated';
import {inject as service} from '@ember/service';
export default class DashboardRoute extends AuthenticatedRoute {
@service feature;
beforeModel() {
super.beforeModel(...arguments);
if (!this.session.user.isAdmin) {
return this.transitionTo('site');
}
if (!this.feature.dashboardTwo) {
return this.transitionTo('dashboard');
}
}
buildRouteInfoMetadata() {
return {
mainClasses: ['gh-main-wide']
};
}
setupController() {
this.controller.initialise();
}
}