Wrap search preview results in <a>

- Allows clicking with middle mouse (for e.g.) to open in new tab
This commit is contained in:
Oliver 2021-08-24 13:11:37 +10:00
parent 44ecd958a2
commit 36a0496dd7

View File

@ -111,9 +111,17 @@ function inventreeDocReady() {
},
create: function () {
$(this).data('ui-autocomplete')._renderItem = function (ul, item) {
return $('<li>')
.append('<span>' + imageHoverIcon(item.thumbnail) + item.label + '</span>')
.appendTo(ul);
var html = `<a href='/part/${item.id}/'><span>`;
html += `<img class='hover-img-thumb' src='`;
html += item.thumbnail || `/static/img/blank_image.png`;
html += `'> `;
html += item.label;
html += '</span></a>';
return $('<li>').append(html).appendTo(ul);
};
},
select: function( event, ui ) {