FIX: When navigating to pages close panels

This commit is contained in:
Robin Ward 2015-08-31 14:43:11 -04:00
parent 82ad3e0401
commit ca017facf2
1 changed files with 2 additions and 2 deletions

View File

@ -59,8 +59,6 @@ export default Ember.Component.extend({
@observes('viewMode', 'visible') @observes('viewMode', 'visible')
_visibleChanged() { _visibleChanged() {
if (this.get('visible')) { if (this.get('visible')) {
this.appEvents.on('dropdowns:closeAll', this, this.hide);
// Allow us to hook into things being shown // Allow us to hook into things being shown
Ember.run.scheduleOnce('afterRender', () => this.sendAction('onVisible')); Ember.run.scheduleOnce('afterRender', () => this.sendAction('onVisible'));
$('html').on('click.close-menu-panel', (e) => { $('html').on('click.close-menu-panel', (e) => {
@ -134,6 +132,7 @@ export default Ember.Component.extend({
}); });
this.appEvents.on('dropdowns:closeAll', this, this.hide); this.appEvents.on('dropdowns:closeAll', this, this.hide);
this.appEvents.on('dom:clean', this, this.hide);
$('body').on('keydown.discourse-menu-panel', (e) => { $('body').on('keydown.discourse-menu-panel', (e) => {
if (e.which === 27) { if (e.which === 27) {
@ -157,6 +156,7 @@ export default Ember.Component.extend({
@on('willDestroyElement') @on('willDestroyElement')
_removeEvents() { _removeEvents() {
this.appEvents.off('dom:clean', this, this.hide);
this.appEvents.off('dropdowns:closeAll', this, this.hide); this.appEvents.off('dropdowns:closeAll', this, this.hide);
this.$().off('click.discourse-menu-panel'); this.$().off('click.discourse-menu-panel');
$('body').off('keydown.discourse-menu-panel'); $('body').off('keydown.discourse-menu-panel');