mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-02-24 23:48:13 -05:00
Refactored ApplicationController to use native class
no issue - updated to use Ember Octane idioms
This commit is contained in:
parent
a43386371a
commit
9b6d4822e7
1 changed files with 19 additions and 19 deletions
|
@ -1,34 +1,34 @@
|
||||||
/* eslint-disable ghost/ember/alias-model-in-controller */
|
/* eslint-disable ghost/ember/alias-model-in-controller */
|
||||||
import Controller from '@ember/controller';
|
import Controller from '@ember/controller';
|
||||||
import {computed} from '@ember/object';
|
|
||||||
import {inject as service} from '@ember/service';
|
import {inject as service} from '@ember/service';
|
||||||
|
|
||||||
export default Controller.extend({
|
export default class ApplicationController extends Controller {
|
||||||
billing: service(),
|
@service billing;
|
||||||
customViews: service(),
|
@service customViews;
|
||||||
config: service(),
|
@service config;
|
||||||
dropdown: service(),
|
@service dropdown;
|
||||||
router: service(),
|
@service router;
|
||||||
session: service(),
|
@service session;
|
||||||
settings: service(),
|
@service settings;
|
||||||
ui: service(),
|
@service ui;
|
||||||
|
|
||||||
showBilling: computed.reads('config.hostSettings.billing.enabled'),
|
get showBilling() {
|
||||||
showNavMenu: computed('router.currentRouteName', 'session.{isAuthenticated,user.isFulfilled}', 'ui.isFullScreen', function () {
|
return this.config.get('hostSettings.billing.enabled');
|
||||||
let {router, session, ui} = this;
|
}
|
||||||
|
|
||||||
|
get showNavMenu() {
|
||||||
// if we're in fullscreen mode don't show the nav menu
|
// if we're in fullscreen mode don't show the nav menu
|
||||||
if (ui.isFullScreen) {
|
if (this.ui.isFullScreen) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// we need to defer showing the navigation menu until the session.user
|
// 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
|
// promise has fulfilled so that gh-user-can-admin has the correct data
|
||||||
if (!session.isAuthenticated || !session.user.isFulfilled) {
|
if (!this.session.isAuthenticated || !this.session.user.isFulfilled) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return (router.currentRouteName !== 'error404' || session.isAuthenticated)
|
return (this.router.currentRouteName !== 'error404' || this.session.isAuthenticated)
|
||||||
&& !router.currentRouteName.match(/(signin|signup|setup|reset)/);
|
&& !this.router.currentRouteName.match(/(signin|signup|setup|reset)/);
|
||||||
})
|
}
|
||||||
});
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue