Bug 38201: Restore 'href' to table links

Bring back middle mouse button click opens in new tab interaction

Signed-off-by: Michaela Sieber <michaela.sieber@kit.edu>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
This commit is contained in:
Pedro Amorim 2025-04-09 08:50:52 +00:00 committed by Lucas Gass
parent 586e24ad6d
commit 4d4149bde0
No known key found for this signature in database
GPG Key ID: 60B447398B0D36CA
2 changed files with 32 additions and 5 deletions

View File

@ -113,6 +113,7 @@ export default {
doResourceDelete: this.doResourceDelete,
goToResourceAdd: this.goToResourceAdd,
doResourceSelect: this.doResourceSelect,
getResourceShowURL: this.getResourceShowURL,
hasAdditionalFields: this.hasAdditionalFields,
getFieldGroupings: this.getFieldGroupings,
resourceAttrs: this.resourceAttrs,
@ -125,16 +126,32 @@ export default {
/**
* Navigates to the show page of the given resource.
*
* @param {Object} resource - The resource to navigate to
* @param {Object} [resource] - The resource to navigate to
* @param {DataTable} [dt] - The DataTable (optional)
* @param {Event} [event] - The event to prevent default handling of (optional)
* @return {void}
*/
goToResourceShow(resource) {
goToResourceShow(resource, dt, event) {
event?.preventDefault();
this.$router.push({
name: this.showComponent,
params: { [this.idAttr]: resource[this.idAttr] },
});
},
/**
* Generates the URL for the show page of the given resource.
*
* @param {Object} resource - The resource to generate the URL for
* @return {string} The URL for the show page of the given resource
*/
getResourceShowURL(id) {
return this.$router.resolve({
name: this.showComponent,
params: { [this.idAttr]: id },
}).href;
},
/**
* Navigates to the edit page of the given resource.
*

View File

@ -66,6 +66,7 @@ export default {
doResourceDelete: Function,
goToResourceAdd: Function,
doResourceSelect: Function,
getResourceShowURL: Function,
resourceName: String,
resourceNamePlural: String,
hasAdditionalFields: { type: Boolean, default: false },
@ -152,6 +153,7 @@ export default {
},
getTableColumns(resourceAttrs) {
let get_lib_from_av = this.get_lib_from_av;
let thisResource = this;
const columns = resourceAttrs
?.filter(attr => attr.showInTable)
@ -168,8 +170,12 @@ export default {
orderable: true,
render: function (data, type, row, meta) {
return (
'<a role="button" class="show">' +
escape_str(row[attr.name]) +
'<a href="' +
thisResource.getResourceShowURL(
row[thisResource.idAttr]
) +
'" class="show">' +
escape_str(row[thisResource.idAttr]) +
"</a>"
);
},
@ -184,7 +190,11 @@ export default {
orderable: true,
render: function (data, type, row, meta) {
return (
'<a role="button" class="show">' +
'<a href="' +
thisResource.getResourceShowURL(
row[thisResource.idAttr]
) +
'" class="show">' +
escape_str(row[attr.name]) +
"</a>"
);