From 3fb26d1f48bbbb9e021ef1ac3e05ef163e4183b9 Mon Sep 17 00:00:00 2001 From: Owen Leonard Date: Wed, 31 May 2023 17:51:46 +0000 Subject: [PATCH] Bug 33891: Use template wrapper for tabs: OPAC advanced search This patch adds the tab WRAPPER markup to the OPAC, adapted for the Bootstrap version used by the OPAC (4.5.0). The advanced search page is updated to use the wrapper construction. Unrelated markup fix: an empty size attribute is removed from an . To test, apply the patch and view the the advanced search page in the OPAC. The tabs for item type, shelving location, and collection should all look correct and work correctly. In the staff interface, go to Administration -> System preferences -> OpacAdvancedSearchTypes and try various configurations, confirming each time that the OPAC page adjustes correctly. Signed-off-by: Lucas Gass Signed-off-by: David Cook Signed-off-by: Tomas Cohen Arazi (cherry picked from commit b754eb5b5a616fa54e721ac71c8049f0f00a52e8) Signed-off-by: Matt Blenkinsop --- .../bootstrap/en/includes/html_helpers.inc | 65 +++++++++++++++++++ .../bootstrap/en/modules/opac-advsearch.tt | 40 ++++++------ 2 files changed, 84 insertions(+), 21 deletions(-) diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/includes/html_helpers.inc b/koha-tmpl/opac-tmpl/bootstrap/en/includes/html_helpers.inc index d849154a37..5196f3beca 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/includes/html_helpers.inc +++ b/koha-tmpl/opac-tmpl/bootstrap/en/includes/html_helpers.inc @@ -33,3 +33,68 @@ [%- END -%] [%- this_biblio_href | url %][% biblionumber | url -%] [%- END %] + +[% # BOOTSTRAP TAB WRAPPER USAGE %] +[% # [ WRAPPER tabs id= "tabs_container_id" ] %] +[% # [ WRAPPER tabs_nav ] %] +[% # [ WRAPPER tab_item tabname= "tab_name_1" bt_active= 1 ] Tab text 1 [ END ] %] +[% # [ WRAPPER tab_item tabname= "tab_name_2" ] Tab text 2 [ END ] %] +[% # ... %] +[% # [ END ] %] +[% # [ WRAPPER tab_panels ] %] +[% # [ WRAPPER tab_panel tabname="tab_name_1" bt_active= 1 ] Panel contents 1 [ END ] %] +[% # [ WRAPPER tab_panel tabname="tab_name_2" ] Panel contents 2 [ END ] %] +[% # ... %] +[% # [ END ] %] +[% # [ END ] %] + +[% BLOCK tabs %] + [% IF ( id ) %] +
+ [% ELSE %] +
+ [% END %] + [% content | $raw %] +
+[% END %] + +[% BLOCK tabs_nav %] + +[% END %] + +[% BLOCK tab_item %] + +[% END %] + +[% BLOCK tab_panels %] + [% IF ( id ) %] +
+ [% ELSE %] +
+ [% END %] + [% content | $raw %] +
+[% END %] + +[% BLOCK tab_panel %] + [% IF ( bt_active ) %] +
+ [% ELSE %] +
+ [% END %] + [% content| $raw %] +
+[% END %] diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-advsearch.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-advsearch.tt index 7e09f3911f..eb1edd78bc 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-advsearch.tt +++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-advsearch.tt @@ -112,7 +112,7 @@
- +
[% IF ( expanded_options ) %]
@@ -144,7 +144,7 @@ See from (non-preferred form) headings are included
[% END %] -
+
@@ -162,23 +162,21 @@ [%# Following on one line for translatability %] [% IF ( ( OpacAdvSearchOptions and OpacAdvSearchOptions.grep('itemtype').size > 0 and not expanded_options ) or ( OpacAdvSearchMoreOptions and OpacAdvSearchMoreOptions.grep('itemtype').size > 0 and expanded_options ) ) %]
-
- -
+ [% END # /WRAPPER tabs_nav %] + [% WRAPPER tab_panels id= "advsearches" %] [% FOREACH advsearchloo IN advancedsearchesloop %] -
+ [% WRAPPER tab_panel tabname="advsearch-tab-${advsearchloo.advanced_search_type}" %]
Limit to any of the following:
@@ -204,13 +202,13 @@ [% END %] [% END %]
-
+ [% END # /tab_panel#advsearch-advsearchloo.advanced_search_type %] [% END # / FOREACH advancedsearchesloop %] -
-
+ [% END # /tab_panels %] + [% END # /WRAPPER tabs#advsearches %]
[% END # /IF OpacAdvSearchOptions %] - +
@@ -483,7 +481,7 @@ $(document).ready(function() { [% END %] if( $("#advsearches .tab-pane.active").length < 1 ){ - $("#advsearches a:first").tab("show"); + $("#advsearches li:first a").tab("show"); } $('.search-term-row .search-term-input select[name="op"]').first().prop("disabled",true).hide(); -- 2.20.1