Commit 52a6159d authored by Romain Courteaud's avatar Romain Courteaud

erp5_web_renderjs_ui: always clear the file input when rendering the field

Prevent sending the binary each time.
Follow file input behaviour
parent 41430911
...@@ -27,31 +27,23 @@ ...@@ -27,31 +27,23 @@
return this.changeState(state_dict); return this.changeState(state_dict);
}) })
.onStateChange(function (modification_dict) { .onStateChange(function () {
var element = this.element, var element = this.element,
gadget = this, gadget = this,
url, url;
result; if (gadget.state.editable) {
if (modification_dict.hasOwnProperty('editable')) { url = 'gadget_html5_input.html';
if (gadget.state.editable) {
url = 'gadget_html5_input.html';
} else {
url = 'gadget_html5_element.html';
}
result = this.declareGadget(url, {scope: 'sub'})
.push(function (input) {
// Clear first to DOM, append after to reduce flickering/manip
while (element.firstChild) {
element.removeChild(element.firstChild);
}
element.appendChild(input.element);
return input;
});
} else { } else {
result = this.getDeclaredGadget('sub'); url = 'gadget_html5_element.html';
} }
return result return this.declareGadget(url, {scope: 'sub'})
.push(function (input) { .push(function (input) {
// Clear first to DOM, append after to reduce flickering/manip
while (element.firstChild) {
element.removeChild(element.firstChild);
}
element.appendChild(input.element);
return input.render(gadget.state); return input.render(gadget.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