From a7e986e18b5ee0647c3ddd35dd1024469adbd2ee Mon Sep 17 00:00:00 2001 From: Owen Leonard Date: Mon, 5 Jun 2023 13:07:35 +0000 Subject: [PATCH] Bug 33893: Use template wrapper for tabs: OPAC checkout history This patch updates the OPAC checkout history page so that it uses the new WRAPPER syntax to generate tabs markup. This patch also updates tab WRAPPER directives in html_helpers.inc to allow us to pass a custom id for tab links in situations like this one where we have multiple tabs requiring unique IDs but they all point to the same panel. To test, apply the patch and make sure the OnSiteCheckouts system preference is set to "disabled." - Log into the OPAC as a patron with checkouts. - View the checkout history page. The checkout history information should be displayed without any tabs. - Enable the OnSiteCheckouts system preference and if necessary check out some on-site checkouts to your patron. - On the OPAC history page there should now be three tabs: All, Checkouts, and On-site checokuts. - Switching between the tabs should filter the table accordingly. - Test that the changes to the tab wrapper have not broken tabs on other pages, e.g. bibliographic details or user summary. Signed-off-by: AlexanderBlanchardAC Signed-off-by: Katrin Fischer Signed-off-by: Tomas Cohen Arazi (cherry picked from commit 28d7108624d779934aad74931ef0aebdd9e732c2) Signed-off-by: Martin Renvoize --- .../bootstrap/en/includes/html_helpers.inc | 7 +- .../en/modules/opac-readingrecord.tt | 252 +++++++++--------- 2 files changed, 135 insertions(+), 124 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 5196f3beca..e0b7a8edd4 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/includes/html_helpers.inc +++ b/koha-tmpl/opac-tmpl/bootstrap/en/includes/html_helpers.inc @@ -73,7 +73,12 @@ [% SET link_class="nav-link" %] [% SET aria_selected="false" %] [% END %] - + [% IF ( tabid ) %] + [% SET our_tab_id = tabid %] + [% ELSE %] + [% SET our_tab_id = tabname %] + [% END %] + [% content | $raw %] diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-readingrecord.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-readingrecord.tt index 528e6bc836..4d730e3b9b 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-readingrecord.tt +++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-readingrecord.tt @@ -53,11 +53,11 @@ [% ELSE %]
- [% IF savings %] -
- Congratulations, you have saved a total of [% savings | $Price with_symbol => 1 %] by using the library. -
- [% END %] + [% IF savings %] +
+ Congratulations, you have saved a total of [% savings | $Price with_symbol => 1 %] by using the library. +
+ [% END %]
@@ -82,124 +82,28 @@ [% END %] [% IF Koha.Preference( 'OnSiteCheckouts' ) == 1 %] -
- -
+ [% WRAPPER tabs id= "tabs" %] + [% WRAPPER tabs_nav %] + [% WRAPPER tab_item tabid= "all_checkouts" tabname="tabs-container" bt_active= 1 %] + All + [% END %] + [% WRAPPER tab_item tabid= "checkout" tabname="tabs-container" %] + Checkouts + [% END %] + [% WRAPPER tab_item tabid= "onsite_checkout" tabname="tabs-container" %] + On-site checkouts + [% END %] + [% END # /WRAPPER tabs_nav %] + [% WRAPPER tab_panels %] + [% WRAPPER tab_panel tabname="tabs-container" bt_active= 1 %] + [% PROCESS checkout_history_table %] + [% END # /tab_panel# %] + [% END # /WRAPPER tab_panels %] + [% END # /WRAPPER tabs %] + [% ELSE %] + [% PROCESS checkout_history_table %] [% END %] -
- - - - - - - - - - - - - [% IF ( OPACMySummaryHTML ) %] - - [% END %] - - - - - [% FOREACH issue IN READING_RECORD %] - - - - - - - - - [% IF issue.returndate %] - - [% IF OPACMySummaryHTML %] - - [% END %] - - - [% END # / FOREACH issue %] - -
Checkout history
TitleAuthorItem typeCall numberVol infoDateLinks
- [% IF issue.onsite_checkout %][% issuetype = 'onsite_checkout' %] - [% ELSE %][% issuetype = 'standard_checkout' %] - [% END %] - [% issuetype | html %] - - [% IF OPACAmazonCoverImages %] - [% IF issue.normalized_isbn %] - - [% ELSE %] - No cover image available - [% END %] - [% END %] - [% IF GoogleJackets %] - [% IF issue.normalized_isbn %] -
- [% ELSE %] - No cover image available - [% END %] - [% END %] - - [% IF BakerTaylorEnabled %] - [% bt_id = ( issue.normalized_upc || issue.normalized_isbn ) %] - [% IF ( bt_id ) %] - See Baker & Taylor - [% ELSE %] - No cover image available - [% END %] - [% END %] - - [% IF SyndeticsEnabled && SyndeticsCoverImages %] - - [% END %] -
- [% INCLUDE 'biblio-title.inc' biblio=issue, link => 1 %] - [% IF ( Koha.Preference( 'OpacStarRatings' ) == 'all' ) %] - [% INCLUDE 'user-star-ratings.inc' item=issue %] - [% END %] - [% issue.author | html %] - [% UNLESS ( Koha.Preference('OpacNoItemTypeImages') ) %] - [% IF ( issue.imageurl ) %] - - [% END %] - [% END %] - Item type: - [% issue.translated_description | html %] - Call number: - [% issue.itemcallnumber | html %] - - [% IF issue.enumchron %] - [% issue.enumchron | html %] - [% END %] - - Check-in date: - [% issue.returndate | $KohaDates %] - [% ELSE %] - - (Checked out) - [% END %] - [% issue.MySummaryHTML | $raw %]
-
- [% IF ( Koha.Preference( 'OnSiteCheckouts' ) == 1 ) %] -
-
- [% END %]
[% END # / IF READING_RECORD.size %]
@@ -208,6 +112,108 @@ +[% BLOCK checkout_history_table %] + + + + + + + + + + + + + [% IF ( OPACMySummaryHTML ) %] + + [% END %] + + + + + [% FOREACH issue IN READING_RECORD %] + + + + + + + + + [% IF issue.returndate %] + + [% IF OPACMySummaryHTML %] + + [% END %] + + + [% END # / FOREACH issue %] + +
Checkout history
TitleAuthorItem typeCall numberVol infoDateLinks
+ [% IF issue.onsite_checkout %][% issuetype = 'onsite_checkout' %] + [% ELSE %][% issuetype = 'standard_checkout' %] + [% END %] + [% issuetype | html %] + + [% IF OPACAmazonCoverImages %] + [% IF issue.normalized_isbn %] + + [% ELSE %] + No cover image available + [% END %] + [% END %] + + [% IF GoogleJackets %] + [% IF issue.normalized_isbn %] +
+ [% ELSE %] + No cover image available + [% END %] + [% END %] + + [% IF BakerTaylorEnabled %] + [% bt_id = ( issue.normalized_upc || issue.normalized_isbn ) %] + [% IF ( bt_id ) %] + See Baker & Taylor + [% ELSE %] + No cover image available + [% END %] + [% END %] + + [% IF SyndeticsEnabled && SyndeticsCoverImages %] + + [% END %] +
+ [% INCLUDE 'biblio-title.inc' biblio=issue, link => 1 %] + [% IF ( Koha.Preference( 'OpacStarRatings' ) == 'all' ) %] + [% INCLUDE 'user-star-ratings.inc' item=issue %] + [% END %] + [% issue.author | html %] + [% UNLESS ( Koha.Preference('OpacNoItemTypeImages') ) %] + [% IF ( issue.imageurl ) %] + + [% END %] + [% END %] + Item type: + [% issue.translated_description | html %] + + Call number: + [% issue.itemcallnumber | html %] + + [% IF issue.enumchron %] + [% issue.enumchron | html %] + [% END %] + + Check-in date: + [% issue.returndate | $KohaDates %] + [% ELSE %] + + (Checked out) + [% END %] + [% issue.MySummaryHTML | $raw %]
+[% END %] + [% INCLUDE 'opac-bottom.inc' %] [% BLOCK jsinclude %] [% INCLUDE 'datatables.inc' %] @@ -239,9 +245,9 @@ $("#tabs a[data-toggle='tab']").on("shown.bs.tab", function (e) { var id = e.target.id; - if ( id == "tab_checkout" ) { + if ( id == "checkout-tab" ) { table.fnFilter("standard_checkout", 0); - } else if ( id == "tab_onsite_checkout" ) { + } else if ( id == "onsite_checkout-tab" ) { table.fnFilter("onsite_checkout", 0); } else { // all table.fnFilter('', 0); -- 2.39.5