From a654faf72e602463fec6ebeda2a4da8ed4938bfc Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Mon, 6 May 2024 11:55:28 +0200 Subject: [PATCH] Bug 36750: Fix aria-label for show more/less links Didn't manage to keep the more_less_labels because of the space in the key names Signed-off-by: Nick Clemens Signed-off-by: Katrin Fischer --- .../bootstrap/en/includes/opac-facets.inc | 74 ++++++++++++++----- t/db_dependent/Search.t | 10 +-- 2 files changed, 59 insertions(+), 25 deletions(-) diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/includes/opac-facets.inc b/koha-tmpl/opac-tmpl/bootstrap/en/includes/opac-facets.inc index c3c89b6fa2..06909fbfc4 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/includes/opac-facets.inc +++ b/koha-tmpl/opac-tmpl/bootstrap/en/includes/opac-facets.inc @@ -39,18 +39,6 @@ [% IF ( related ) %]
  • (related searches: [% FOREACH relate IN related %][% relate.related_search | html %][% END %])
  • [% END %] - [% SET more_less_labels = {} %] - [% more_less_labels.Authors = { more = t("Show more authors"), less = t("Show fewer authors") } %] - [% more_less_labels.Titles = { more = t("Show more titles"), less = t("Show fewer titles") } %] - [% more_less_labels.Topics = { more = t("Show more topics"), less = t("Show fewer topics") } %] - [% more_less_labels.Places = { more = t("Show more places"), less = t("Show fewer places") } %] - [% more_less_labels.Series = { more = t("Show more series"), less = t("Show fewer series") } %] - [% more_less_labels.ItemTypes = { more = t("Show more item types"), less = t("Show fewer item types") } %] - [% more_less_labels.CollectionCodes = { more = t("Show more collections"), less = t("Show fewer collections") } %] - [% more_less_labels.Language = { more = t("Show more languages"), less = t("Show fewer languages") } %] - [% more_less_labels.HomeLibrary = { more = t("Show more home libraries"), less = t("Show fewer home libraries") } %] - [% more_less_labels.HoldingLibrary = { more = t("Show more holding libraries"), less = t("Show fewer holding libraries") } %] - [% more_less_labels.Location = { more = t("Show more locations"), less = t("Show fewer locations") } %] [% FOREACH facets_loo IN facets_loop %] [% IF facets_loo.facets.size > 0 %]
  • @@ -114,17 +102,63 @@ [% END %] [% IF facets_loo.facets.size > 5 %]
  • - [% FOR label IN more_less_labels.keys %] - [% IF facets_loo.item('type_label_' _ label) %] - Show more - [% END %] + [% SET aria_label = t("Show more") %] + [% SWITCH facets_loo.label %] + [% CASE 'Authors' %] + [% aria_label = t("Show more authors") %] + [% CASE 'Titles' %] + [% aria_label = t("Show more titles") %] + [% CASE 'Topics' %] + [% aria_label = t("Show more topics") %] + [% CASE 'Places' %] + [% aria_label = t("Show more places") %] + [% CASE 'Series' %] + [% aria_label = t("Show more series") %] + [% CASE 'ItemTypes' %] + [% aria_label = t("Show more item types") %] + [% CASE 'Home libraries' %] + [% aria_label = t("Show more home libraries") %] + [% CASE 'Holding libraries' %] + [% aria_label = t("Show more holding libraries") %] + [% CASE 'Location' %] + [% aria_label = t("Show more home locations") %] + [% CASE 'Collections' %] + [% aria_label = t("Show more home collections") %] + [% CASE 'Languages' %] + [% aria_label = t("Show more home languages") %] [% END %] + + Show more
  • [% END %] diff --git a/t/db_dependent/Search.t b/t/db_dependent/Search.t index b3e1c77de6..4939b846fe 100755 --- a/t/db_dependent/Search.t +++ b/t/db_dependent/Search.t @@ -825,9 +825,9 @@ ok(MARC::Record::new_from_xml($results_hashref->{biblioserver}->{RECORDS}->[0],' my $facets_info = C4::Search::_get_facets_info( $facets ); my $expected_facets_info_marc21 = { 'au' => { 'label_value' => "Authors" }, - 'ccode' => { 'label_value' => "CollectionCodes" }, - 'holdingbranch' => { 'label_value' => "HoldingLibrary" }, - 'itype' => { 'label_value' => "ItemTypes" }, + 'ccode' => { 'label_value' => "Collections" }, + 'holdingbranch' => { 'label_value' => "Holding libraries" }, + 'itype' => { 'label_value' => "Item types" }, 'location' => { 'label_value' => "Location" }, 'se' => { 'label_value' => "Series" }, 'su-geo' => { 'label_value' => "Places" }, @@ -925,8 +925,8 @@ sub run_unimarc_search_tests { my $facets_info = C4::Search::_get_facets_info( $facets ); my $expected_facets_info_unimarc = { 'au' => { 'label_value' => "Authors" }, - 'ccode' => { 'label_value' => "CollectionCodes" }, - 'holdingbranch' => { 'label_value' => "HoldingLibrary" }, + 'ccode' => { 'label_value' => "Collections" }, + 'holdingbranch' => { 'label_value' => "Holding libraries" }, 'location' => { 'label_value' => "Location" }, 'se' => { 'label_value' => "Series" }, 'su-geo' => { 'label_value' => "Places" }, -- 2.39.2