Commit 801ff6ab authored by Romain Courteaud's avatar Romain Courteaud

erp5_web_renderjs_ui: fix FloatField percent rendering

Mimic xhtml style.
parent 412c5411
...@@ -118,6 +118,7 @@ ...@@ -118,6 +118,7 @@
<list> <list>
<string>my_quantity</string> <string>my_quantity</string>
<string>my_quantity_read_only</string> <string>my_quantity_read_only</string>
<string>my_quantity_read_only_percent</string>
<string>my_frozen</string> <string>my_frozen</string>
<string>my_lines_list</string> <string>my_lines_list</string>
</list> </list>
......
...@@ -49,16 +49,16 @@ ...@@ -49,16 +49,16 @@
}, },
tmp; tmp;
if (!window.isNaN(state_dict.precision)) {
state_dict.step = Math.pow(10, -state_dict.precision);
state_dict.value = state_dict.value.toFixed(state_dict.precision);
}
if (percentage) { if (percentage) {
// ERP5 always devides the value by 100 if it is set to percentages // ERP5 always devides the value by 100 if it is set to percentages
// thus we have to mitigate that in javascript here // thus we have to mitigate that in javascript here
state_dict.value *= 100.0; state_dict.value *= 100.0;
state_dict.append = "%"; state_dict.append = "%";
} }
if (!window.isNaN(state_dict.precision)) {
state_dict.step = Math.pow(10, -state_dict.precision);
state_dict.value = state_dict.value.toFixed(state_dict.precision);
}
if (!window.isNaN(state_dict.value)) { if (!window.isNaN(state_dict.value)) {
state_dict.text_content = state_dict.value.toString(); state_dict.text_content = state_dict.value.toString();
if (state_dict.text_content !== "" && thousand_sep !== "") { if (state_dict.text_content !== "" && thousand_sep !== "") {
......
...@@ -148,11 +148,13 @@ ...@@ -148,11 +148,13 @@
</record> </record>
<record id="3" aka="AAAAAAAAAAM="> <record id="3" aka="AAAAAAAAAAM=">
<pickle> <pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.patches.WorkflowTool"/> <global name="WorkflowHistoryList" module="Products.ERP5Type.Workflow"/>
</pickle> </pickle>
<pickle> <pickle>
<tuple> <dictionary>
<none/> <item>
<key> <string>_log</string> </key>
<value>
<list> <list>
<dictionary> <dictionary>
<item> <item>
...@@ -196,16 +198,20 @@ ...@@ -196,16 +198,20 @@
</item> </item>
</dictionary> </dictionary>
</list> </list>
</tuple> </value>
</item>
</dictionary>
</pickle> </pickle>
</record> </record>
<record id="4" aka="AAAAAAAAAAQ="> <record id="4" aka="AAAAAAAAAAQ=">
<pickle> <pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.patches.WorkflowTool"/> <global name="WorkflowHistoryList" module="Products.ERP5Type.Workflow"/>
</pickle> </pickle>
<pickle> <pickle>
<tuple> <dictionary>
<none/> <item>
<key> <string>_log</string> </key>
<value>
<list> <list>
<dictionary> <dictionary>
<item> <item>
...@@ -228,7 +234,7 @@ ...@@ -228,7 +234,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>965.12118.35525.1655</string> </value> <value> <string>982.42549.32458.46916</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -246,7 +252,7 @@ ...@@ -246,7 +252,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1517930362.54</float> <float>1584702324.85</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
...@@ -255,16 +261,20 @@ ...@@ -255,16 +261,20 @@
</item> </item>
</dictionary> </dictionary>
</list> </list>
</tuple> </value>
</item>
</dictionary>
</pickle> </pickle>
</record> </record>
<record id="5" aka="AAAAAAAAAAU="> <record id="5" aka="AAAAAAAAAAU=">
<pickle> <pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.patches.WorkflowTool"/> <global name="WorkflowHistoryList" module="Products.ERP5Type.Workflow"/>
</pickle> </pickle>
<pickle> <pickle>
<tuple> <dictionary>
<none/> <item>
<key> <string>_log</string> </key>
<value>
<list> <list>
<dictionary> <dictionary>
<item> <item>
...@@ -312,7 +322,9 @@ ...@@ -312,7 +322,9 @@
</item> </item>
</dictionary> </dictionary>
</list> </list>
</tuple> </value>
</item>
</dictionary>
</pickle> </pickle>
</record> </record>
</ZopeData> </ZopeData>
...@@ -45,10 +45,10 @@ ...@@ -45,10 +45,10 @@
data_attr; data_attr;
if (!isEmpty(this.state.text_content)) { if (!isEmpty(this.state.text_content)) {
if (this.state.prepend) { if (this.state.prepend) {
content = this.state.prepend + "&nbsp;" + content; content = this.state.prepend + content;
} }
if (this.state.append) { if (this.state.append) {
content = content + "&nbsp;" + this.state.append; content = content + this.state.append;
} }
new_element.textContent = content; new_element.textContent = content;
} else if (!isEmpty(this.state.inner_html)) { } else if (!isEmpty(this.state.inner_html)) {
......
...@@ -142,11 +142,13 @@ ...@@ -142,11 +142,13 @@
</record> </record>
<record id="3" aka="AAAAAAAAAAM="> <record id="3" aka="AAAAAAAAAAM=">
<pickle> <pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.patches.WorkflowTool"/> <global name="WorkflowHistoryList" module="Products.ERP5Type.Workflow"/>
</pickle> </pickle>
<pickle> <pickle>
<tuple> <dictionary>
<none/> <item>
<key> <string>_log</string> </key>
<value>
<list> <list>
<dictionary> <dictionary>
<item> <item>
...@@ -190,16 +192,20 @@ ...@@ -190,16 +192,20 @@
</item> </item>
</dictionary> </dictionary>
</list> </list>
</tuple> </value>
</item>
</dictionary>
</pickle> </pickle>
</record> </record>
<record id="4" aka="AAAAAAAAAAQ="> <record id="4" aka="AAAAAAAAAAQ=">
<pickle> <pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.patches.WorkflowTool"/> <global name="WorkflowHistoryList" module="Products.ERP5Type.Workflow"/>
</pickle> </pickle>
<pickle> <pickle>
<tuple> <dictionary>
<none/> <item>
<key> <string>_log</string> </key>
<value>
<list> <list>
<dictionary> <dictionary>
<item> <item>
...@@ -222,7 +228,7 @@ ...@@ -222,7 +228,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>967.44748.35225.6109</string> </value> <value> <string>982.42532.14902.56951</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -240,7 +246,7 @@ ...@@ -240,7 +246,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1536228266.13</float> <float>1584701796.37</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
...@@ -249,7 +255,9 @@ ...@@ -249,7 +255,9 @@
</item> </item>
</dictionary> </dictionary>
</list> </list>
</tuple> </value>
</item>
</dictionary>
</pickle> </pickle>
</record> </record>
</ZopeData> </ZopeData>
...@@ -43,6 +43,9 @@ ...@@ -43,6 +43,9 @@
<tr><td>verifyText</td> <tr><td>verifyText</td>
<td>//div[@data-gadget-scope="field_my_quantity_read_only"]//p</td> <td>//div[@data-gadget-scope="field_my_quantity_read_only"]//p</td>
<td>1 000 000.0</td></tr> <td>1 000 000.0</td></tr>
<tr><td>verifyText</td>
<td>//div[@data-gadget-scope="field_my_quantity_read_only_percent"]//p</td>
<td>100000000.0%</td></tr>
<!-- default quantity has to be 0 <!-- default quantity has to be 0
This is regression test for bug #20171208-5E8D43 This is regression test for bug #20171208-5E8D43
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment