From 9f7f8762f4bcad4a9b414e36ed2f3c9ca60d5eaa Mon Sep 17 00:00:00 2001 From: Romain Courteaud <romain@nexedi.com> Date: Wed, 12 Oct 2016 12:26:58 +0000 Subject: [PATCH] [erp5_web_renderjs_ui] Add getTextContent on string field --- .../web_page_module/rjs_gadget_erp5_stringfield_js.js | 10 +++++++++- .../web_page_module/rjs_gadget_erp5_stringfield_js.xml | 4 ++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_stringfield_js.js b/bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_stringfield_js.js index 065a5ae2ca..8da8cfb4ca 100644 --- a/bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_stringfield_js.js +++ b/bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_stringfield_js.js @@ -7,6 +7,7 @@ .setState({ tag: 'p' }) + .declareMethod('render', function (options) { var field_json = options.field_json || {}, state_dict = { @@ -19,6 +20,7 @@ state_dict.text_content = state_dict.value; return this.changeState(state_dict); }) + .onStateChange(function (modification_dict) { var element = this.element, gadget = this, @@ -46,7 +48,6 @@ .push(function (input) { return input.render(gadget.state); }); - }) .declareMethod('getContent', function () { @@ -59,6 +60,13 @@ return {}; }) + .declareMethod('getTextContent', function () { + return this.getDeclaredGadget('sub') + .push(function (gadget) { + return gadget.getTextContent(); + }); + }) + .declareMethod('checkValidity', function () { if (this.state.editable) { return this.getDeclaredGadget('sub') diff --git a/bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_stringfield_js.xml b/bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_stringfield_js.xml index 4d0e785e20..d9e62f321e 100644 --- a/bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_stringfield_js.xml +++ b/bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_stringfield_js.xml @@ -230,7 +230,7 @@ </item> <item> <key> <string>serial</string> </key> - <value> <string>954.34570.5720.55227</string> </value> + <value> <string>954.35858.57287.35225</string> </value> </item> <item> <key> <string>state</string> </key> @@ -248,7 +248,7 @@ </tuple> <state> <tuple> - <float>1476197972.06</float> + <float>1476273908.28</float> <string>UTC</string> </tuple> </state> -- 2.30.9