2022-02-01 12:34:03 +03:00
|
|
|
import classic from 'ember-classic-decorator';
|
2021-03-17 15:00:14 +03:00
|
|
|
import {computed} from '@ember/object';
|
2022-01-21 22:25:47 +03:00
|
|
|
import {reads} from '@ember/object/computed';
|
2017-10-30 12:38:01 +03:00
|
|
|
import {inject as service} from '@ember/service';
|
2022-02-01 12:34:03 +03:00
|
|
|
/* eslint-disable ghost/ember/alias-model-in-controller */
|
|
|
|
import Controller from '@ember/controller';
|
|
|
|
|
|
|
|
@classic
|
|
|
|
export default class ApplicationController extends Controller {
|
2022-02-01 20:03:45 +03:00
|
|
|
@service billing;
|
|
|
|
@service config;
|
|
|
|
@service dropdown;
|
|
|
|
@service feature;
|
|
|
|
@service router;
|
|
|
|
@service session;
|
|
|
|
@service settings;
|
|
|
|
@service ui;
|
2022-02-01 12:34:03 +03:00
|
|
|
|
|
|
|
@reads('config.hostSettings.billing.enabled')
|
2022-02-10 13:41:36 +03:00
|
|
|
showBilling;
|
2015-05-26 05:10:50 +03:00
|
|
|
|
2022-02-01 12:34:03 +03:00
|
|
|
@computed(
|
|
|
|
'router.currentRouteName',
|
|
|
|
'session.{isAuthenticated,user}',
|
|
|
|
'ui.isFullScreen'
|
|
|
|
)
|
|
|
|
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
|
|
|
}
|
|
|
|
}
|