Commit 2952a078 authored by Romain Courteaud's avatar Romain Courteaud

erp5_xhtml_style/erp5_web_renderjs_ui: update to renderJS 0.12.0

parent 3562b3bc
...@@ -1120,6 +1120,7 @@ if (typeof document.contains !== 'function') { ...@@ -1120,6 +1120,7 @@ if (typeof document.contains !== 'function') {
}; };
RenderJSGadget.setState = function (state_dict) { RenderJSGadget.setState = function (state_dict) {
var json_state = JSON.stringify(state_dict); var json_state = JSON.stringify(state_dict);
this.prototype.__json_state = json_state;
return this.ready(function () { return this.ready(function () {
this.state = JSON.parse(json_state); this.state = JSON.parse(json_state);
}); });
...@@ -1250,7 +1251,8 @@ if (typeof document.contains !== 'function') { ...@@ -1250,7 +1251,8 @@ if (typeof document.contains !== 'function') {
.declareMethod('changeState', function (state_dict) { .declareMethod('changeState', function (state_dict) {
var key, var key,
modified = false, modified = false,
modification_dict = {}; modification_dict = {},
context = this;
for (key in state_dict) { for (key in state_dict) {
if (state_dict[key] !== this.state[key]) { if (state_dict[key] !== this.state[key]) {
this.state[key] = state_dict[key]; this.state[key] = state_dict[key];
...@@ -1259,7 +1261,18 @@ if (typeof document.contains !== 'function') { ...@@ -1259,7 +1261,18 @@ if (typeof document.contains !== 'function') {
} }
} }
if (modified && this.__state_change_callback !== undefined) { if (modified && this.__state_change_callback !== undefined) {
return this.__state_change_callback(modification_dict); return new RSVP.Queue()
.push(function () {
return context.__state_change_callback(modification_dict);
})
.push(undefined, function (error) {
if (context.__json_state !== undefined) {
context.state = JSON.parse(context.__json_state);
} else {
context.state = {};
}
throw error;
});
} }
}); });
...@@ -1622,7 +1635,14 @@ if (typeof document.contains !== 'function') { ...@@ -1622,7 +1635,14 @@ if (typeof document.contains !== 'function') {
gadget_loading_klass = undefined; gadget_loading_klass = undefined;
throw e; throw e;
}); });
local_loading_klass_promise = loading_klass_promise; //gadget loading should not be interrupted
//if not, gadget's definition will not be complete
//.then will return another promise
//so loading_klass_promise can't be cancel
local_loading_klass_promise = loading_klass_promise
.then(function (gadget_instance) {
return gadget_instance;
});
queue = new RSVP.Queue() queue = new RSVP.Queue()
.push(function () { .push(function () {
......
...@@ -230,7 +230,7 @@ ...@@ -230,7 +230,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>954.33025.37475.1638</string> </value> <value> <string>955.29626.47611.24814</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -248,7 +248,7 @@ ...@@ -248,7 +248,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1476192938.84</float> <float>1479897063.05</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
...@@ -10,10 +10,6 @@ ...@@ -10,10 +10,6 @@
<key> <string>_Cacheable__manager_id</string> </key> <key> <string>_Cacheable__manager_id</string> </key>
<value> <string>http_cache</string> </value> <value> <string>http_cache</string> </value>
</item> </item>
<item>
<key> <string>_EtagSupport__etag</string> </key>
<value> <string>ts65978087.08</string> </value>
</item>
<item> <item>
<key> <string>__name__</string> </key> <key> <string>__name__</string> </key>
<value> <string>renderjs.js</string> </value> <value> <string>renderjs.js</string> </value>
...@@ -26,10 +22,6 @@ ...@@ -26,10 +22,6 @@
<key> <string>precondition</string> </key> <key> <string>precondition</string> </key>
<value> <string></string> </value> <value> <string></string> </value>
</item> </item>
<item>
<key> <string>size</string> </key>
<value> <int>77916</int> </value>
</item>
<item> <item>
<key> <string>title</string> </key> <key> <string>title</string> </key>
<value> <string></string> </value> <value> <string></string> </value>
......
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