Commit fa6b944b authored by Romain Courteaud's avatar Romain Courteaud

[erp5_web_renderjs_ui] Rewrite readonly field

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