mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-01 22:02:11 +03:00
562c50d54e
no issue - fixes problem when the nav menu would be shown on an error404 route when the user is not logged in - adds failing test that passes with this change
58 lines
1.3 KiB
JavaScript
58 lines
1.3 KiB
JavaScript
import Ember from 'ember';
|
|
|
|
const {
|
|
Controller,
|
|
computed,
|
|
inject: {service}
|
|
} = Ember;
|
|
|
|
export default Controller.extend({
|
|
dropdown: service(),
|
|
session: service(),
|
|
|
|
showNavMenu: computed('currentPath', 'session.isAuthenticated', function () {
|
|
return (this.get('currentPath') !== 'error404' || this.get('session.isAuthenticated')) &&
|
|
!this.get('currentPath').match(/(signin|signup|setup|reset)/);
|
|
}),
|
|
|
|
topNotificationCount: 0,
|
|
showMobileMenu: false,
|
|
showSettingsMenu: false,
|
|
showMarkdownHelpModal: false,
|
|
|
|
autoNav: false,
|
|
autoNavOpen: computed('autoNav', {
|
|
get() {
|
|
return false;
|
|
},
|
|
set(key, value) {
|
|
if (this.get('autoNav')) {
|
|
return value;
|
|
}
|
|
return false;
|
|
}
|
|
}),
|
|
|
|
actions: {
|
|
topNotificationChange(count) {
|
|
this.set('topNotificationCount', count);
|
|
},
|
|
|
|
toggleAutoNav() {
|
|
this.toggleProperty('autoNav');
|
|
},
|
|
|
|
openAutoNav() {
|
|
this.set('autoNavOpen', true);
|
|
},
|
|
|
|
closeAutoNav() {
|
|
this.set('autoNavOpen', false);
|
|
},
|
|
|
|
closeMobileMenu() {
|
|
this.set('showMobileMenu', false);
|
|
}
|
|
}
|
|
});
|