Bug 36750: Fix aria-label for show more/less links
[koha.git] / koha-tmpl / opac-tmpl / bootstrap / en / includes / opac-facets.inc
1 [% USE raw %]
2 [% USE AuthorisedValues %]
3 [% USE Languages %]
4 [% PROCESS 'i18n.inc' %]
5 [% USE AdditionalContents %]
6 [% SET OPACResultsSidebar = AdditionalContents.get( location => "OPACResultsSidebar", lang => lang, library => logged_in_user.branchcode || default_branch ) %]
7 [% IF ( opacfacets && facets_loop && total ) %]
8     <div id="search-facets">
9         <h2><a href="#" class="menu-collapse-toggle">Refine your search</a></h2>
10         <ul class="menu-collapse">
11             [% IF Koha.Preference("SavedSearchFilters") && search_filters.size > 0 %]
12             <li id="search-filters">
13             <h3 id="filter_facets">Custom search filters</h3>
14             <ul>
15                 [% SET base_url = "/cgi-bin/koha/opac-search.pl?" _ query_cgi _ limit_cgi %]
16                 [% FOREACH search_filter IN search_filters %]
17                     [% SET search_filter_id = search_filter.id | uri %]
18                 <li>
19                     [% IF active_filters.${search_filter.id} %]
20                         <span class="filter_label">[% search_filter.name | html %]<a href="[% base_url _ '&nolimit=search_filter:' _ search_filter_id | $raw %]">[x]</a></span>
21                     [% ELSE %]
22                         <span class="filter_label"><a href="[% base_url _ '&limit=search_filter:' _ search_filter_id | $raw %]">[% search_filter.name | html %]</a></span>
23                     [% END %]
24                 </li>
25                 [% END %]
26             </ul>
27             </li>
28             [% END %]
29             <li id="availability_facet"><h3 id="facet-availability">Availability</h3>
30                 <ul>
31                     <li>
32                         [% IF ( available ) %]
33                             <strong>Showing only records with available items</strong></li><li><a href="/cgi-bin/koha/opac-search.pl?[% query_cgi | $raw %][% limit_cgi_not_availablity | $raw %][% IF ( sort_by ) %]&amp;sort_by=[% sort_by |uri %][% END %]">Show all records</a>
34                         [% ELSE %]
35                             <a href="/cgi-bin/koha/opac-search.pl?[% query_cgi | $raw %][% limit_cgi | $raw %][% IF ( sort_by ) %]&amp;sort_by=[% sort_by |uri %][% END %]&amp;limit=available">Limit to records with available items</a>
36                         [% END %]
37                     </li>
38                 </ul>
39                 [% IF ( related ) %] <li>(related searches: [% FOREACH relate IN related %][% relate.related_search | html %][% END %])</li>[% END %]
40             </li>
41
42             [% FOREACH facets_loo IN facets_loop %]
43                 [% IF facets_loo.facets.size > 0 %]
44                     <li id="[% facets_loo.type_id | html %]">
45                             [% SWITCH facets_loo.label %]
46                             [% CASE 'Authors' %]
47                                 <h3 id="facet-authors">Authors</h3>
48                             [% CASE 'Titles' %]
49                                 <h3 id="facet-titles">Titles</h3>
50                             [% CASE 'Topics' %]
51                                 <h3 id="facet-topics">Topics</h3>
52                             [% CASE 'Places' %]
53                                 <h3 id="facet-places">Places</h3>
54                             [% CASE 'Series' %]
55                                 <h3 id="facet-series">Series</h3>
56                             [% CASE 'ItemTypes' %]
57                                 <h3 id="facet-itemtypes">Item types</h3>
58                             [% CASE 'Home libraries' %]
59                                 <h3 id="facet-home-libraries">Home libraries</h3>
60                             [% CASE 'Holding libraries' %]
61                                 <h3 id="facet-holding-libraries">Holding libraries</h3>
62                             [% CASE 'Location' %]
63                                 <h3 id="facet-locations">Locations</h3>
64                             [% CASE 'Collections' %]
65                                 <h3 id="facet-collections">Collections</h3>
66                             [% CASE 'Languages' %]
67                                 <h3 id="facet-languages">Languages</h3>
68                             [% CASE %]
69                                 <h3 id="facet-[% facets_loo.type_link_value | html %]">[% facets_loo.label | html %]</h3>
70                             [% END %]
71                         <ul>
72                             [% SET url = "/cgi-bin/koha/opac-search.pl?" _ query_cgi _ limit_cgi %]
73                             [% IF ( sort_by ) %]
74                               [% url = BLOCK %][% url | $raw %][% "&amp;sort_by=" _ sort_by | url %][% END %]
75                             [% END %]
76                             [% IF ( results_per_page ) %]
77                               [% url = BLOCK %][% url | $raw %][% "&amp;count=" _ results_per_page | url %][% END %]
78                             [% END %]
79                             [% FOREACH facet IN facets_loo.facets %]
80                             [% IF facets_loo.label == 'Collections' %][% SET facet.facet_label_value = AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.ccode', authorised_value => facet.facet_label_value, opac =>1 ) || facet.facet_label_value %][% END %]
81                             [% IF facets_loo.label == 'Language' %][% SET facet.facet_label_value = Languages.GetByISOCode(lang,facet.facet_label_value) || facet.facet_label_value %][% END %]
82                             [% IF loop.count > 5 && !facet.active %]
83                                 <li class="collapsible-facet" style="display:none">
84                             [% ELSE %]
85                                 <li>
86                             [% END %]
87                                   [% IF facet.active %]
88                                     [% local_url = BLOCK %][% url | $raw %][% "&nolimit=" _  facet.type_link_value _ ":" _ facet.facet_link_value | url %][% END %]
89                                     <span class="facet-label">[% facet.facet_label_value | html %]</span>
90                                     [% IF ( displayFacetCount ) %]
91                                       <span class="facet-count-selected">([% facet.facet_count | html %])</span>
92                                     [% END %]
93                                     [<a href="[% local_url | $raw %]" title="Remove facet [% facet.facet_label_value | html %]">x</a>]
94                                   [% ELSE %]
95                                     [% local_url = BLOCK %][% url | $raw %][% "&limit=" _  facet.type_link_value _ ":" _ facet.facet_link_value | url %][% END %]
96                                     <span class="facet-label"><a href="[% local_url | $raw %]" title="[% facet.facet_title_value | html %]">[% facet.facet_label_value | html %]</a></span>
97                                     [% IF ( displayFacetCount ) %]
98                                       <span class="facet-count"> ([% facet.facet_count | html %])</span>
99                                     [% END %]
100                                   [% END %]
101                                 </li>
102                             [% END %]
103                             [% IF facets_loo.facets.size > 5 %]
104                                 <li class="moretoggle">
105                                     [% SET aria_label = t("Show more") %]
106                                     [% SWITCH facets_loo.label %]
107                                     [% CASE 'Authors' %]
108                                         [% aria_label = t("Show more authors") %]
109                                     [% CASE 'Titles' %]
110                                         [% aria_label = t("Show more titles") %]
111                                     [% CASE 'Topics' %]
112                                         [% aria_label = t("Show more topics") %]
113                                     [% CASE 'Places' %]
114                                         [% aria_label = t("Show more places") %]
115                                     [% CASE 'Series' %]
116                                         [% aria_label = t("Show more series") %]
117                                     [% CASE 'ItemTypes' %]
118                                         [% aria_label = t("Show more item types") %]
119                                     [% CASE 'Home libraries' %]
120                                         [% aria_label = t("Show more home libraries") %]
121                                     [% CASE 'Holding libraries' %]
122                                         [% aria_label = t("Show more holding libraries") %]
123                                     [% CASE 'Location' %]
124                                         [% aria_label = t("Show more home locations") %]
125                                     [% CASE 'Collections' %]
126                                         [% aria_label = t("Show more home collections") %]
127                                     [% CASE 'Languages' %]
128                                         [% aria_label = t("Show more home languages") %]
129                                     [% END %]
130
131                                     <a href="#" aria-label="[% aria_label | html | trim %]"><strong>Show more</strong></a>
132                                 </li>
133                                 <li class="moretoggle" style="display:none">
134                                     [% SET aria_label = t("Show more") %]
135                                     [% SWITCH facets_loo.label %]
136                                     [% CASE 'Authors' %]
137                                         [% aria_label = t("Show fewer authors") %]
138                                     [% CASE 'Titles' %]
139                                         [% aria_label = t("Show fewer titles") %]
140                                     [% CASE 'Topics' %]
141                                         [% aria_label = t("Show fewer topics") %]
142                                     [% CASE 'Places' %]
143                                         [% aria_label = t("Show fewer places") %]
144                                     [% CASE 'Series' %]
145                                         [% aria_label = t("Show fewer series") %]
146                                     [% CASE 'ItemTypes' %]
147                                         [% aria_label = t("Show fewer item types") %]
148                                     [% CASE 'Home libraries' %]
149                                         [% aria_label = t("Show fewer home libraries") %]
150                                     [% CASE 'Holding libraries' %]
151                                         [% aria_label = t("Show fewer holding libraries") %]
152                                     [% CASE 'Location' %]
153                                         [% aria_label = t("Show fewer home locations") %]
154                                     [% CASE 'Collections' %]
155                                         [% aria_label = t("Show fewer home collections") %]
156                                     [% CASE 'Languages' %]
157                                         [% aria_label = t("Show fewer home languages") %]
158                                     [% END %]
159
160                                     [% IF aria_label %]
161                                         <a href="#" aria-label="[% aria_label | html | trim %]"><strong>Show less</strong></a>
162                                     [% END %]
163                                 </li>
164                             [% END %]
165                         </ul>
166                     </li>
167                 [% END # / IF facets_loo.facets.size > 0 %]
168             [% END # / FOREACH facets_loo  %]
169         </ul>
170     </div>  <!-- / #search-facets -->
171
172     [% IF ( OPACResultsSidebar ) %]
173         <div id="opacresultssidebar">
174             [% PROCESS koha_news_block news => OPACResultsSidebar %]
175         </div>
176     [% END %]
177 [% END # / IF opacfacets && facets_loop %]