mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-11-29 07:09:48 +03:00
9adbcd1fd0
no issue Automated tools, code generators, and editor integrations are increasingly standardising on the import style used in `ember-modules-codemod`. Our import style differed a little with regards to service/controller injection imports which meant we were starting to see inconsistent naming.
95 lines
1.9 KiB
JavaScript
95 lines
1.9 KiB
JavaScript
import Service, {inject as service} from '@ember/service';
|
|
import {computed} from '@ember/object';
|
|
import {not, or, reads} from '@ember/object/computed';
|
|
|
|
export default Service.extend({
|
|
dropdown: service(),
|
|
mediaQueries: service(),
|
|
|
|
autoNav: false,
|
|
isFullScreen: false,
|
|
showMobileMenu: false,
|
|
showSettingsMenu: false,
|
|
|
|
hasSideNav: not('isSideNavHidden'),
|
|
isMobile: reads('mediaQueries.isMobile'),
|
|
isSideNavHidden: or('autoNav', 'isFullScreen', 'isMobile'),
|
|
|
|
autoNavOpen: computed('autoNav', {
|
|
get() {
|
|
return false;
|
|
},
|
|
set(key, value) {
|
|
if (this.get('autoNav')) {
|
|
return value;
|
|
}
|
|
return false;
|
|
}
|
|
}),
|
|
|
|
closeMenus() {
|
|
this.get('dropdown').closeDropdowns();
|
|
this.setProperties({
|
|
showSettingsMenu: false,
|
|
showMobileMenu: false
|
|
});
|
|
},
|
|
|
|
openAutoNav() {
|
|
this.set('autoNavOpen', true);
|
|
},
|
|
|
|
closeAutoNav() {
|
|
if (this.get('autoNavOpen')) {
|
|
this.get('dropdown').closeDropdowns();
|
|
}
|
|
this.set('autoNavOpen', false);
|
|
},
|
|
|
|
closeMobileMenu() {
|
|
this.set('showMobileMenu', false);
|
|
},
|
|
|
|
openMobileMenu() {
|
|
this.set('showMobileMenu', true);
|
|
},
|
|
|
|
openSettingsMenu() {
|
|
this.set('showSettingsMenu', true);
|
|
},
|
|
|
|
toggleAutoNav() {
|
|
this.toggleProperty('autoNav');
|
|
},
|
|
|
|
actions: {
|
|
closeMenus() {
|
|
this.closeMenus();
|
|
},
|
|
|
|
openAutoNav() {
|
|
this.openAutoNav();
|
|
},
|
|
|
|
closeAutoNav() {
|
|
this.closeAutoNav();
|
|
},
|
|
|
|
closeMobileMenu() {
|
|
this.closeMobileMenu();
|
|
},
|
|
|
|
openMobileMenu() {
|
|
this.openMobileMenu();
|
|
},
|
|
|
|
openSettingsMenu() {
|
|
this.openSettingsMenu();
|
|
},
|
|
|
|
toggleAutoNav() {
|
|
this.toggleAutoNav();
|
|
}
|
|
}
|
|
});
|