2018-01-11 01:57:43 +03:00
|
|
|
/* eslint-disable ghost/ember/alias-model-in-controller */
|
2017-08-14 15:30:00 +03:00
|
|
|
import Controller from '@ember/controller';
|
2017-10-30 12:38:01 +03:00
|
|
|
import {inject as service} from '@ember/service';
|
2015-05-26 05:10:50 +03:00
|
|
|
|
2021-03-17 14:48:36 +03:00
|
|
|
export default class ApplicationController extends Controller {
|
|
|
|
@service billing;
|
|
|
|
@service customViews;
|
|
|
|
@service config;
|
|
|
|
@service dropdown;
|
|
|
|
@service router;
|
|
|
|
@service session;
|
|
|
|
@service settings;
|
|
|
|
@service ui;
|
2015-10-28 14:36:45 +03:00
|
|
|
|
2021-03-17 14:48:36 +03:00
|
|
|
get showBilling() {
|
|
|
|
return this.config.get('hostSettings.billing.enabled');
|
|
|
|
}
|
2019-05-06 16:51:23 +03:00
|
|
|
|
2021-03-17 14:48:36 +03:00
|
|
|
get showNavMenu() {
|
2018-07-26 14:53:23 +03:00
|
|
|
// if we're in fullscreen mode don't show the nav menu
|
2021-03-17 14:48:36 +03:00
|
|
|
if (this.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
|
|
|
|
// promise has fulfilled so that gh-user-can-admin has the correct data
|
2021-03-17 14:48:36 +03:00
|
|
|
if (!this.session.isAuthenticated || !this.session.user.isFulfilled) {
|
2017-02-01 22:19:42 +03:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2021-03-17 14:48:36 +03:00
|
|
|
return (this.router.currentRouteName !== 'error404' || this.session.isAuthenticated)
|
|
|
|
&& !this.router.currentRouteName.match(/(signin|signup|setup|reset)/);
|
|
|
|
}
|
|
|
|
}
|