2017-10-30 12:38:01 +03:00
|
|
|
import Service, {inject as service} from '@ember/service';
|
2017-08-14 15:30:00 +03:00
|
|
|
import {computed} from '@ember/object';
|
2017-08-02 10:05:59 +03:00
|
|
|
import {not, or, reads} from '@ember/object/computed';
|
2017-08-14 15:30:00 +03:00
|
|
|
|
|
|
|
export default Service.extend({
|
2017-10-30 12:38:01 +03:00
|
|
|
dropdown: service(),
|
|
|
|
mediaQueries: service(),
|
2017-08-14 15:30:00 +03:00
|
|
|
|
|
|
|
autoNav: false,
|
2017-08-02 10:05:59 +03:00
|
|
|
isFullScreen: false,
|
2017-08-14 15:30:00 +03:00
|
|
|
showMobileMenu: false,
|
|
|
|
showSettingsMenu: false,
|
|
|
|
|
2017-08-02 10:05:59 +03:00
|
|
|
hasSideNav: not('isSideNavHidden'),
|
|
|
|
isMobile: reads('mediaQueries.isMobile'),
|
|
|
|
isSideNavHidden: or('autoNav', 'isFullScreen', 'isMobile'),
|
|
|
|
|
2017-08-14 15:30:00 +03:00
|
|
|
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();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|