|
1 | 1 | (function (global, doc, ibexa, Routing) {
|
2 | 2 | const renderItem = (result, searchText) => {
|
3 | 3 | const globalSearch = doc.querySelector('.ibexa-global-search');
|
4 |
| - const {highlightText} = ibexa.helpers.highlight; |
5 |
| - const autocompleteHighlightTemplate = globalSearch.querySelector('.ibexa-global-search__autocomplete-list').dataset.templateHighlight; |
6 |
| - const {getContentTypeIconUrl, getContentTypeName} = ibexa.helpers.contentType; |
| 4 | + const { highlightText } = ibexa.helpers.highlight; |
| 5 | + const autocompleteHighlightTemplate = globalSearch.querySelector('.ibexa-global-search__autocomplete-list').dataset |
| 6 | + .templateHighlight; |
| 7 | + const { getContentTypeIconUrl, getContentTypeName } = ibexa.helpers.contentType; |
7 | 8 |
|
8 |
| - const autocompleteItemTemplate = globalSearch.querySelector('.ibexa-global-search__autocomplete-product-template').dataset.templateItem; |
| 9 | + const autocompleteItemTemplate = globalSearch.querySelector('.ibexa-global-search__autocomplete-product-template').dataset |
| 10 | + .templateItem; |
9 | 11 |
|
10 | 12 | return autocompleteItemTemplate
|
11 |
| - .replace('{{ productHref }}', Routing.generate('ibexa.product_catalog.product.view', {productCode: result.productCode})) |
| 13 | + .replace('{{ productHref }}', Routing.generate('ibexa.product_catalog.product.view', { productCode: result.productCode })) |
12 | 14 | .replace('{{ productName }}', highlightText(searchText, result.name, autocompleteHighlightTemplate))
|
13 | 15 | .replace('{{ productCode }}', result.productCode)
|
14 | 16 | .replace('{{ productTypeIconHref }}', getContentTypeIconUrl(result.productTypeIdentifier))
|
|
0 commit comments