Bug 33186: Use template wrapper for tabs on search history and advanced search

This patch updates the search history and advanced search templates in
the staff interface so that they use the new WRAPPER directive for
building tabs.

The patch also makes a minor change to CSS in order to accommodate the
different markup.

To test, apply the patch and rebuild the staff interface CSS.

- Go to the catalog's advanced search page. You should see tabs for each
  of the selections defined in the AdvancedSearchTypes system
  preference.
- The tabs should look correct and work correctly.
- If necessary, enable the EnableSearchHistory system preference.
- Click the logged-in user name in the header menu and choose "Search
  history."
- On this page you should see two tabs, catalog and authority. Both tabs
  should look correct and work correctly.

Signed-off-by: Matt Blenkinsop <matt.blenkinsop@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 78f037382d)
Signed-off-by: Jacob O'Mara <jacobomara901@gmail.com>
This commit is contained in:
Owen Leonard 2023-03-09 18:47:04 +00:00 committed by Jacob O'Mara
parent cfc2640e6c
commit a1b71f201f
3 changed files with 197 additions and 193 deletions

View File

@ -2443,7 +2443,6 @@ td.bundle {
}
}
.field_hint {
color: #808080;
font-style: italic;
@ -2458,23 +2457,23 @@ td.bundle {
width: 50%;
}
.advsearch {
margin: 0 1em 1em 0;
table {
border-collapse: separate;
border-spacing: 5px;
border-width: 0;
}
td {
border: 1px solid #EEE;
padding: .3em .4em;
}
}
#advsearches {
margin-bottom: 1em;
.tab-pane {
margin: 0 1em 1em 0;
table {
border-collapse: separate;
border-spacing: 5px;
border-width: 0;
}
td {
border: 1px solid #EEE;
padding: .3em .4em;
}
}
}
#circ_circulation_issue {

View File

