]> git.evergreen-ils.org Git - working/Evergreen.git/blob - Open-ILS/src/templates/opac/parts/result/adv_filter.tt2
LP#1005040: Styling cleanup for filter display
[working/Evergreen.git] / Open-ILS / src / templates / opac / parts / result / adv_filter.tt2
1 [%-
2
3 pubdate_filters = ['date1', 'before', 'after', 'between'];
4
5 FOR filter IN ctx.query_struct.filters;
6     fname = filter.name;
7     fvalues = filter.args;
8     crad = ctx.get_crad(fname);
9
10     # will be some special ones, like locations
11     IF crad AND NOT pubdate_filters.grep('^' _ filter.name _ '$').size;
12         remove_filter = 'fi:' _ fname;
13 -%]
14     <div class="facet_box_temp filter_box_temp">
15         <div class="header">
16             <a class="button"
17               title="[% l('Remove [_1] filter', (crad.description || crad.label)) %]"
18               href="[% mkurl('', {}, [remove_filter]) %]" rel="nofollow" vocab=""> ✘ </a>
19             <h4 class="title">[% IF filter.negate; l('Not'); END %] [% (crad.description || crad.label) | html %]</h4>
20         </div>
21         <div class="box_wrapper">
22             <div class="box">
23             [% temp = [];
24                FOR fval IN fvalues;
25                 thing = ctx.search_ccvm('ctype',fname,'code',fval).0;
26                 display_value = thing.search_label || thing.value;
27                 IF display_value.defined;
28                  temp.push(display_value);
29                 END;
30                END;
31                FOR display_value IN temp.sort;
32             %]
33                     <div class="facet_template filter_template">
34                         <div class="facet filter">
35                               [% display_value | html%]
36                         </div>
37                     </div>
38             [% END; # FOR %]
39             </div>
40         </div> <!-- box_wrapper -->
41     </div> <!-- facet_box_temp -->
42     [%- END; # IF crad -%]
43
44 [%-  IF filter.name == 'locations'; locs = ctx.search_acpl('id',filter.args) -%]
45     <div class="facet_box_temp filter_box_temp">
46         <div class="header">
47             <a class="button"
48               title="[% l('Remove location filter') %]"
49               href="[% mkurl('', {}, ['fi:locations']) %]" rel="nofollow" vocab=""> ✘ </a>
50             <h4 class="title">[% IF filter.negate; l('Not'); END %] [% l('Locations') %]</h4>
51         </div>
52         <div class="box_wrapper">
53             <div class="box">
54             [% temp = [];
55                FOR loc IN locs;
56                 temp.push(loc.name);
57                END;
58                FOR display_name IN temp.sort; %]
59                 <div class="facet_template filter_template">
60                   <div class="facet filter">
61                     [% display_name | html%]
62                   </div>
63                 </div>
64             [% END; # FOR %]
65             </div>
66         </div> <!-- box_wrapper -->
67     </div> <!-- facet_box_temp -->
68 [%- END; # IF locations -%]
69
70 [%- IF pubdate_filters.grep('^' _ filter.name _ '$').size;
71     date1 = CGI.param('date1');
72     date2 = CGI.param('date2');
73 -%]
74     <div class="facet_box_temp filter_box_temp">
75         <div class="header">
76             <a class="button"
77               title="[% l('Remove publication date filter') %]"
78               href="[% mkurl('', {}, ['pubdate', 'date1', 'date2']) %]" rel="nofollow" vocab=""> ✘ </a>
79             <h4 class="title">[% IF filter.negate; l('Not'); END %] [% l('Publication Year') %]</h4>
80         </div>
81         <div class="box_wrapper">
82             <div class="box">
83               [% IF    filter.name == 'date1'      %][% l('[_1]', date1) %]
84               [% ELSIF filter.name == 'before'  %][% l('Before [_1]', date1) %]
85               [% ELSIF filter.name == 'after'   %][% l('After [_1]', date1) %]
86               [% ELSIF filter.name == 'between' %][% l('Between [_1] and [_2]', date1, date2) %]
87               [% END %]
88             </div>
89         </div> <!-- box_wrapper -->
90     </div> <!-- facet_box_temp -->
91 [%- END; # IF pubdate_filters -%]
92 [%- END; # FOR -%]