2022-02-01 12:34:03 +03:00
|
|
|
import Controller from '@ember/controller';
|
2022-11-03 14:14:36 +03:00
|
|
|
import {inject} from 'ghost-admin/decorators/inject';
|
2022-10-07 19:56:55 +03:00
|
|
|
import {inject as service} from '@ember/service';
|
2022-02-01 12:34:03 +03:00
|
|
|
|
|
|
|
export default class ApplicationController extends Controller {
|
2022-02-01 20:03:45 +03:00
|
|
|
@service billing;
|
2022-10-07 16:32:54 +03:00
|
|
|
@service explore;
|
2022-02-01 20:03:45 +03:00
|
|
|
@service router;
|
|
|
|
@service session;
|
|
|
|
@service settings;
|
|
|
|
@service ui;
|
2023-03-02 21:39:38 +03:00
|
|
|
@service upgradeStatus;
|
2022-02-01 12:34:03 +03:00
|
|
|
|
2022-11-03 14:14:36 +03:00
|
|
|
@inject config;
|
|
|
|
|
2022-10-07 19:56:55 +03:00
|
|
|
get showBilling() {
|
|
|
|
return this.config.hostSettings?.billing?.enabled;
|
|
|
|
}
|
2015-05-26 05:10:50 +03:00
|
|
|
|
2022-02-01 12:34:03 +03:00
|
|
|
get showNavMenu() {
|
2021-03-17 15:00:14 +03:00
|
|
|
let {router, session, ui} = this;
|
2019-05-06 16:51:23 +03:00
|
|
|
|
2018-07-26 14:53:23 +03:00
|
|
|
// if we're in fullscreen mode don't show the nav menu
|
2021-03-17 15:00:14 +03:00
|
|
|
if (ui.isFullScreen) {
|
2018-07-26 14:53:23 +03:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2017-02-01 22:19:42 +03:00
|
|
|
// we need to defer showing the navigation menu until the session.user
|
2021-07-08 16:37:31 +03:00
|
|
|
// is populated so that gh-user-can-admin has the correct data
|
|
|
|
if (!session.isAuthenticated || !session.user) {
|
2017-02-01 22:19:42 +03:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2021-03-17 15:00:14 +03:00
|
|
|
return (router.currentRouteName !== 'error404' || session.isAuthenticated)
|
|
|
|
&& !router.currentRouteName.match(/(signin|signup|setup|reset)/);
|
2022-02-01 12:34:03 +03:00
|
|
|
}
|
|
|
|
}
|