2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-07-03 04:00:57 +00:00

Add option to display "starred categories" on the index page

This commit is contained in:
Oliver
2021-11-03 23:29:36 +11:00
parent 7567b8dd63
commit 193d6b334c
5 changed files with 28 additions and 5 deletions

View File

@ -169,7 +169,12 @@ function inventreeDocReady() {
html += '</span>';
if (user_settings.SEARCH_SHOW_STOCK_LEVELS) {
html += partStockLabel(item.data);
html += partStockLabel(
item.data,
{
classes: 'badge-right',
}
);
}
html += '</a>';

View File

@ -420,12 +420,12 @@ function toggleStar(options) {
}
function partStockLabel(part) {
function partStockLabel(part, options={}) {
if (part.in_stock) {
return `<span class='badge rounded-pill bg-success'>{% trans "Stock" %}: ${part.in_stock}</span>`;
return `<span class='badge rounded-pill bg-success ${options.classes}'>{% trans "Stock" %}: ${part.in_stock}</span>`;
} else {
return `<span class='badge rounded-pill bg-danger'>{% trans "No Stock" %}</span>`;
return `<span class='badge rounded-pill bg-danger ${options.classes}'>{% trans "No Stock" %}</span>`;
}
}