mirror of
https://github.com/discourse/discourse.git
synced 2024-11-23 02:19:27 +08:00
FIX: Close menus when clicking on notifications
This commit is contained in:
parent
dc014ac4aa
commit
16c44971d9
|
@ -63,12 +63,16 @@ export default Ember.Component.extend({
|
|||
afterPatch() {
|
||||
},
|
||||
|
||||
eventDispatched(eventName, key, refreshArg) {
|
||||
const onRefresh = Ember.String.camelize(eventName.replace(/:/, '-'));
|
||||
keyDirty(key, { onRefresh, refreshArg });
|
||||
this.queueRerender();
|
||||
},
|
||||
|
||||
dispatch(eventName, key) {
|
||||
this._childEvents.push(eventName);
|
||||
this.appEvents.on(eventName, refreshArg => {
|
||||
const onRefresh = Ember.String.camelize(eventName.replace(/:/, '-'));
|
||||
keyDirty(key, { onRefresh, refreshArg });
|
||||
this.queueRerender();
|
||||
this.eventDispatched(eventName, key, refreshArg);
|
||||
});
|
||||
},
|
||||
|
||||
|
|
|
@ -65,6 +65,14 @@ const SiteHeaderComponent = MountWidget.extend({
|
|||
|
||||
this.dispatch('notifications:changed', 'user-notifications');
|
||||
this.dispatch('header:keyboard-trigger', 'header');
|
||||
|
||||
this.appEvents.on('dom:clean', () => {
|
||||
// For performance, only trigger a re-render if any menu panels are visible
|
||||
if (this.$('.menu-panel').length) {
|
||||
this.eventDispatched('dom:clean', 'header');
|
||||
}
|
||||
});
|
||||
|
||||
this.examineDockHeader();
|
||||
},
|
||||
|
||||
|
@ -78,6 +86,7 @@ const SiteHeaderComponent = MountWidget.extend({
|
|||
|
||||
this.appEvents.off('header:show-topic');
|
||||
this.appEvents.off('header:hide-topic');
|
||||
this.appEvents.off('dom:clean');
|
||||
},
|
||||
|
||||
buildArgs() {
|
||||
|
|
|
@ -187,10 +187,14 @@ export default createWidget('header', {
|
|||
}
|
||||
},
|
||||
|
||||
linkClickedEvent() {
|
||||
closeAll() {
|
||||
this.state.userVisible = false;
|
||||
this.state.hamburgerVisible = false;
|
||||
this.state.searchVisible = false;
|
||||
},
|
||||
|
||||
linkClickedEvent() {
|
||||
this.closeAll();
|
||||
this.updateHighlight();
|
||||
},
|
||||
|
||||
|
@ -255,6 +259,14 @@ export default createWidget('header', {
|
|||
this.state.contextEnabled = value;
|
||||
},
|
||||
|
||||
domClean() {
|
||||
const { state } = this;
|
||||
|
||||
if (state.searchVisible || state.hamburgerVisible || state.userVisible) {
|
||||
this.closeAll();
|
||||
}
|
||||
},
|
||||
|
||||
headerKeyboardTrigger(msg) {
|
||||
switch(msg.type) {
|
||||
case 'search':
|
||||
|
|
Loading…
Reference in New Issue
Block a user