mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
Render links for search results
This commit is contained in:
parent
78e5a685dc
commit
22ee6614cc
@ -92,6 +92,7 @@ function updateSearch() {
|
|||||||
renderPart,
|
renderPart,
|
||||||
{
|
{
|
||||||
show_stock_data: false,
|
show_stock_data: false,
|
||||||
|
url: '/part',
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -116,6 +117,7 @@ function updateSearch() {
|
|||||||
'{% trans "Stock Items" %}',
|
'{% trans "Stock Items" %}',
|
||||||
renderStockItem,
|
renderStockItem,
|
||||||
{
|
{
|
||||||
|
url: '/stock/item',
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -169,10 +171,17 @@ function addSearchResults(key, results, title, renderFunc, renderParams={}) {
|
|||||||
`);
|
`);
|
||||||
|
|
||||||
results.forEach(function(result) {
|
results.forEach(function(result) {
|
||||||
|
|
||||||
|
var pk = result.pk || result.id;
|
||||||
|
|
||||||
var html = renderFunc(key, result, renderParams);
|
var html = renderFunc(key, result, renderParams);
|
||||||
|
|
||||||
|
if (renderParams.url) {
|
||||||
|
html = `<a href='${renderParams.url}/${pk}/'>` + html + `</a>`;
|
||||||
|
}
|
||||||
|
|
||||||
var result_html = `
|
var result_html = `
|
||||||
<div class='search-result-entry' id='search-result-${key}-${result.pk || result.id}'>
|
<div class='search-result-entry' id='search-result-${key}-${pk}'>
|
||||||
${html}
|
${html}
|
||||||
</div>
|
</div>
|
||||||
`;
|
`;
|
||||||
|
Loading…
Reference in New Issue
Block a user