From 7774b4decae18356bc524a78a95dff12362a90b6 Mon Sep 17 00:00:00 2001 From: Romain Courteaud <romain@nexedi.com> Date: Thu, 24 Nov 2016 10:46:26 +0000 Subject: [PATCH] erp5_xhtml_style/erp5_web_renderjs_ui: update to renderJS 0.12.1 --- .../web_page_module/rjs_renderjs_js.js | 26 +++++++++++-------- .../web_page_module/rjs_renderjs_js.xml | 4 +-- .../erp5_xhtml_style/renderjs.js.js | 26 +++++++++++-------- 3 files changed, 32 insertions(+), 24 deletions(-) diff --git a/bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_renderjs_js.js b/bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_renderjs_js.js index 3462f562dd..28f024b7d5 100644 --- a/bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_renderjs_js.js +++ b/bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_renderjs_js.js @@ -1120,7 +1120,6 @@ if (typeof document.contains !== 'function') { }; RenderJSGadget.setState = function (state_dict) { var json_state = JSON.stringify(state_dict); - this.prototype.__json_state = json_state; return this.ready(function () { this.state = JSON.parse(json_state); }); @@ -1251,10 +1250,19 @@ if (typeof document.contains !== 'function') { .declareMethod('changeState', function (state_dict) { var key, modified = false, - modification_dict = {}, + previous_cancelled = this.hasOwnProperty('__modification_dict'), + modification_dict, context = this; + if (previous_cancelled) { + modification_dict = this.__modification_dict; + modified = true; + } else { + modification_dict = {}; + this.__modification_dict = modification_dict; + } for (key in state_dict) { - if (state_dict[key] !== this.state[key]) { + if (state_dict.hasOwnProperty(key) && + (state_dict[key] !== this.state[key])) { this.state[key] = state_dict[key]; modification_dict[key] = state_dict[key]; modified = true; @@ -1265,13 +1273,9 @@ if (typeof document.contains !== 'function') { .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; + .push(function (result) { + delete context.__modification_dict; + return result; }); } }); @@ -2345,4 +2349,4 @@ if (typeof document.contains !== 'function') { bootstrap(); }(document, window, RSVP, DOMParser, Channel, MutationObserver, Node, - FileReader, Blob, navigator, Event)); \ No newline at end of file + FileReader, Blob, navigator, Event)); diff --git a/bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_renderjs_js.xml b/bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_renderjs_js.xml index 1fe7b57c3b..d0bfc4589f 100644 --- a/bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_renderjs_js.xml +++ b/bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_renderjs_js.xml @@ -230,7 +230,7 @@ </item> <item> <key> <string>serial</string> </key> - <value> <string>955.29626.47611.24814</string> </value> + <value> <string>955.32062.5607.2594</string> </value> </item> <item> <key> <string>state</string> </key> @@ -248,7 +248,7 @@ </tuple> <state> <tuple> - <float>1479897063.05</float> + <float>1479983103.55</float> <string>UTC</string> </tuple> </state> diff --git a/product/ERP5/bootstrap/erp5_xhtml_style/SkinTemplateItem/portal_skins/erp5_xhtml_style/renderjs.js.js b/product/ERP5/bootstrap/erp5_xhtml_style/SkinTemplateItem/portal_skins/erp5_xhtml_style/renderjs.js.js index 3462f562dd..28f024b7d5 100644 --- a/product/ERP5/bootstrap/erp5_xhtml_style/SkinTemplateItem/portal_skins/erp5_xhtml_style/renderjs.js.js +++ b/product/ERP5/bootstrap/erp5_xhtml_style/SkinTemplateItem/portal_skins/erp5_xhtml_style/renderjs.js.js @@ -1120,7 +1120,6 @@ if (typeof document.contains !== 'function') { }; RenderJSGadget.setState = function (state_dict) { var json_state = JSON.stringify(state_dict); - this.prototype.__json_state = json_state; return this.ready(function () { this.state = JSON.parse(json_state); }); @@ -1251,10 +1250,19 @@ if (typeof document.contains !== 'function') { .declareMethod('changeState', function (state_dict) { var key, modified = false, - modification_dict = {}, + previous_cancelled = this.hasOwnProperty('__modification_dict'), + modification_dict, context = this; + if (previous_cancelled) { + modification_dict = this.__modification_dict; + modified = true; + } else { + modification_dict = {}; + this.__modification_dict = modification_dict; + } for (key in state_dict) { - if (state_dict[key] !== this.state[key]) { + if (state_dict.hasOwnProperty(key) && + (state_dict[key] !== this.state[key])) { this.state[key] = state_dict[key]; modification_dict[key] = state_dict[key]; modified = true; @@ -1265,13 +1273,9 @@ if (typeof document.contains !== 'function') { .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; + .push(function (result) { + delete context.__modification_dict; + return result; }); } }); @@ -2345,4 +2349,4 @@ if (typeof document.contains !== 'function') { bootstrap(); }(document, window, RSVP, DOMParser, Channel, MutationObserver, Node, - FileReader, Blob, navigator, Event)); \ No newline at end of file + FileReader, Blob, navigator, Event)); -- 2.30.9