Fix bug rendering part without a category (#4369)

This commit is contained in:
Oliver 2023-02-19 22:39:36 +11:00 committed by GitHub
parent 32be1b2035
commit bf8a59c604
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1835,13 +1835,11 @@ function loadPartTable(table, url, options={}) {
field: 'category_detail',
title: '{% trans "Category" %}',
formatter: function(value, row) {
var text = shortenString(row.category_detail.pathstring);
if (row.category) {
if (row.category && row.category_detail) {
var text = shortenString(row.category_detail.pathstring);
return withTitle(renderLink(text, `/part/category/${row.category}/`), row.category_detail.pathstring);
} else {
return '{% trans "No category" %}';
return '<em>{% trans "No category" %}</em>';
}
}
};