mirror of
https://github.com/discourse/discourse.git
synced 2025-06-06 13:06:56 +08:00
FIX: Close menus when clicking on notifications
This commit is contained in:
@ -63,12 +63,16 @@ export default Ember.Component.extend({
|
|||||||
afterPatch() {
|
afterPatch() {
|
||||||
},
|
},
|
||||||
|
|
||||||
|
eventDispatched(eventName, key, refreshArg) {
|
||||||
|
const onRefresh = Ember.String.camelize(eventName.replace(/:/, '-'));
|
||||||
|
keyDirty(key, { onRefresh, refreshArg });
|
||||||
|
this.queueRerender();
|
||||||
|
},
|
||||||
|
|
||||||
dispatch(eventName, key) {
|
dispatch(eventName, key) {
|
||||||
this._childEvents.push(eventName);
|
this._childEvents.push(eventName);
|
||||||
this.appEvents.on(eventName, refreshArg => {
|
this.appEvents.on(eventName, refreshArg => {
|
||||||
const onRefresh = Ember.String.camelize(eventName.replace(/:/, '-'));
|
this.eventDispatched(eventName, key, refreshArg);
|
||||||
keyDirty(key, { onRefresh, refreshArg });
|
|
||||||
this.queueRerender();
|
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -65,6 +65,14 @@ const SiteHeaderComponent = MountWidget.extend({
|
|||||||
|
|
||||||
this.dispatch('notifications:changed', 'user-notifications');
|
this.dispatch('notifications:changed', 'user-notifications');
|
||||||
this.dispatch('header:keyboard-trigger', 'header');
|
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();
|
this.examineDockHeader();
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -78,6 +86,7 @@ const SiteHeaderComponent = MountWidget.extend({
|
|||||||
|
|
||||||
this.appEvents.off('header:show-topic');
|
this.appEvents.off('header:show-topic');
|
||||||
this.appEvents.off('header:hide-topic');
|
this.appEvents.off('header:hide-topic');
|
||||||
|
this.appEvents.off('dom:clean');
|
||||||
},
|
},
|
||||||
|
|
||||||
buildArgs() {
|
buildArgs() {
|
||||||
|
@ -187,10 +187,14 @@ export default createWidget('header', {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
linkClickedEvent() {
|
closeAll() {
|
||||||
this.state.userVisible = false;
|
this.state.userVisible = false;
|
||||||
this.state.hamburgerVisible = false;
|
this.state.hamburgerVisible = false;
|
||||||
this.state.searchVisible = false;
|
this.state.searchVisible = false;
|
||||||
|
},
|
||||||
|
|
||||||
|
linkClickedEvent() {
|
||||||
|
this.closeAll();
|
||||||
this.updateHighlight();
|
this.updateHighlight();
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -255,6 +259,14 @@ export default createWidget('header', {
|
|||||||
this.state.contextEnabled = value;
|
this.state.contextEnabled = value;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
domClean() {
|
||||||
|
const { state } = this;
|
||||||
|
|
||||||
|
if (state.searchVisible || state.hamburgerVisible || state.userVisible) {
|
||||||
|
this.closeAll();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
headerKeyboardTrigger(msg) {
|
headerKeyboardTrigger(msg) {
|
||||||
switch(msg.type) {
|
switch(msg.type) {
|
||||||
case 'search':
|
case 'search':
|
||||||
|
Reference in New Issue
Block a user