Commit fa704347 authored by Tomáš Peterka's avatar Tomáš Peterka Committed by Tomáš Peterka

[renderjs_ui] Lock Formbox using mutex

parent 1fecf1e3
......@@ -13,5 +13,6 @@
</head>
<body>
<div data-gadget-url='gadget_erp5_page_form.html' data-gadget-scope='sub'></div>
</body>
</html>
\ No newline at end of file
......@@ -220,7 +220,7 @@
</item>
<item>
<key> <string>actor</string> </key>
<value> <string>zope</string> </value>
<value> <string>superkato</string> </value>
</item>
<item>
<key> <string>comment</string> </key>
......@@ -234,7 +234,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>961.29269.53660.61405</string> </value>
<value> <string>961.56527.16709.20804</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -252,7 +252,7 @@
</tuple>
<state>
<tuple>
<float>1502977305.6</float>
<float>1526316799.74</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -24,8 +24,8 @@
gadget = this,
field_json = options.field_json || {},
new_state = {
value: field_json.value || field_json.default || "",
text_content: field_json.value || field_json.default || "",
value: field_json.value || field_json['default'] || "",
text_content: field_json.value || field_json['default'] || "",
editable: field_json.editable,
required: field_json.required,
name: field_json.key,
......@@ -41,21 +41,6 @@
new_state.editable = options.editable;
}
if (gadget.state.subgadget_template === undefined || options.reset === true) {
// render subgadget only when there is none OR render is explicitely requested
return gadget.declareGadget('gadget_erp5_page_form.html', {scope: 'sub'})
.push(function (form_gadget) {
// Clear first to DOM, append after to reduce flickering/manip
while (element.firstChild) {
element.removeChild(element.firstChild);
}
element.appendChild(form_gadget.element);
// Add newly created subgadget to the state
new_state.subgadget_template = 'gadget_erp5_page_form.html';
return gadget.changeState(new_state);
});
}
return gadget.changeState(new_state);
})
......@@ -78,7 +63,7 @@
return gadget.getDeclaredGadget('sub')
.push(function (subgadget) {
subgadget.render(form_options);
return subgadget.render(form_options);
});
})
......@@ -90,7 +75,7 @@
});
}
return {};
})
}, {mutex: 'changestate'})
.declareMethod('checkValidity', function () {
if (this.state.editable) {
......@@ -100,6 +85,6 @@
});
}
return true;
});
}, {mutex: 'changestate'});
}(window, rJS, URI));
\ No newline at end of file
......@@ -216,7 +216,7 @@
</item>
<item>
<key> <string>actor</string> </key>
<value> <string>zope</string> </value>
<value> <string>superkato</string> </value>
</item>
<item>
<key> <string>comment</string> </key>
......@@ -230,7 +230,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>966.24080.24291.61081</string> </value>
<value> <string>967.35221.49309.22852</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -248,7 +248,7 @@
</tuple>
<state>
<tuple>
<float>1521818911.25</float>
<float>1526316882.68</float>
<string>UTC</string>
</tuple>
</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