Skip to content

Commit a8b4dd5

Browse files
Fixes clear refinements button from not showing
Re-nests clearRefinements method from allWidgetConfiguration.currentRefinements.clearRefinements > allWidgetConfiguration.clearRefinements
1 parent b3b50e3 commit a8b4dd5

File tree

1 file changed

+31
-30
lines changed

1 file changed

+31
-30
lines changed

view/frontend/web/instantsearch.js

Lines changed: 31 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -300,35 +300,6 @@ define(
300300
});
301301
},
302302

303-
/*
304-
* clearRefinements
305-
* Widget displays a button that lets the user clean every refinement applied to the search. You can control which attributes are impacted by the button with the options.
306-
* Docs: https://www.algolia.com/doc/api-reference/widgets/clear-refinements/js/
307-
**/
308-
clearRefinements: {
309-
container : '#clear-refinements',
310-
templates : {
311-
resetLabel: algoliaConfig.translations.clearAll,
312-
},
313-
includedAttributes: attributes.map(function (attribute) {
314-
if (!(algoliaConfig.isCategoryPage && attribute.name.indexOf('categories') > -1)) {
315-
return attribute.name;
316-
}
317-
}),
318-
cssClasses : {
319-
button: ['action', 'primary']
320-
},
321-
transformItems : function (items) {
322-
return items.map(function (item) {
323-
var attribute = attributes.filter(function (_attribute) {
324-
return item.attribute === _attribute.name
325-
})[0];
326-
if (!attribute) return item;
327-
item.label = attribute.label;
328-
return item;
329-
})
330-
}
331-
},
332303
/*
333304
* queryRuleCustomData
334305
* The queryRuleCustomData widget displays custom data from Query Rules.
@@ -340,6 +311,36 @@ define(
340311
default: '{{#items}} {{#banner}} {{{banner}}} {{/banner}} {{/items}}',
341312
}
342313
}
314+
},
315+
316+
/*
317+
* clearRefinements
318+
* Widget displays a button that lets the user clean every refinement applied to the search. You can control which attributes are impacted by the button with the options.
319+
* Docs: https://www.algolia.com/doc/api-reference/widgets/clear-refinements/js/
320+
**/
321+
clearRefinements: {
322+
container : '#clear-refinements',
323+
templates : {
324+
resetLabel: algoliaConfig.translations.clearAll,
325+
},
326+
includedAttributes: attributes.map(function (attribute) {
327+
if (!(algoliaConfig.isCategoryPage && attribute.name.indexOf('categories') > -1)) {
328+
return attribute.name;
329+
}
330+
}),
331+
cssClasses : {
332+
button: ['action', 'primary']
333+
},
334+
transformItems : function (items) {
335+
return items.map(function (item) {
336+
var attribute = attributes.filter(function (_attribute) {
337+
return item.attribute === _attribute.name
338+
})[0];
339+
if (!attribute) return item;
340+
item.label = attribute.label;
341+
return item;
342+
})
343+
}
343344
}
344345
};
345346

@@ -726,4 +727,4 @@ define(
726727
return options;
727728
}
728729
}
729-
);
730+
);

0 commit comments

Comments
 (0)