From f03cf6cc108022a05d036d4c197760203d31468b 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 --- .../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 f89db262e4..0dd9f8a5f5 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-detail.tt +++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-detail.tt @@ -815,7 +815,7 @@ [% FILTER html_break %] [% review.review | html %] [% END %] - Edit + Edit

[% ELSE %] @@ -857,8 +857,8 @@ [% IF ( loggedinusername ) %] [% UNLESS ( loggedincommenter ) %] [% END %] @@ -1921,6 +1921,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 30f1406c83..83b21779ae 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/js/global.js +++ b/koha-tmpl/opac-tmpl/bootstrap/js/global.js @@ -46,7 +46,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