2 # If caller passes a list of possible filter_groups
3 # search all until we find some values
4 IF !filter_group.size; filter_group = [filter_group]; END;
6 FOR code IN filter_group;
7 group = ctx.search_filter_groups.$code;
8 LAST IF group AND group.entries.size;
10 name = name || "fg:" _ group.code;
11 id = id || group.code _ "_selector";
13 values = values || CGI.param(name);
16 <select id='[% id %]' class='[% class %]' name='[% name %]'[%
17 multiple ? ' multiple="multiple"' : '';
18 size ? (' size="' _ size _ '"') : ''; %]>
20 <option value=''>[% none_label ? none_label : l('-- Any --') %]</option>
22 # turn the list of objects into a list of hashes to
23 # leverage TT's array.sort('<hashkey>') behavior
25 FOR o IN group.entries;
26 sorter.push({id => o.id, label => o.query.label, pos => o.pos});
28 FOR o IN sorter.sort('pos') %]
29 <option value='[% o.id %]'[% values.grep(o.id).size ? ' selected="selected"' : '' %]>[% o.label | html %]</option>