Commit ca098f8b authored by Tristan Cavelier's avatar Tristan Cavelier

Revert "DATETIMEFIELDUPDATE +1 (remove TRISTAN, console.log, ERP5TypeTestCase)"

This reverts commit 9929bc4f.
parent 34224342
......@@ -19,7 +19,12 @@
rJS(window)
.declareMethod('render', function render(options) {
if (this.state && this.state.name === "field_my_title" || options && options.name === "field_my_title") console.log("input: render on call", options);
var input = this.element.querySelector("input");
if (input) {
// force the state to have the current edited value
this.state.checked = input.checked;
this.state.value = input.value;
}
return this.changeState({
value: getFirstNonEmpty(options.value, ""),
checked: options.checked,
......@@ -42,31 +47,17 @@
})
.onStateChange(function onStateChange(modification_dict) {
if (this.state.name === "field_my_title") console.log("input: onStateChange on call", modification_dict);
var textarea = this.element.querySelector('input'),
tmp; // general use short-scope variable
if (modification_dict.hasOwnProperty("value")) { // TRISTAN
textarea.value = this.state.value;
textarea.setAttribute('value', this.state.value);
}
if (modification_dict.hasOwnProperty("checked")) { // TRISTAN
textarea.checked = this.state.checked;
if (this.state.checked) {
textarea.setAttribute('checked', 'checked');
} else {
textarea.removeAttribute('checked');
}
}
if (this.state.type === 'checkbox') {
// textarea.checked = this.state.checked; // TRISTAN
textarea.checked = this.state.checked;
} else {
// textarea.setAttribute('value', this.state.value); // TRISTAN
// textarea.value = this.state.value; // TRISTAN
textarea.setAttribute('value', this.state.value);
textarea.value = this.state.value;
}
if (this.state.type === 'radio') {
// textarea.checked = this.state.checked; // TRISTAN
textarea.checked = this.state.checked;
}
textarea.id = this.state.id || this.state.name;
textarea.setAttribute('name', this.state.name);
......@@ -221,15 +212,7 @@
}, {mutex: 'changestate'})
.declareAcquiredMethod("notifyChange", "notifyChange")
//.onEvent('change', function change() {
.onEvent('change', function change(event) {
if (this.state.name === "field_my_title") console.log("input: event change", event, event.target.value);
var input = this.element.querySelector("input"); // TRISTAN
if (input) {
// force the state to have the current edited value
this.state.checked = input.checked;
this.state.value = input.value;
}
.onEvent('change', function change() {
return RSVP.all([
this.checkValidity(),
this.notifyChange("change")
......
......@@ -214,7 +214,7 @@
</item>
<item>
<key> <string>actor</string> </key>
<value> <string>ERP5TypeTestCase</string> </value>
<value> <string>zope</string> </value>
</item>
<item>
<key> <string>comment</string> </key>
......@@ -228,7 +228,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>975.39254.10526.36096</string> </value>
<value> <string>975.16158.58810.54749</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -246,7 +246,7 @@
</tuple>
<state>
<tuple>
<float>1557412896.19</float>
<float>1556111993.61</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