Commit 9b0c2be8 authored by Romain Courteaud's avatar Romain Courteaud

[erp5_web_renderjs_ui] Form: no need to create gadget DOM element manually

parent 51a27b9b
...@@ -45,12 +45,9 @@ ...@@ -45,12 +45,9 @@
suboptions.field_json.editable = 0; suboptions.field_json.editable = 0;
} }
field_element = document.createElement("div");
if (modification_dict.hasOwnProperty('hash')) { if (modification_dict.hasOwnProperty('hash')) {
queue = form_gadget.declareGadget('gadget_erp5_label_field.html', { queue = form_gadget.declareGadget('gadget_erp5_label_field.html', {
scope: rendered_document[field_name].key, // ugly! Should be just `field_name` but too many tests depend on it scope: rendered_document[field_name].key, // ugly! Should be just `field_name` but too many tests depend on it
element: field_element,
sandbox: "public" sandbox: "public"
}); });
} else { } else {
...@@ -70,6 +67,13 @@ ...@@ -70,6 +67,13 @@
// gadget_list hold references to all created gadgets // gadget_list hold references to all created gadgets
form_gadget.props.gadget_list.push(label_gadget); form_gadget.props.gadget_list.push(label_gadget);
} }
if (modification_dict.hasOwnProperty('hash')) {
field_element = label_gadget.element;
} else {
// XXX Investigate why removing this break everything
// There is not reason to always create a DOM element
field_element = document.createElement("div");
}
return label_gadget.render(suboptions); return label_gadget.render(suboptions);
}) })
.push(function () { .push(function () {
......
...@@ -230,7 +230,7 @@ ...@@ -230,7 +230,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>970.11330.19298.59511</string> </value> <value> <string>971.50821.45797.19694</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -248,7 +248,7 @@ ...@@ -248,7 +248,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1537454067.98</float> <float>1542818616.03</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
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