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';
|
|
|
|
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
|
|
|
|
2015-10-28 14:36:45 +03:00
|
|
|
export default Controller.extend({
|
2017-10-30 12:38:01 +03:00
|
|
|
dropdown: service(),
|
|
|
|
session: service(),
|
|
|
|
settings: service(),
|
|
|
|
ui: service(),
|
2015-10-28 14:36:45 +03:00
|
|
|
|
2017-11-24 22:02:23 +03:00
|
|
|
showNavMenu: computed('currentPath', 'session.{isAuthenticated,user.isFulfilled}', function () {
|
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
|
|
|
|
if (!this.get('session.isAuthenticated') || !this.get('session.user.isFulfilled')) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2016-11-14 16:16:51 +03:00
|
|
|
return (this.get('currentPath') !== 'error404' || this.get('session.isAuthenticated'))
|
|
|
|
&& !this.get('currentPath').match(/(signin|signup|setup|reset)/);
|
2017-11-24 13:47:06 +03:00
|
|
|
})
|
2014-03-11 20:23:32 +04:00
|
|
|
});
|