Add custom widget for "percent" field
so that storage can use "traditional" (0.3612) format but UI can use "human-friendly" format (36.12 %)
This commit is contained in:
parent
7bf509097f
commit
d659e62fda
2 changed files with 57 additions and 2 deletions
25
tailbone/templates/deform/percentinput.pt
Normal file
25
tailbone/templates/deform/percentinput.pt
Normal file
|
@ -0,0 +1,25 @@
|
|||
<span tal:define="name name|field.name;
|
||||
css_class css_class|field.widget.css_class;
|
||||
oid oid|field.oid;
|
||||
mask mask|field.widget.mask;
|
||||
mask_placeholder mask_placeholder|field.widget.mask_placeholder;
|
||||
style style|field.widget.style;
|
||||
autocomplete autocomplete|field.widget.autocomplete|'off';
|
||||
"
|
||||
tal:omit-tag="">
|
||||
<input type="text" name="${name}" value="${cstruct}"
|
||||
tal:attributes="class string: form-control ${css_class or ''};
|
||||
style style;
|
||||
autocomplete autocomplete;
|
||||
"
|
||||
id="${oid}"/>
|
||||
%
|
||||
<script tal:condition="mask" type="text/javascript">
|
||||
deform.addCallback(
|
||||
'${oid}',
|
||||
function (oid) {
|
||||
$("#" + oid).mask("${mask}",
|
||||
{placeholder:"${mask_placeholder}"});
|
||||
});
|
||||
</script>
|
||||
</span>
|
Loading…
Add table
Add a link
Reference in a new issue