2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-05-04 06:18:48 +00:00

Fixes for search auto-complete dropdown menu

- Fix rendering of badges
- Menu fills out right-to-left
This commit is contained in:
Oliver 2021-11-04 16:48:24 +11:00
parent 3b052e6bce
commit 9cfcb6579f

View File

@ -158,14 +158,13 @@ function inventreeDocReady() {
create: function() { create: function() {
$(this).data('ui-autocomplete')._renderItem = function(ul, item) { $(this).data('ui-autocomplete')._renderItem = function(ul, item) {
var html = `<a href='/part/${item.id}/'><span>`; var html = `
<div class=''>
html += `<img class='hover-img-thumb' src='`; <a href='/part/${item.id}/'>
html += item.thumbnail || `/static/img/blank_image.png`; <span><img class='hover-img-thumb' src='${item.thumbnail || "/static/img/blank_image.png"}'> ${item.label}</span>
html += `'> `; </a>
html += item.label; <span class='flex' style='flex-grow: 1;'></span>
`;
html += '</span>';
if (user_settings.SEARCH_SHOW_STOCK_LEVELS) { if (user_settings.SEARCH_SHOW_STOCK_LEVELS) {
html += partStockLabel( html += partStockLabel(
@ -176,7 +175,7 @@ function inventreeDocReady() {
); );
} }
html += '</a>'; html += '</div>';
return $('<li>').append(html).appendTo(ul); return $('<li>').append(html).appendTo(ul);
}; };
@ -188,6 +187,10 @@ function inventreeDocReady() {
classes: { classes: {
'ui-autocomplete': 'dropdown-menu search-menu', 'ui-autocomplete': 'dropdown-menu search-menu',
}, },
position: {
my : "right top",
at: "right bottom"
}
}); });
} }