FIX: Search menu would sometimes forget the context

This commit is contained in:
Robin Ward 2016-04-27 13:53:51 -04:00
parent 02f771e66e
commit 1c90b8dd76
No known key found for this signature in database
GPG Key ID: 0E091E2B4ED1B83D
1 changed files with 5 additions and 3 deletions

View File

@ -60,7 +60,7 @@ export default createWidget('search-menu', {
fullSearchUrl() { fullSearchUrl() {
const state = this.state; const state = this.state;
const contextEnabled = this.attrs.contextEnabled; const contextEnabled = state.contextEnabled;
const ctx = contextEnabled ? this.searchContext() : null; const ctx = contextEnabled ? this.searchContext() : null;
const type = Ember.get(ctx, 'type'); const type = Ember.get(ctx, 'type');
@ -84,7 +84,7 @@ export default createWidget('search-menu', {
panelContents() { panelContents() {
const { state } = this; const { state } = this;
const contextEnabled = this.attrs.contextEnabled; const contextEnabled = state.contextEnabled;
const results = [this.attach('search-term', { value: state.term, contextEnabled }), const results = [this.attach('search-term', { value: state.term, contextEnabled }),
this.attach('search-context', { contextEnabled })]; this.attach('search-context', { contextEnabled })];
@ -114,7 +114,9 @@ export default createWidget('search-menu', {
return this._searchContext; return this._searchContext;
}, },
html() { html(attrs, state) {
state.contextEnabled = attrs.contextEnabled;
return this.attach('menu-panel', { maxWidth: 500, contents: () => this.panelContents() }); return this.attach('menu-panel', { maxWidth: 500, contents: () => this.panelContents() });
}, },