Skip to content

Commit

Permalink
chore(connector): dogfooding connectMenu (implement limit)
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexandre Stanislawski committed Apr 6, 2017
1 parent 5091945 commit 3bde99c
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
3 changes: 1 addition & 2 deletions dev/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ import allItems from './templates/all-items.html';
import empty from './templates/no-results.html';
import item from './templates/item.html';

import customMenuWidget from './customWidgets/menu.js';

const search = instantsearch({
appId: 'latency',
apiKey: '6be0576ff61c053d5f9a3225e2a90f76',
Expand Down Expand Up @@ -379,6 +377,7 @@ search.addWidget(
})
);

import customMenuWidget from './customWidgets/menu.js';
search.addWidget(customMenuWidget({
containerNode: $('#custom-menu'),
attributeName: 'categories',
Expand Down
2 changes: 1 addition & 1 deletion dev/customWidgets/menu.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ function customMenuRendering(opts, isFirstRendering) {

input.refine = opts.refine;

const facetValues = opts.items;
const facetValues = opts.items.slice(0, opts.widgetParams.limit || 10);
const facetOptions = facetValues.map(f => f.isRefined ?
$(`<option value='${f.path}' selected>${f.name}</option>`) :
$(`<option value='${f.path}'>${f.name}</option>`)
Expand Down

0 comments on commit 3bde99c

Please sign in to comment.