blob: 10c2163f1bc91684e2da2a047bbedd43e970bed1 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
|
<%doc>
Render a Selectize.js multiple-select to choose from
package classes
Selectize js and css must be included in the page header.
Use the include_selectize option on header.html
Parameters:
* id - id of the <select> element
* name - name of the <select> element
* onchange - name of a javascript function
* placeholder - Text displayed when no options are selected
</%doc>
<label for="<% $opt{id} %>" class="selectize-label">Package Classes</label>
<select id="<% $opt{id} %>" multiple placeholder="<% $opt{placeholder} %>">
<option value="">(none)</option>
% for my $pkg_class ( @pkg_class ) {
<option value="<% $pkg_class->classnum %>"><% $pkg_class->classname %></option>
% }
</select>
<script>
$('#<% $opt{id} %>').selectize({
plugins: ['remove_button'],
sortField: 'text',
create: false,
highlight: true,
allowEmptyOption: true,
<% $opt{onchange} ? "onChange: $opt{onchange}," : '' %>
});
</script>
<%init>
my %opt = (
id => 'selectize-pkg_class',
name => 'selectize_pkg_class',
placeholder => 'Filter Package Classes',
@_
);
my @pkg_class = qsearch( pkg_class => { disabled => '' } );
</%init>
|