From 32258f82b5dd6a2bef3faedf06211eaf674f674c Mon Sep 17 00:00:00 2001 From: Martin Renvoize Date: Mon, 7 Nov 2022 16:44:29 +0000 Subject: [PATCH] Bug 32125: Select correct tab on return Signed-off-by: Martin Renvoize Signed-off-by: David Nind Signed-off-by: Katrin Fischer Signed-off-by: Tomas Cohen Arazi --- .../opac-tmpl/bootstrap/en/modules/opac-detail.tt | 10 +++++++++- koha-tmpl/opac-tmpl/bootstrap/js/global.js | 9 ++++++++- 2 files changed, 17 insertions(+), 2 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 dba7c9b0ff..c6fb1c26c6 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-detail.tt +++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-detail.tt @@ -880,7 +880,7 @@ [% END %] [% ELSE %]
- to post a comment. + to post a comment.
[% END # / IF loggedinusername %] @@ -1705,6 +1705,14 @@ showBsTab("bibliodescriptions", "holdings"); [% END -%] + let urlParams = new URLSearchParams(window.location.search); + if ( urlParams.has('tab') ) { + let tab = urlParams.get('tab'); + if ( tab == 'comment' ) { + showBsTab("bibliodescriptions", "comments"); + } + } + [% IF ( Koha.Preference('OpacBrowseResults') && busc ) %] $(".l_Results").show(); $("#a_listResults").on("click", function(e){ diff --git a/koha-tmpl/opac-tmpl/bootstrap/js/global.js b/koha-tmpl/opac-tmpl/bootstrap/js/global.js index ce5d4f64b6..b9ea0b6edf 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/js/global.js +++ b/koha-tmpl/opac-tmpl/bootstrap/js/global.js @@ -228,7 +228,14 @@ $(document).ready(function(){ var button = $(this); var context = button.data('return'); if ( context ) { - $('#modalAuth').append(''); + let return_url = window.location.pathname; + let params = window.location.search; + var tab = button.data('tab'); + if ( tab ) { + params = params ? params + '&tab=' + tab : '?tab=' + tab; + } + return_url += params; + $('#modalAuth').append(''); } $("#loginModal").modal("show"); }); -- 2.39.5