From d5a02359ed0e2013677f9047bc5074bd41b640ef Mon Sep 17 00:00:00 2001 From: Owen Leonard Date: Fri, 13 Jun 2025 15:02:35 +0000 Subject: [PATCH] Bug 37773: Show search term in cataloging search results MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This patch updates the cataloging search results page so that the search term is shown in the page title, breadcrumb, and headings. To test, apply the patch and go to Cataloging in the staff interface. - Perform searches which will return varying results: - A search which returns records in both the catalog and the reservoir (perform some Z39.50 searches if the reservoir is empty). - A search which returns records in the catalog but not the reservoir. - A search which returns records in the reservoir but not the catalog. - A search which returns no results at all. - In all cases, check the page title, breadcrumbs, and headings. Your search term should appear as expected. - Test that the correct strings are translatable. In this example I'm testing fr-FR: - Update a translation: > gulp po:update > cd misc/translator > perl translate update fr-FR - Open the corresponding .po file for the strings pulled from the template e.g. misc/translator/po/fr-FR-messages.po - Locate strings pulled from addbooks.tt for translation, e.g.: #: koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/addbooks.tt:93 #: koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/addbooks.tt:207 #, fuzzy, perl-brace-format msgid "No catalog search results for '{query}'" msgstr "Résultats de recherche pour '{query}'" - Delete the line starting with "#, fuzzy" - Edit the "msgstr" string however you want (it's just for testing) - Install the updated translation: > perl translate install fr-FR - Switch to your updated translation in the staff interface and perform the same tests as above. The translations should appear as expected. Sponsored-by: Athens County Public Libraries --- .../prog/en/modules/cataloguing/addbooks.tt | 27 ++++++++++--------- 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/addbooks.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/addbooks.tt index 0e61ec2d8b6..288227518e6 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/addbooks.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/addbooks.tt @@ -8,7 +8,7 @@ [% FILTER collapse %] [% IF ( total || breeding_loop ) %] - [% t("Search results") | html %] + [% tx("Search results for '{query}'", {query = query}) | html %] › [% ELSIF ( query ) %] [% t("No results found") | html %] @@ -35,7 +35,7 @@ [% END %] [% IF ( total || breeding_loop ) %] [% WRAPPER breadcrumb_item bc_active= 1 %] - <span>Search results</span> + [% tx("Search results for '{query}'", {query = query}) | html %] [% END %] [% ELSIF ( query ) %] [% WRAPPER breadcrumb_item bc_active= 1 %] @@ -90,13 +90,14 @@ <h1>Cataloging</h1> [% IF ( noitemsfound ) %] - No results found + <div class="alert alert-info"> [% tx("No catalog search results for '{query}'", {query = query}) | html %] </div> + <!-- /.page-section --> [% END %] [%# display the search results %] [% IF ( total ) %] - <h2>Records found in the catalog</h2> + <h2>[% tx("Catalog search results for '{query}'", {query = query}) | html %]</h2> <div class="page-section"> <div> [% total | html %] result(s) found in catalog, @@ -203,7 +204,7 @@ <!-- /.page-section --> [% ELSE # IF total %] [% IF ( query ) %] - <h3>No results found</h3> + <div class="alert alert-info"> [% tx("No catalog search results for '{query}'", {query = query}) | html %] </div> [% IF ( error ) %] <div class="alert alert-warning"> Error: <span class="error">[% error | html %]</span> </div> [% END %] @@ -212,9 +213,9 @@ [% IF ( query ) %] <div id="searchresult-breeding"> - <h2>Records found in the reservoir</h2> - <div class="page-section"> - [% IF ( breeding_loop ) %] + [% IF ( breeding_loop ) %] + <h2>[% tx("Reservoir search results for '{query}'", {query = query}) | html %]</h2> + <div class="page-section"> <table id="reservoir-table"> <thead> <tr> @@ -254,11 +255,13 @@ [% END # /IF breeding_loo %] </tbody> </table> - [% ELSE %] - <h3 id="searchresult-breeding">No results found</h3> - [% END # /IF breeding_loop %] - </div> + </div> + <!-- /.page-section --> + [% ELSE %] + <div class="alert alert-info" id="searchresult-breeding"> [% tx("No reservoir search results for '{query}'", {query = query}) | html %] </div> + [% END # /IF breeding_loop %] </div> + <!-- /#searchresult-breeding --> [% END # /IF query %] <div id="dataPreview" class="modal" tabindex="-1" role="dialog" aria-labelledby="dataPreviewLabel" aria-hidden="true"> -- 2.39.5