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';
|
2021-03-17 15:00:14 +03:00
|
|
|
import {computed} from '@ember/object';
|
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 15:00:14 +03:00
|
|
|
export default Controller.extend({
|
|
|
|
billing: service(),
|
|
|
|
customViews: service(),
|
|
|
|
config: service(),
|
|
|
|
dropdown: service(),
|
2021-03-18 19:46:38 +03:00
|
|
|
feature: service(),
|
2021-03-17 15:00:14 +03:00
|
|
|
router: service(),
|
|
|
|
session: service(),
|
|
|
|
settings: service(),
|
|
|
|
ui: service(),
|
2015-10-28 14:36:45 +03:00
|
|
|
|
2021-03-17 15:00:14 +03:00
|
|
|
showBilling: computed.reads('config.hostSettings.billing.enabled'),
|
2021-07-08 16:37:31 +03:00
|
|
|
showNavMenu: computed('router.currentRouteName', 'session.{isAuthenticated,user}', 'ui.isFullScreen', function () {
|
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)/);
|
|
|
|
})
|
|
|
|
});
|