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

Improve status code label rendering

This commit is contained in:
Oliver Walters
2020-04-26 15:29:21 +10:00
parent 0892b160c6
commit 4147163418
9 changed files with 122 additions and 53 deletions

View File

@ -5,7 +5,7 @@ var {{ label }}Codes = {
{% for opt in options %}'{{ opt.key }}': {
key: '{{ opt.key }}',
value: '{{ opt.value }}',{% if opt.color %}
color: '{{ opt.color }}',{% endif %}
label: 'label-{{ opt.color }}',{% endif %}
},{% endfor %}
};
@ -25,7 +25,7 @@ function {{ label }}StatusDisplay(key) {
}
// Select the label color
var color = {{ label }}Codes[key].color ?? '#AAA';
var label = {{ label }}Codes[key].label ?? '';
return `<span class='label' style='background: ${color};'>${value}</span>`;
return `<span class='label ${label}'>${value}</span>`;
}