From 2282021cb9e0fc20185cf38c3a7c59f8dbf6b07f Mon Sep 17 00:00:00 2001
From: Owen Leonard
Date: Wed, 27 Sep 2023 16:26:03 +0000
Subject: [PATCH] Bug 34936: Remove the use of event attributes from OPAC
detail page
This patch removes the use of event attributes (onclick) from the OPAC's
bibliographic detail page template. These events are defined now along
with the other in-page JS.
The patch also adjusts the global "Dopop" function so that the popup
window is a litte bigger. The comments form did not fit well.
In checking for use of the "Dopop" function I found that it was being
redefined in opac-topissues.tt for no reason so I removed it.
To test you must have the OPACComments system preference enabled.
- Log in to the OPAC, locate a bibliographic record, and view the detail
page.
- Under the "Comments" tab, click the "Post your comments on this title"
link. It should trigger a popup window.
- Submit your comment. When the detail page reloads, return to the
"Comments" tab and click the "Edit" link on your comment. The same
popup window should be triggered.
Signed-off-by: Victor Grousset/tuxayo
Signed-off-by: Katrin Fischer
Signed-off-by: Tomas Cohen Arazi
(cherry picked from commit f03cf6cc108022a05d036d4c197760203d31468b)
Signed-off-by: Fridolin Somers
(cherry picked from commit 75f595ee523c78f8c0acf15484da6529596558fe)
Signed-off-by: Jacob O'Mara
---
.../opac-tmpl/bootstrap/en/modules/opac-detail.tt | 11 ++++++++---
.../opac-tmpl/bootstrap/en/modules/opac-topissues.tt | 3 ---
koha-tmpl/opac-tmpl/bootstrap/js/global.js | 2 +-
3 files changed, 9 insertions(+), 7 deletions(-)
diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-detail.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-detail.tt
index a583d44511..c10faffe13 100644
--- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-detail.tt
+++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-detail.tt
@@ -824,7 +824,7 @@
[% FILTER html_break %]
[% review.review | html %]
[% END %]
- Edit
+
[% ELSE %]
@@ -866,8 +866,8 @@
[% IF ( loggedinusername ) %]
[% UNLESS ( loggedincommenter ) %]
[% END %]
@@ -1927,6 +1927,11 @@
});
}());
[% END # /IF ( OPACShelfBrowser ) %]
+
+ $(".edit_comment").on("click", function(e){
+ e.preventDefault();
+ Dopop( this.href );
+ });
});
$(document).ready(function() {
diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-topissues.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-topissues.tt
index 602633a9c6..f6ec596210 100644
--- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-topissues.tt
+++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-topissues.tt
@@ -168,8 +168,5 @@
},
}));
});
- function Dopop(link) {
- newin=window.open(link,'width=500,height=400,toolbar=false,scrollbars=yes');
- }
[% END %]
diff --git a/koha-tmpl/opac-tmpl/bootstrap/js/global.js b/koha-tmpl/opac-tmpl/bootstrap/js/global.js
index b9ea0b6edf..c3b5e204c0 100644
--- a/koha-tmpl/opac-tmpl/bootstrap/js/global.js
+++ b/koha-tmpl/opac-tmpl/bootstrap/js/global.js
@@ -32,7 +32,7 @@ function confirmDelete(message) {
}
function Dopop(link) {
- newin=window.open(link,'popup','width=500,height=400,toolbar=false,scrollbars=yes,resizable=yes');
+ newin=window.open(link,'popup','width=660,height=450,toolbar=false,scrollbars=yes,resizable=yes');
}
jQuery.fn.preventDoubleFormSubmit = function() {
--
2.39.5