2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-06-17 12:35:46 +00:00

Improve wording for "Inherited" option of BOM items (#4376) (#4397)

* improve wording for "Inherited" option of BOM items (#4376)

* add migrations
This commit is contained in:
simonkuehling
2023-02-23 20:58:54 +01:00
committed by GitHub
parent 89ac0a623b
commit efb55c720f
7 changed files with 39 additions and 13 deletions

View File

@ -1019,7 +1019,7 @@ function loadBomTable(table, options={}) {
cols.push({
field: 'inherited',
title: '{% trans "Inherited" %}',
title: '{% trans "Gets inherited" %}',
searchable: false,
formatter: function(value, row) {
// This BOM item *is* inheritable, but is defined for this BOM
@ -1029,10 +1029,7 @@ function loadBomTable(table, options={}) {
return yesNoLabel(true);
} else {
// If this BOM item is inherited from a parent part
return renderLink(
'{% trans "View BOM" %}',
`/part/${row.part}/bom/`,
);
return yesNoLabel(true, {muted: true});
}
}
});

View File

@ -19,12 +19,23 @@
withTitle,
*/
function yesNoLabel(value) {
function yesNoLabel(value, options={}) {
var text = '';
var color = '';
if (value) {
return `<span class='badge rounded-pill bg-success'>{% trans "YES" %}</span>`;
text = '{% trans "YES" %}';
color = 'bg-success';
} else {
return `<span class='badge rounded-pill bg-warning'>{% trans "NO" %}</span>`;
text = '{% trans "NO" %}';
color = 'bg-warning';
}
if (options.muted) {
color = 'bg-secondary';
}
return `<span class='badge rounded-pill ${color}'>${text}</span>`;
}

View File

@ -73,7 +73,7 @@ function getAvailableTableFilters(tableKey) {
},
inherited: {
type: 'bool',
title: '{% trans "Inherited" %}',
title: '{% trans "Gets inherited" %}',
},
allow_variants: {
type: 'bool',
@ -105,7 +105,7 @@ function getAvailableTableFilters(tableKey) {
return {
'inherited': {
type: 'bool',
title: '{% trans "Inherited" %}',
title: '{% trans "Gets inherited" %}',
},
'optional': {
type: 'bool',