From 4a52bc9a7a600e60b69405c59fb912fc9c74c83e Mon Sep 17 00:00:00 2001 From: Owen Leonard Date: Thu, 9 Mar 2023 18:14:04 +0000 Subject: [PATCH] Bug 33307: Use template wrapper for tabs: Lists This patch updates the lists template so that it uses the new WRAPPER directive to build tabbed navigation. To test, apply the patch and go to the lists page in the staff interface. - Confirm that the two tabs, "Your lists" and "Public lists" look correct and work correctly. - Test that the correct tab is selected when you add the "public" or "private" parameter to the url: /cgi-bin/koha/virtualshelves/shelves.pl?op=list&public=1 /cgi-bin/koha/virtualshelves/shelves.pl?op=list&public=0 Signed-off-by: Sally Signed-off-by: Katrin Fischer Signed-off-by: Tomas Cohen Arazi --- .../prog/en/modules/virtualshelves/shelves.tt | 42 ++++++++++--------- 1 file changed, 22 insertions(+), 20 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/virtualshelves/shelves.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/virtualshelves/shelves.tt index 57c0111d33..09ec20c821 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/virtualshelves/shelves.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/virtualshelves/shelves.tt @@ -493,18 +493,15 @@ [% IF op == 'list' %]

Lists

-
- - -
-
+ + [% WRAPPER tabs id= "tabs" %] + [% WRAPPER tabs_nav %] + [% WRAPPER tab_item tabname= "privateshelves_tab" bt_active= 1 %] Your lists [% END %] + [% WRAPPER tab_item tabname= "publicshelves_tab" %] Public lists [% END %] + [% END # /WRAPPER tabs_nav %] + + [% WRAPPER tab_panels %] + [% WRAPPER tab_panel tabname="shelves_tab" bt_active= 1 %] @@ -541,9 +538,10 @@
-
-
-
+ [% END %] + [% END # /WRAPPER tab_panels %] + [% END # /WRAPPER tabs %] + [% END # /IF op == 'list' %]
@@ -698,14 +696,18 @@ /* Select correct tab based on URL parameter */ if( public == 0 ){ - $('#privateshelves_tab').tab('show'); + $('a[href="#privateshelves_tab_panel"]').tab('show'); } else { - $("#publicshelves_tab").tab("show"); + $('a[href="#publicshelves_tab_panel"]').tab("show"); } - $('a[data-toggle="tab"]') - .on("click", function(){ - public = $(this).data("public"); + $('a[data-toggle="tab"]').on("click", function(e){ + let target = $(this).attr("href"); + if( target == "#publicshelves_tab_panel" ){ + public = 1; + } else { + public = 0; + } }) .on('shown.bs.tab', function (e) { dtListResults.fnDraw(); -- 2.39.5