Bug 41355: Handle vue resources with no Show component
Test plan: 1) Navigate to record sources and create a record source 2) In the table there will be a hyperlink on the record source name which shouldn't be there 3) Apply patch and rebuild javascript 4) Hard refresh and then observe that the table should no longer have a hyperlink Signed-off-by: David Nind <david@davidnind.com> Signed-off-by: Tomás Cohen Arazi <tomascohen@theke.io> Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
This commit is contained in:
parent
77bcaa9879
commit
c40fcf5cda
|
|
@ -45,12 +45,7 @@ export default {
|
|||
name: "record_source_id",
|
||||
required: true,
|
||||
type: "text",
|
||||
label: $__("Id"),
|
||||
tableColumnDefinition: {
|
||||
title: $__("ID"),
|
||||
data: "record_source_id",
|
||||
searchable: true,
|
||||
},
|
||||
label: $__("ID"),
|
||||
hideIn: ["Form"],
|
||||
},
|
||||
{
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@
|
|||
|
||||
<script>
|
||||
import Toolbar from "./Toolbar.vue";
|
||||
import { ref, inject, onBeforeMount, computed } from "vue";
|
||||
import { ref, onBeforeMount, computed } from "vue";
|
||||
import { APIClient } from "../fetch/api-client.js";
|
||||
import KohaTable from "./KohaTable.vue";
|
||||
import { $__ } from "@koha-vue/i18n";
|
||||
|
|
@ -89,7 +89,20 @@ export default {
|
|||
});
|
||||
});
|
||||
};
|
||||
const handleShowField = (row, attr, thisResource) => {
|
||||
if (!props.instancedResource.components.show) {
|
||||
return row[attr.name];
|
||||
}
|
||||
return (
|
||||
'<a href="' +
|
||||
thisResource.getResourceShowURL(row[thisResource.idAttr]) +
|
||||
'" class="show">' +
|
||||
escape_str(row[attr.name]) +
|
||||
"</a>"
|
||||
);
|
||||
};
|
||||
const assignShowEvent = (columnActions, i) => {
|
||||
if (!props.instancedResource.components.show) return;
|
||||
if (!columnActions[i]) {
|
||||
columnActions[i] = ["show"];
|
||||
}
|
||||
|
|
@ -123,15 +136,7 @@ export default {
|
|||
searchable: true,
|
||||
orderable: true,
|
||||
render: function (data, type, row, meta) {
|
||||
return (
|
||||
'<a href="' +
|
||||
thisResource.getResourceShowURL(
|
||||
row[thisResource.idAttr]
|
||||
) +
|
||||
'" class="show">' +
|
||||
escape_str(row[thisResource.idAttr]) +
|
||||
"</a>"
|
||||
);
|
||||
return handleShowField(row, attr, thisResource);
|
||||
},
|
||||
});
|
||||
return acc;
|
||||
|
|
@ -146,15 +151,7 @@ export default {
|
|||
searchable: true,
|
||||
orderable: true,
|
||||
render: function (data, type, row, meta) {
|
||||
return (
|
||||
'<a href="' +
|
||||
thisResource.getResourceShowURL(
|
||||
row[thisResource.idAttr]
|
||||
) +
|
||||
'" class="show">' +
|
||||
escape_str(row[attr.name]) +
|
||||
"</a>"
|
||||
);
|
||||
return handleShowField(row, attr, thisResource);
|
||||
},
|
||||
});
|
||||
return acc;
|
||||
|
|
|
|||
Loading…
Reference in New Issue