1 <div class="facet_box_wrapper">
4 close_facets = CGI.param('close_facet') || [];
5 selected_facets = CGI.param('facet') || [];
7 # sorted list of search facets
12 # facet display configuration present. Traverse the
13 # configuration lists, find the matching facets from
14 # search facet data, and append them to the sorted
17 FOR display_chunk IN facet.display;
18 FOR display_field IN display_chunk.facet_order;
19 # find the matching facet in the facet data
20 FOR facet IN ctx.search_facets.values;
21 IF facet.cmf.field_class == display_chunk.facet_class
22 AND facet.cmf.name == display_field;
23 sorted_facets.push(facet);
31 # No facet display configuration is present.
32 # show all facets, sorted by name.
34 # collect facet type labels for easier sorting
36 FOR facet IN ctx.search_facets.values;
37 labels.push(facet.cmf.label);
40 FOR facet_label IN labels.sort;
41 FOR facet IN ctx.search_facets.values;
42 IF facet.cmf.label == facet_label;
43 sorted_facets.push(facet);
49 FOR facet IN sorted_facets;
50 fclass = facet.cmf.field_class;
51 fname = facet.cmf.name;
52 close_key = fclass _ fname %]
54 <div class="facet_box_temp">
58 [% IF close_facets.grep(close_key).0;
60 FOR fct IN close_facets;
65 expand_url = mkurl('', {close_facet => new_close});
66 IF new_close.size == 0;
67 expand_url = mkurl('', {}, ['close_facet']);
70 <a href="[% expand_url %]"><img
71 src="[% ctx.media_prefix %]/images/adv_search_plus_btn.png" alt="[% l('Expand') %]" /></a>
73 <a href="[% mkurl('', {close_facet => close_facets.merge([close_key])}) %]"><img
74 src="[% ctx.media_prefix %]/images/adv_search_minus_btn.png" alt="[% l('Collapse') %]" /></a>
77 <div class="title">[% facet.cmf.label %]</div>
79 [% IF !close_facets.grep(close_key).0 %]
80 <div class="box_wrapper">
82 [% FOR facet_data IN facet.data;
83 display_value = facet_data.value | html;
84 param_string = fclass _ '|' _ fname _ '[' _ facet_data.value _ ']';
87 FOR selected IN selected_facets;
88 IF selected == param_string;
91 new_facets.push(selected);
95 # This facet is already selected by the user.
96 # Link removes the facet from the set of selected facets.
98 <div class="facet_template facet_template_selected">
100 [% IF new_facets.size == 0 %]
101 <a href="[% mkurl('', {}, ['facet']) %]">[% display_value %]</a>
103 <a href="[% mkurl('', {facet => new_facets}) %]">[% display_value %]</a>
106 <div class="count">([% facet_data.count %])</div>
107 <div class="clear"> </div>
111 # This facet is not currently selected. If selected,
112 # append this facet to the list of currently active facets.
114 <div class="facet_template">
116 <a href='[% mkurl('', {facet => selected_facets.merge([param_string])}, ['page']) %]'>[% display_value %]</a>
118 <div class="count">([% facet_data.count %])</div>
119 <div class="clear"> </div>
124 </div> <!-- box_wrapper -->
126 </div> <!-- facet_box_temp -->
128 </div> <!-- facet_box_wrapper -->