From 598bb3fe8ec3226a35028b0237a7dbe381e3ddb0 Mon Sep 17 00:00:00 2001 From: Romain Courteaud <romain@nexedi.com> Date: Thu, 21 Jun 2018 10:15:18 +0000 Subject: [PATCH] [erp5_web_renderjs_ui] Display the modification date on search list --- .../rjs_gadget_erp5_page_search_js.js | 41 +++++++++++++++---- .../rjs_gadget_erp5_page_search_js.xml | 4 +- 2 files changed, 36 insertions(+), 9 deletions(-) diff --git a/bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_page_search_js.js b/bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_page_search_js.js index 662bc9ebd4..1ac01d7172 100644 --- a/bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_page_search_js.js +++ b/bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_page_search_js.js @@ -10,10 +10,43 @@ .declareAcquiredMethod("updateHeader", "updateHeader") .declareAcquiredMethod("getUrlParameter", "getUrlParameter") .declareAcquiredMethod("getUrlFor", "getUrlFor") + .declareAcquiredMethod("jio_allDocs", "jio_allDocs") ///////////////////////////////////////////////////////////////// // declared methods ///////////////////////////////////////////////////////////////// + .allowPublicAcquisition("jio_allDocs", function (param_list) { + var gadget = this; + return gadget.jio_allDocs(param_list[0]) + .push(function (result) { + var i, date, len = result.data.total_rows; + for (i = 0; i < len; i += 1) { + if (result.data.rows[i].value.hasOwnProperty("modification_date")) { + date = new Date(result.data.rows[i].value.modification_date); + result.data.rows[i].value.modification_date = { + field_gadget_param: { + allow_empty_time: 0, + ampm_time_style: 0, + css_class: "date_field", + date_only: true, + description: "The Date", + editable: 1, + hidden: 0, + hidden_day_is_last_day: 0, + "default": date.toUTCString(), + key: "modification_date", + required: 0, + timezone_style: 0, + title: "Modification Date", + type: "DateTimeField" + } + }; + } + } + return result; + }); + }) + .allowPublicAcquisition('updateHeader', function () { return; }) @@ -65,11 +98,11 @@ .push(function (form_gadget) { var column_list = [ ['translated_portal_type', 'Type'], + ['modification_date', 'Modification Date'], ['title', 'Title'], ['reference', 'Reference'], ['description', 'Description'], ['translated_validation_state_title', 'State'] - // ['modification_date', 'Modification Date'] ]; return form_gadget.render({ erp5_document: {"_embedded": {"_view": { @@ -88,12 +121,6 @@ "sort_column_list": column_list, "title": "Documents", "type": "ListBox" - }, - "listbox_modification_date": { - "date_only": true, - "title": "Modification Date", - "type": "DateTimeField", - "editable": 1 } }}, "_links": { diff --git a/bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_page_search_js.xml b/bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_page_search_js.xml index 0abd2f8c9a..4c81369d7d 100644 --- a/bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_page_search_js.xml +++ b/bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_page_search_js.xml @@ -230,7 +230,7 @@ </item> <item> <key> <string>serial</string> </key> - <value> <string>965.31874.35241.45806</string> </value> + <value> <string>968.24003.31720.11707</string> </value> </item> <item> <key> <string>state</string> </key> @@ -248,7 +248,7 @@ </tuple> <state> <tuple> - <float>1518597351.54</float> + <float>1529576061.63</float> <string>UTC</string> </tuple> </state> -- 2.30.9