Show More
@@ -1,55 +1,55 b'' | |||||
1 | <div tal:define=" |
|
1 | <div tal:define=" | |
2 | name name|field.name; |
|
2 | name name|field.name; | |
3 | style field.widget.style; |
|
3 | style field.widget.style; | |
4 | oid oid|field.oid; |
|
4 | oid oid|field.oid; | |
5 | css_class css_class|field.widget.css_class; |
|
5 | css_class css_class|field.widget.css_class; | |
6 | optgroup_class optgroup_class|field.widget.optgroup_class; |
|
6 | optgroup_class optgroup_class|field.widget.optgroup_class; | |
7 | multiple multiple|field.widget.multiple;" |
|
7 | multiple multiple|field.widget.multiple;" | |
8 | tal:omit-tag=""> |
|
8 | tal:omit-tag=""> | |
9 | <input type="hidden" name="__start__" value="${name}:sequence" |
|
9 | <input type="hidden" name="__start__" value="${name}:sequence" | |
10 | tal:condition="multiple" /> |
|
10 | tal:condition="multiple" /> | |
11 |
|
11 | |||
12 | <select tal:attributes=" |
|
12 | <select tal:attributes=" | |
13 | name name; |
|
13 | name name; | |
14 | id oid; |
|
14 | id oid; | |
15 | class string: form-control ${css_class or ''}; |
|
15 | class string: form-control ${css_class or ''}; | |
16 | data-placeholder field.widget.placeholder|None; |
|
16 | data-placeholder field.widget.placeholder|None; | |
17 | multiple multiple; |
|
17 | multiple multiple; | |
18 | style style;"> |
|
18 | style style;"> | |
19 | <tal:loop tal:repeat="item values"> |
|
19 | <tal:loop tal:repeat="item values"> | |
20 | <optgroup tal:condition="isinstance(item, optgroup_class)" |
|
20 | <optgroup tal:condition="isinstance(item, optgroup_class)" | |
21 | tal:attributes="label item.label"> |
|
21 | tal:attributes="label item.label"> | |
22 | <option tal:repeat="(value, description) item.options" |
|
22 | <option tal:repeat="(value, description) item.options" | |
23 | tal:attributes=" |
|
23 | tal:attributes=" | |
24 | selected (multiple and value in list(map(unicode, cstruct)) or value == list(map(unicode, cstruct))) and 'selected'; |
|
24 | selected python:field.widget.get_select_value(cstruct, value); | |
25 | class css_class; |
|
25 | class css_class; | |
26 | label field.widget.long_label_generator and description; |
|
26 | label field.widget.long_label_generator and description; | |
27 | value value" |
|
27 | value value" | |
28 | tal:content="field.widget.long_label_generator and field.widget.long_label_generator(item.label, description) or description"/> |
|
28 | tal:content="field.widget.long_label_generator and field.widget.long_label_generator(item.label, description) or description"/> | |
29 | </optgroup> |
|
29 | </optgroup> | |
30 | <option tal:condition="not isinstance(item, optgroup_class)" |
|
30 | <option tal:condition="not isinstance(item, optgroup_class)" | |
31 | tal:attributes=" |
|
31 | tal:attributes=" | |
32 | selected (multiple and item[0] in list(map(unicode, cstruct)) or item[0] == unicode(cstruct)) and 'selected'; |
|
32 | selected python:field.widget.get_select_value(cstruct, item[0]); | |
33 | class css_class; |
|
33 | class css_class; | |
34 | value item[0]">${item[1]}</option> |
|
34 | value item[0]">${item[1]}</option> | |
35 | </tal:loop> |
|
35 | </tal:loop> | |
36 | </select> |
|
36 | </select> | |
37 |
|
37 | |||
38 | <script type="text/javascript"> |
|
38 | <script type="text/javascript"> | |
39 | deform.addCallback( |
|
39 | deform.addCallback( | |
40 |
'${ |
|
40 | '${oid}', | |
41 | function(oid) { |
|
41 | function(oid) { | |
42 | $('#' + oid).select2({ |
|
42 | $('#' + oid).select2({ | |
43 | containerCssClass: 'form-control drop-menu', |
|
43 | containerCssClass: 'form-control drop-menu', | |
44 | dropdownCssClass: 'drop-menu-dropdown', |
|
44 | dropdownCssClass: 'drop-menu-dropdown', | |
45 | dropdownAutoWidth: true, |
|
45 | dropdownAutoWidth: true, | |
46 | placeholder: "${str(field.widget.placeholder).replace('"','\\"')|""}", |
|
46 | placeholder: "${str(field.widget.placeholder).replace('"','\\"')|""}", | |
47 | allowClear: true |
|
47 | allowClear: true | |
48 | }); |
|
48 | }); | |
49 | } |
|
49 | } | |
50 | ); |
|
50 | ); | |
51 | </script> |
|
51 | </script> | |
52 |
|
52 | |||
53 | <input type="hidden" name="__end__" value="${name}:sequence" |
|
53 | <input type="hidden" name="__end__" value="${name}:sequence" | |
54 | tal:condition="multiple" /> |
|
54 | tal:condition="multiple" /> | |
55 | </div> No newline at end of file |
|
55 | </div> |
General Comments 0
You need to be logged in to leave comments.
Login now