2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-06-27 17:20:49 +00:00

Catch unhandled javascript errors

This commit is contained in:
Oliver Walters
2020-08-08 09:31:57 +10:00
parent ff71fe6e93
commit a2c3c1086c
2 changed files with 9 additions and 5 deletions

View File

@ -18,14 +18,18 @@ function {{ label }}StatusDisplay(key) {
key = String(key);
var value = {{ label }}Codes[key].value;
var value = null;
var label = null;
if (key in {{ label }}Codes) {
value = {{ label }}Codes[key].value;
label = {{ label }}Codes[key].label;
}
if (value == null || value.length == 0) {
value = key;
label = '';
}
// Select the label color
var label = {{ label }}Codes[key].label ?? '';
return `<span class='label ${label}'>${value}</span>`;
}