Koha/koha-tmpl/opac-tmpl/bootstrap/en/includes/html_helpers.inc
Owen Leonard a7e986e18b
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 <alexander.blanchard@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit 28d7108624)
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2023-07-18 11:01:59 +01:00

105 lines
4.5 KiB
HTML

[% BLOCK options_for_libraries %]
[% FOREACH l IN libraries %]
[% IF l.selected %]
<option value="[% l.branchcode | html %]" selected="selected">[% l.branchname | html %]</option>
[% ELSE %]
<option value="[% l.branchcode | html %]">[% l.branchname | html %]</option>
[% END%]
[% END %]
[% END %]
[% BLOCK koha_news_block %]
[% IF ( news.content && news.content.count > 0 ) %]
<div id="[% news.location | html %]">
[% FOREACH n IN news.content %]
<div class="[% n.lang | html %]_item">
[% IF ( n.title && news.blocktitle ) %]
<h4 class="[% n.lang | html %]_header">[% n.title | html %]</h4>
[% END %]
<div class="[% n.lang | html %]_body">[% n.content | $raw %]</div>
</div>
[% END %]
</div>
[% END %]
[% END %]
[% BLOCK biblio_a_href -%]
[%- IF Koha.Preference('BiblioDefaultView') == 'marc' -%]
[%- SET this_biblio_href = "/cgi-bin/koha/opac-MARCdetail.pl?biblionumber=" -%]
[%- ELSIF Koha.Preference('BiblioDefaultView') == 'isbd' -%]
[%- SET this_biblio_href = "/cgi-bin/koha/opac-ISBDdetail.pl?biblionumber=" -%]
[%- ELSE -%]
[%- SET this_biblio_href = "/cgi-bin/koha/opac-detail.pl?biblionumber=" -%]
[%- 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 ] <span>Tab text 1</span> [ END ] %]
[% # [ WRAPPER tab_item tabname= "tab_name_2" ] <span>Tab text 2</span> [ 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 ) %]
<div id="[% id | html %]" class="toptabs">
[% ELSE %]
<div class="toptabs">
[% END %]
[% content | $raw %]
</div>
[% END %]
[% BLOCK tabs_nav %]
<ul class="nav nav-tabs" role="tablist">
[% content | $raw %]
</ul>
[% END %]
[% BLOCK tab_item %]
<li class="nav-item" role="presentation">
[% IF ( bt_active ) %]
[% SET link_class="nav-link active" %]
[% SET aria_selected="true" %]
[% ELSE %]
[% SET link_class="nav-link" %]
[% SET aria_selected="false" %]
[% END %]
[% IF ( tabid ) %]
[% SET our_tab_id = tabid %]
[% ELSE %]
[% SET our_tab_id = tabname %]
[% END %]
<a href="#[% tabname | uri %]_panel" class="[% link_class | html %]" id="[% our_tab_id | html %]-tab" data-toggle="tab" data-target="#[% tabname | html %]_panel" data-tabname="[% tabname | uri %]" aria-controls="[% tabname | uri %]_panel" role="tab" aria-selected="[% aria_selected | html %]">
[% content | $raw %]
</a>
</li>
[% END %]
[% BLOCK tab_panels %]
[% IF ( id ) %]
<div class="tab-content" id="[% id | html %]_content">
[% ELSE %]
<div class="tab-content">
[% END %]
[% content | $raw %]
</div>
[% END %]
[% BLOCK tab_panel %]
[% IF ( bt_active ) %]
<div role="tabpanel" class="tab-pane show active" id="[% tabname | html %]_panel" aria-labelledby="[% tabname | html %]-tab">
[% ELSE %]
<div role="tabpanel" class="tab-pane" id="[% tabname | html %]_panel" aria-labelledby="[% tabname | html %]-tab">
[% END %]
[% content| $raw %]
</div>
[% END %]