Add basic Buefy support for default SelectWidget template
This commit is contained in:
parent
d3471c945b
commit
ef7b2ddbdd
|
@ -6,9 +6,11 @@
|
||||||
css_class css_class|field.widget.css_class;
|
css_class css_class|field.widget.css_class;
|
||||||
unicode unicode|str;
|
unicode unicode|str;
|
||||||
optgroup_class optgroup_class|field.widget.optgroup_class;
|
optgroup_class optgroup_class|field.widget.optgroup_class;
|
||||||
multiple multiple|field.widget.multiple;"
|
multiple multiple|field.widget.multiple;
|
||||||
|
use_buefy use_buefy|0;"
|
||||||
tal:omit-tag="">
|
tal:omit-tag="">
|
||||||
|
|
||||||
|
<div tal:condition="not use_buefy" tal:omit-tag="">
|
||||||
<input type="hidden" name="__start__" value="${name}:sequence"
|
<input type="hidden" name="__start__" value="${name}:sequence"
|
||||||
tal:condition="multiple" />
|
tal:condition="multiple" />
|
||||||
<div class="select">
|
<div class="select">
|
||||||
|
@ -51,4 +53,36 @@
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
</script>
|
</script>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div tal:condition="use_buefy" tal:omit-tag="">
|
||||||
|
<b-select tal:attributes="name name;
|
||||||
|
id oid;
|
||||||
|
placeholder '(please choose)';
|
||||||
|
class string: form-control ${css_class or ''};
|
||||||
|
multiple multiple;
|
||||||
|
size size;
|
||||||
|
style style;">
|
||||||
|
|
||||||
|
<tal:loop tal:repeat="item values">
|
||||||
|
<optgroup tal:condition="isinstance(item, optgroup_class)"
|
||||||
|
tal:attributes="label item.label">
|
||||||
|
<option tal:repeat="(value, description) item.options"
|
||||||
|
tal:attributes="
|
||||||
|
selected python:field.widget.get_select_value(cstruct, value);
|
||||||
|
class css_class;
|
||||||
|
label field.widget.long_label_generator and description;
|
||||||
|
value value"
|
||||||
|
tal:content="field.widget.long_label_generator and field.widget.long_label_generator(item.label, description) or description"/>
|
||||||
|
</optgroup>
|
||||||
|
<option tal:condition="not isinstance(item, optgroup_class)"
|
||||||
|
tal:attributes="
|
||||||
|
selected python:field.widget.get_select_value(cstruct, item[0]);
|
||||||
|
class css_class;
|
||||||
|
value item[0]">${item[1]}</option>
|
||||||
|
</tal:loop>
|
||||||
|
|
||||||
|
</b-select>
|
||||||
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Reference in a new issue