@ -207,24 +207,26 @@
</div> <!-- /#advanced-search -->
<!-- MC-TYPE LIMITS -->
<div id="advsearches" class="toptabs">
<ul class="nav nav-tabs" role="tablist">
[% WRAPPER tabs id= "advsearches" %]
[% WRAPPER tabs_nav %]
[% FOREACH advsearchloo IN advancedsearchesloop %]
<li role="presentation" id="advsearch-tab-[% advsearchloo.advanced_search_type | html %]">
<a href="#advsearch-[% advsearchloo.advanced_search_type | uri %]" aria-controls="advsearch-[% advsearchloo.advanced_search_type | uri %]" role="tab" data-toggle="tab">
[% IF ( advsearchloo.advanced_search_type == 'itemtypes' ) %]<span>Item type</span>
[% ELSIF ( advsearchloo.advanced_search_type == 'ccode' ) %]<span>Collection</span>
[% ELSIF ( advsearchloo.advanced_search_type == 'loc' ) %]<span>Shelving location</span>
[% ELSE %]<span>Something else</span>
[% END %]
</a>
</li>
[% WRAPPER tab_item tabname= "advsearch-tab-${advsearchloo.advanced_search_type}" %]
[% IF ( advsearchloo.advanced_search_type == 'itemtypes' ) %]
<span>Item type</span>
[% ELSIF ( advsearchloo.advanced_search_type == 'ccode' ) %]
<span>Collection</span>
[% ELSIF ( advsearchloo.advanced_search_type == 'loc' ) %]
<span>Shelving location</span>
[% ELSE %]
<span>Something else</span>
[% END %]
[% END # /tab_item#advsearch-tab-... %]
[% END # /FOREACH advsearchloo %]
</ul>
[% END # /WRAPPER tabs_nav %]
<div class="tab-content">
[% WRAPPER tab_panels %]
[% FOREACH advsearchloo IN advancedsearchesloop %]
<div id="advsearch-[% advsearchloo.advanced_search_type | html %]" role="tabpanel" class="tab-pane advsearch">
[% WRAPPER tab_panel tabname="advsearch-tab-${advsearchloo.advanced_search_type}" %]
<h4>Limit to any of the following:</h4>
<table>
<tr>
@ -257,10 +259,10 @@
[% END # /IF ( loop.last ) %]
[% END # /FOREACH itemtypeloo %]
</table>
</div> <!-- /#advsearch-[% advsearchloo.advanced_search_type | html %] -->
[% END # tab_panel/#advsearch-... %]
[% END # /FOREACH advsearchloo %]
</div> <!-- /.tab-content -->
</div> <!-- /#advsearches -->
[% END # /WRAPPER tab_panels %]
[% END # /WRAPPER tabs %]
<!-- /MC-TYPE LIMIT -->
[% IF ( expanded_options ) %]

View File

@ -37,181 +37,184 @@
<div class="col-sm-12 col-md-8 col-md-offset-2">
<h1>Search history</h1>
<div id="tabs" class="toptabs">
<ul class="nav nav-tabs" role="tablist">
<li role="presentation" class="active"><a href="#biblio_tab" aria-controls="biblio_tab" role="tab" data-toggle="tab">Catalog</a></li>
<li role="presentation"><a href="#authority_tab" aria-controls="authority_tab" role="tab" data-toggle="tab">Authority</a></li>
</ul>
<div class="tab-content">
<div role="tabpanel" class="tab-pane active" id="biblio_tab">
[% IF ( current_biblio_searches ) %]
<h2>Current session</h2>
<form id="current_cat" action="/cgi-bin/koha/catalogue/search-history.pl" method="post">
<p class="selections-toolbar">
<a class="CheckAll" data-form="current_cat" href="#"><i class="fa fa-check"></i> Select all visible rows</a>
<span class="sep">|</span>
<a class="CheckNone" data-form="current_cat" href="#"><i class="fa fa-remove"></i> Clear selection on visible rows</a>
<span class="sep">|</span>
<span class="links">
<span class="selections">Select searches to: </span>
<a href="#" class="btn btn-default btn-xs action_delete disabled"><i class="fa fa-trash" aria-hidden="true"></i> Delete</a>
</span>
</p>
<input type="hidden" name="action" value="delete" />
<table class="historyt">
<thead>
<tr>
<th></th>
<th>Date</th>
<th>Search</th>
<th>Results</th>
</tr>
</thead>
<tbody>
[% FOREACH s IN current_biblio_searches %]
[% WRAPPER tabs id= "tabs" %]
[% WRAPPER tabs_nav %]
[% WRAPPER tab_item tabname= "biblio_tab" bt_active= 1 %] <span>Catalog</span> [% END %]
[% WRAPPER tab_item tabname= "authority_tab" %] <span>Authority</span> [% END %]
[% END # /WRAPPER tabs_nav %]
[% WRAPPER tab_panels %]
[% WRAPPER tab_panel tabname="biblio_tab" bt_active= 1 %]
[% IF ( current_biblio_searches ) %]
<h2>Current session</h2>
<form id="current_cat" action="/cgi-bin/koha/catalogue/search-history.pl" method="post">
<p class="selections-toolbar">
<a class="CheckAll" data-form="current_cat" href="#"><i class="fa fa-check"></i> Select all visible rows</a>
<span class="sep">|</span>
<a class="CheckNone" data-form="current_cat" href="#"><i class="fa fa-remove"></i> Clear selection on visible rows</a>
<span class="sep">|</span>
<span class="links">
<span class="selections">Select searches to: </span>
<a href="#" class="btn btn-default btn-xs action_delete disabled"><i class="fa fa-trash" aria-hidden="true"></i> Delete</a>
</span>
</p>
<input type="hidden" name="action" value="delete" />
<table class="historyt">
<thead>
<tr>
<td><input type="checkbox" name="id" value="[% s.id | html %]" /></td>
<td data-order="[% s.time | html %]">[% s.time |$KohaDates with_hours => 1 %]</td>
<td><a href="/cgi-bin/koha/catalogue/search.pl?[% s.query_cgi | $raw %]">[% s.query_desc | html %]</a></td>
<td>[% s.total | html %]</td>
<th></th>
<th>Date</th>
<th>Search</th>
<th>Results</th>
</tr>
[% END %]
</tbody>
</table>
</form>
[% END %]
</thead>
<tbody>
[% FOREACH s IN current_biblio_searches %]
<tr>
<td><input type="checkbox" name="id" value="[% s.id | html %]" /></td>
<td data-order="[% s.time | html %]">[% s.time |$KohaDates with_hours => 1 %]</td>
<td><a href="/cgi-bin/koha/catalogue/search.pl?[% s.query_cgi | $raw %]">[% s.query_desc | html %]</a></td>
<td>[% s.total | html %]</td>
</tr>
[% END %]
</tbody>
</table>
</form>
[% END %]
[% IF ( current_biblio_searches && previous_biblio_searches) %]
<hr />
[% END %]
[% IF ( current_biblio_searches && previous_biblio_searches) %]
<hr />
[% END %]
[% IF ( previous_biblio_searches ) %]
<h2>Previous sessions</h2>
<form id="previous_cat" action="/cgi-bin/koha/catalogue/search-history.pl" method="post">
<p class="selections-toolbar">
<a class="CheckAll" data-form="previous_cat" href="#"><i class="fa fa-check"></i> Select all visible rows</a>
<span class="sep">|</span>
<a class="CheckNone" data-form="previous_cat" href="#"><i class="fa fa-remove"></i> Clear selection on visible rows</a>
<span class="sep">|</span>
<span class="links">
<span class="selections">Select searches to: </span>
<a href="#" class="btn btn-default btn-xs action_delete disabled"><i class="fa fa-trash" aria-hidden="true"></i> Delete</a>
</span>
</p>
<input type="hidden" name="action" value="delete" />
<table class="historyt">
<thead>
<tr>
<th></th>
<th>Date</th>
<th>Search</th>
<th>Results</th>
</tr>
</thead>
<tbody>
[% FOREACH s IN previous_biblio_searches %]
[% IF ( previous_biblio_searches ) %]
<h2>Previous sessions</h2>
<form id="previous_cat" action="/cgi-bin/koha/catalogue/search-history.pl" method="post">
<p class="selections-toolbar">
<a class="CheckAll" data-form="previous_cat" href="#"><i class="fa fa-check"></i> Select all visible rows</a>
<span class="sep">|</span>
<a class="CheckNone" data-form="previous_cat" href="#"><i class="fa fa-remove"></i> Clear selection on visible rows</a>
<span class="sep">|</span>
<span class="links">
<span class="selections">Select searches to: </span>
<a href="#" class="btn btn-default btn-xs action_delete disabled"><i class="fa fa-trash" aria-hidden="true"></i> Delete</a>
</span>
</p>
<input type="hidden" name="action" value="delete" />
<table class="historyt">
<thead>
<tr>
<td><input type="checkbox" name="id" value="[% s.id | html %]" /></td>
<td data-order="[% s.time | html %]">[% s.time |$KohaDates with_hours => 1 %]</td>
<td><a href="/cgi-bin/koha/catalogue/search.pl?[% s.query_cgi | $raw %]">[% s.query_desc | html %]</a></td>
<td>[% s.total | html %]</td>
<th></th>
<th>Date</th>
<th>Search</th>
<th>Results</th>
</tr>
[% END %]
</tbody>
</table>
</form>
[% END %]
</thead>
<tbody>
[% FOREACH s IN previous_biblio_searches %]
<tr>
<td><input type="checkbox" name="id" value="[% s.id | html %]" /></td>
<td data-order="[% s.time | html %]">[% s.time |$KohaDates with_hours => 1 %]</td>
<td><a href="/cgi-bin/koha/catalogue/search.pl?[% s.query_cgi | $raw %]">[% s.query_desc | html %]</a></td>
<td>[% s.total | html %]</td>
</tr>
[% END %]
</tbody>
</table>
</form>
[% END %]
[% IF !current_biblio_searches && !previous_biblio_searches %]
<p>Your catalog search history is empty.</p>
[% END %]
</div> <!-- /#biblio_tab -->
[% IF !current_biblio_searches && !previous_biblio_searches %]
<p>Your catalog search history is empty.</p>
[% END %]
[% END # /tab_panel#biblio_tab %]
<div id="authority_tab" role="tabpanel" class="tab-pane">
[% IF ( current_authority_searches ) %]
<h2>Current session</h2>
<form id="current_auth" action="/cgi-bin/koha/catalogue/search-history.pl" method="post">
<p class="selections-toolbar">
<a class="CheckAll" data-form="current_auth" href="#"><i class="fa fa-check"></i> Select all visible rows</a>
<span class="sep">|</span>
<a class="CheckNone" data-form="current_auth" href="#"><i class="fa fa-remove"></i> Clear selection on visible rows</a>
<span class="sep">|</span>
<span class="links">
<span class="selections">Select searches to: </span>
<a href="#" class="btn btn-default btn-xs action_delete disabled"><i class="fa fa-trash" aria-hidden="true"></i> Delete</a>
</span>
</p>
<input type="hidden" name="action" value="delete" />
<table class="historyt">
<thead>
<tr>
<th></th>
<th>Date</th>
<th>Search</th>
<th>Results</th>
</tr>
</thead>
<tbody>
[% FOREACH s IN current_authority_searches %]
[% WRAPPER tab_panel tabname="authority_tab" %]
[% IF ( current_authority_searches ) %]
<h2>Current session</h2>
<form id="current_auth" action="/cgi-bin/koha/catalogue/search-history.pl" method="post">
<p class="selections-toolbar">
<a class="CheckAll" data-form="current_auth" href="#"><i class="fa fa-check"></i> Select all visible rows</a>
<span class="sep">|</span>
<a class="CheckNone" data-form="current_auth" href="#"><i class="fa fa-remove"></i> Clear selection on visible rows</a>
<span class="sep">|</span>
<span class="links">
<span class="selections">Select searches to: </span>
<a href="#" class="btn btn-default btn-xs action_delete disabled"><i class="fa fa-trash" aria-hidden="true"></i> Delete</a>
</span>
</p>
<input type="hidden" name="action" value="delete" />
<table class="historyt">
<thead>
<tr>
<td><input type="checkbox" name="id" value="[% s.id | html %]" /></td>
<td data-order="[% s.time | html %]">[% s.time |$KohaDates with_hours => 1 %]</td>
<td><a href="/cgi-bin/koha/authorities/authorities-home.pl?[% s.query_cgi | $raw %]">[% s.query_desc | html %]</a></td>
<td>[% s.total | html %]</td>
<th></th>
<th>Date</th>
<th>Search</th>
<th>Results</th>
</tr>
[% END %]
</tbody>
</table>
</form>
[% END %]
</thead>
<tbody>
[% FOREACH s IN current_authority_searches %]
<tr>
<td><input type="checkbox" name="id" value="[% s.id | html %]" /></td>
<td data-order="[% s.time | html %]">[% s.time |$KohaDates with_hours => 1 %]</td>
<td><a href="/cgi-bin/koha/authorities/authorities-home.pl?[% s.query_cgi | $raw %]">[% s.query_desc | html %]</a></td>
<td>[% s.total | html %]</td>
</tr>
[% END %]
</tbody>
</table>
</form>
[% END %]
[% IF ( current_authority_searches && previous_authority_searches) %]
<hr />
[% END %]
[% IF ( current_authority_searches && previous_authority_searches) %]
<hr />
[% END %]
[% IF ( previous_authority_searches ) %]
<h2>Previous sessions</h2>
<form id="previous_auth" action="/cgi-bin/koha/catalogue/search-history.pl" method="post">
<p class="selections-toolbar">
<a class="CheckAll" data-form="previous_auth" href="#"><i class="fa fa-check"></i> Select all visible rows</a>
<span class="sep">|</span>
<a class="CheckNone" data-form="previous_auth" href="#"><i class="fa fa-remove"></i> Clear selection on visible rows</a>
<span class="sep">|</span>
<span class="links">
<span class="selections">Select searches to: </span>
<a href="#" class="btn btn-default btn-xs action_delete disabled"><i class="fa fa-trash" aria-hidden="true"></i> Delete</a>
</span>
</p>
<input type="hidden" name="action" value="delete" />
<table class="historyt">
<thead>
<tr>
<th></th>
<th>Date</th>
<th>Search</th>
<th>Results</th>
</tr>
</thead>
<tbody>
[% FOREACH s IN previous_authority_searches %]
[% IF ( previous_authority_searches ) %]
<h2>Previous sessions</h2>
<form id="previous_auth" action="/cgi-bin/koha/catalogue/search-history.pl" method="post">
<p class="selections-toolbar">
<a class="CheckAll" data-form="previous_auth" href="#"><i class="fa fa-check"></i> Select all visible rows</a>
<span class="sep">|</span>
<a class="CheckNone" data-form="previous_auth" href="#"><i class="fa fa-remove"></i> Clear selection on visible rows</a>
<span class="sep">|</span>
<span class="links">
<span class="selections">Select searches to: </span>
<a href="#" class="btn btn-default btn-xs action_delete disabled"><i class="fa fa-trash" aria-hidden="true"></i> Delete</a>
</span>
</p>
<input type="hidden" name="action" value="delete" />
<table class="historyt">
<thead>
<tr>
<td><input type="checkbox" name="id" value="[% s.id | html %]" /></td>
<td data-order="[% s.time | html %]">[% s.time |$KohaDates with_hours => 1 %]</td>
<td><a href="/cgi-bin/koha/authorities/authorities-home.pl?[% s.query_cgi | $raw %]">[% s.query_desc | html %]</a></td>
<td>[% s.total | html %]</td>
<th></th>
<th>Date</th>
<th>Search</th>
<th>Results</th>
</tr>
[% END %]
</tbody>
</table>
</form>
[% END %]
</thead>
<tbody>
[% FOREACH s IN previous_authority_searches %]
<tr>
<td><input type="checkbox" name="id" value="[% s.id | html %]" /></td>
<td data-order="[% s.time | html %]">[% s.time |$KohaDates with_hours => 1 %]</td>
<td><a href="/cgi-bin/koha/authorities/authorities-home.pl?[% s.query_cgi | $raw %]">[% s.query_desc | html %]</a></td>
<td>[% s.total | html %]</td>
</tr>
[% END %]
</tbody>
</table>
</form>
[% END %]
[% IF !current_authority_searches && !previous_authority_searches %]
<p>Your authority search history is empty.</p>
[% END %]
[% END # /tab_panel#authority_tab %]
[% END # /WRAPPER tab_panels %]
[% END # /WRAPPER tabs %]
[% IF !current_authority_searches && !previous_authority_searches %]
<p>Your authority search history is empty.</p>
[% END %]
</div> [% # /authority_tab %]
</div> <!-- /.tab-content -->
</div> [% # /tabs %]
</div> [% # /div.col-md-8 %]
</div> [% # /div.row %]