Commit fa6b944b authored by Romain Courteaud's avatar Romain Courteaud

[erp5_web_renderjs_ui] Rewrite readonly field

parent 71636846
......@@ -13,6 +13,6 @@
</head>
<body>
<p></p>
<div data-gadget-url="gadget_html5_element.html" data-gadget-scope="p"></div>
</body>
</html>
\ No newline at end of file
......@@ -220,7 +220,7 @@
</item>
<item>
<key> <string>actor</string> </key>
<value> <string>romain</string> </value>
<value> <string>zope</string> </value>
</item>
<item>
<key> <string>comment</string> </key>
......@@ -234,7 +234,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>937.48463.61692.15325</string> </value>
<value> <string>954.42863.28521.29388</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -252,8 +252,8 @@
</tuple>
<state>
<tuple>
<float>1411392972.05</float>
<string>GMT</string>
<float>1476694144.73</float>
<string>UTC</string>
</tuple>
</state>
</object>
......
/*global window, rJS */
/*global window, rJS*/
/*jslint indent: 2, maxerr: 3 */
(function (window, rJS) {
"use strict";
rJS(window)
.ready(function (gadget) {
return gadget.getElement()
.push(function (element) {
gadget.element = element;
});
.setState({
tag: 'p'
})
.declareMethod('render', function (options) {
var input = this.element.querySelector('p'),
field_json = options.field_json || {};
input.textContent = field_json.value || field_json.default || "";
var field_json = options.field_json || {},
state_dict = {
text_content: field_json.value || field_json.default || ""
};
return this.changeState(state_dict);
})
.declareMethod('getContent', function () {
return {};
.onStateChange(function (modification_dict) {
var gadget = this;
return this.getDeclaredGadget('p')
.push(function (input) {
return input.render(gadget.state);
});
});
}(window, rJS));
\ No newline at end of file
......@@ -216,7 +216,7 @@
</item>
<item>
<key> <string>actor</string> </key>
<value> <string>romain</string> </value>
<value> <string>zope</string> </value>
</item>
<item>
<key> <string>comment</string> </key>
......@@ -230,7 +230,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>937.42845.63862.35925</string> </value>
<value> <string>954.42865.16049.14216</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -248,8 +248,8 @@
</tuple>
<state>
<tuple>
<float>1411392995.5</float>
<string>GMT</string>
<float>1476694564.13</float>
<string>UTC</string>
</tuple>
</state>
</object>
......
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