Store skipSearchContext in state for plugins to extend.

This commit is contained in:
Guo Xiang Tan 2016-11-18 09:31:08 +08:00
parent ed4fecb152
commit 12b175db59
1 changed files with 14 additions and 6 deletions

View File

@ -169,11 +169,19 @@ export default createWidget('header', {
buildKey: () => `header`, buildKey: () => `header`,
defaultState() { defaultState() {
return { searchVisible: false, let states = {
hamburgerVisible: false, searchVisible: false,
userVisible: false, hamburgerVisible: false,
contextEnabled: false, userVisible: false,
ringBackdrop: true }; contextEnabled: false,
ringBackdrop: true
};
if (this.site.mobileView) {
states.skipSearchContext = true;
}
return states;
}, },
html(attrs, state) { html(attrs, state) {
@ -227,7 +235,7 @@ export default createWidget('header', {
var params = ""; var params = "";
if (context) { if (context) {
params = `?context=${context.type}&context_id=${context.id}&skip_context=true`; params = `?context=${context.type}&context_id=${context.id}&skip_context=${this.state.skipSearchContext}`;
} }
return DiscourseURL.routeTo('/search' + params); return DiscourseURL.routeTo('/search' + params);