Shorten string fix (#5187)

* Fix for model renderer code

- Handles string shortening without corrupting HTML

* Fix for BOM table
This commit is contained in:
Oliver 2023-07-06 12:37:40 +10:00 committed by GitHub
parent 35defe78c0
commit 2d2a084866
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 7 deletions

View File

@ -1155,7 +1155,7 @@ function loadBomTable(table, options={}) {
var available_stock = availableQuantity(row);
var text = `${available_stock}`;
var text = renderLink(`${available_stock}`, url);
if (row.sub_part_detail && row.sub_part_detail.units) {
text += ` <small>${row.sub_part_detail.units}</small>`;
@ -1179,8 +1179,6 @@ function loadBomTable(table, options={}) {
}
}
text = renderLink(text, url);
if (row.on_order && row.on_order > 0) {
text += makeIconBadge(
'fa-shopping-cart',

View File

@ -129,15 +129,19 @@ function renderModel(data, options={}) {
}
}
let text = `<span>${data.text}</span>`;
let text = data.text;
if (showLink && data.url) {
text = renderLink(text, data.url);
}
text = `<span>${text}</span>`;
if (data.textSecondary) {
text += ` - <small><em>${data.textSecondary}</em></small>`;
}
if (showLink && data.url) {
text = renderLink(text, data.url);
}
html += text;