From 4bcdb943c3f294f2c71a3e35a689db4a26f6f163 Mon Sep 17 00:00:00 2001 From: Sven Franck <sven.franck@nexedi.com> Date: Wed, 8 Apr 2015 12:19:32 +0000 Subject: [PATCH] erp5_web_renderjs_ui: allow to define panel gadget on ERP5 side --- .../web_page_module/rjs_gadget_erp5_html.xml | 11 ++- .../web_page_module/rjs_gadget_erp5_js.xml | 9 +- .../WebSection_renderDefaultPageAsGadget.xml | 3 +- .../WebSection_viewHateoasPreference.xml | 1 + .../my_configuration_panel_gadget_url.xml | 96 +++++++++++++++++++ 5 files changed, 110 insertions(+), 10 deletions(-) create mode 100644 bt5/erp5_web_renderjs_ui/SkinTemplateItem/portal_skins/erp5_web_renderjs_ui/WebSection_viewHateoasPreference/my_configuration_panel_gadget_url.xml diff --git a/bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_html.xml b/bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_html.xml index 59f0795a7e..de82075468 100644 --- a/bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_html.xml +++ b/bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_html.xml @@ -117,10 +117,10 @@ \n <script data-renderjs-configuration="application_title" type="text/x-renderjs-configuration">${application_title}</script>\n <script data-renderjs-configuration="frontpage_gadget" type="text/x-renderjs-configuration">${frontpage_gadget}</script>\n + <script data-renderjs-configuration="panel_gadget" type="text/x-renderjs-configuration">${panel_gadget}</script>\n <script data-renderjs-configuration="action_view" type="text/x-renderjs-configuration">${action_view}</script>\n <script data-renderjs-configuration="default_view_reference" type="text/x-renderjs-configuration">${default_view_reference}</script>\n <script data-renderjs-configuration="hateoas_url" type="text/x-renderjs-configuration">${hateoas_url}</script>\n -\n \n <script src="rsvp.js" type="text/javascript"></script>\n <script src="renderjs.js" type="text/javascript"></script>\n @@ -132,6 +132,7 @@ \n </head>\n <body>\n +\n <div data-gadget-url="gadget_jio.html"\n data-gadget-scope="jio_gadget"\n data-gadget-sandbox="public"></div>\n @@ -140,7 +141,7 @@ data-gadget-scope="header"\n data-gadget-sandbox="public"></div>\n \n - <div data-gadget-url="gadget_erp5_panel.html"\n + <div data-gadget-url="${panel_gadget}"\n data-gadget-scope="panel"\n data-gadget-sandbox="public"></div>\n \n @@ -274,7 +275,7 @@ </item> <item> <key> <string>actor</string> </key> - <value> <string>romain</string> </value> + <value> <string>sven</string> </value> </item> <item> <key> <string>comment</string> </key> @@ -288,7 +289,7 @@ </item> <item> <key> <string>serial</string> </key> - <value> <string>941.31252.46674.14728</string> </value> + <value> <string>942.12881.1847.42734</string> </value> </item> <item> <key> <string>state</string> </key> @@ -306,7 +307,7 @@ </tuple> <state> <tuple> - <float>1425659919.68</float> + <float>1428487030.04</float> <string>GMT</string> </tuple> </state> diff --git a/bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_js.xml b/bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_js.xml index 5af7d31052..d0b8eafda3 100644 --- a/bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_js.xml +++ b/bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_js.xml @@ -241,6 +241,7 @@ key,\n value,\n i;\n +\n for (i = 0; i < len; i += 1) {\n key = element_list[i].getAttribute(\'data-renderjs-configuration\');\n value = element_list[i].textContent;\n @@ -489,7 +490,7 @@ return gadget.dropGadget("panel");\n })\n .push(function () {\n - return gadget.declareGadget("gadget_erp5_panel.html",\n + return gadget.declareGadget(g.props.panel_gadget,\n {scope: "panel",\n element: div});\n })\n @@ -731,7 +732,7 @@ </item> <item> <key> <string>actor</string> </key> - <value> <string>romain</string> </value> + <value> <string>sven</string> </value> </item> <item> <key> <string>comment</string> </key> @@ -745,7 +746,7 @@ </item> <item> <key> <string>serial</string> </key> - <value> <string>941.39539.39866.22681</string> </value> + <value> <string>942.12884.35349.45585</string> </value> </item> <item> <key> <string>state</string> </key> @@ -763,7 +764,7 @@ </tuple> <state> <tuple> - <float>1426155464.07</float> + <float>1428487042.05</float> <string>GMT</string> </tuple> </state> diff --git a/bt5/erp5_web_renderjs_ui/SkinTemplateItem/portal_skins/erp5_web_renderjs_ui/WebSection_renderDefaultPageAsGadget.xml b/bt5/erp5_web_renderjs_ui/SkinTemplateItem/portal_skins/erp5_web_renderjs_ui/WebSection_renderDefaultPageAsGadget.xml index e5251d9160..4cab749d7d 100644 --- a/bt5/erp5_web_renderjs_ui/SkinTemplateItem/portal_skins/erp5_web_renderjs_ui/WebSection_renderDefaultPageAsGadget.xml +++ b/bt5/erp5_web_renderjs_ui/SkinTemplateItem/portal_skins/erp5_web_renderjs_ui/WebSection_renderDefaultPageAsGadget.xml @@ -63,7 +63,8 @@ return default_web_page.WebPage_viewAsWeb(mapping_dict={\n "application_title": web_section.getLayoutProperty("configuration_application_title", default="ERP5"),\n "action_view": web_section.getLayoutProperty("configuration_view_action_category", default="object_view"),\n "default_view_reference": web_section.getLayoutProperty("configuration_default_view_action_reference", default="view"),\n - "hateoas_url": web_section.getLayoutProperty("configuration_hateoas_url", default="hateoas/")\n + "hateoas_url": web_section.getLayoutProperty("configuration_hateoas_url", default="hateoas/"),\n + "panel_gadget": web_section.getLayoutProperty("configuration_panel_gadget_url", default="gadget_erp5_panel.html")\n })\n </string> </value> </item> diff --git a/bt5/erp5_web_renderjs_ui/SkinTemplateItem/portal_skins/erp5_web_renderjs_ui/WebSection_viewHateoasPreference.xml b/bt5/erp5_web_renderjs_ui/SkinTemplateItem/portal_skins/erp5_web_renderjs_ui/WebSection_viewHateoasPreference.xml index 264cce364c..8eb1e6e5d6 100644 --- a/bt5/erp5_web_renderjs_ui/SkinTemplateItem/portal_skins/erp5_web_renderjs_ui/WebSection_viewHateoasPreference.xml +++ b/bt5/erp5_web_renderjs_ui/SkinTemplateItem/portal_skins/erp5_web_renderjs_ui/WebSection_viewHateoasPreference.xml @@ -75,6 +75,7 @@ <string>my_configuration_default_view_action_reference</string> <string>my_configuration_view_action_category</string> <string>my_configuration_frontpage_gadget_url</string> + <string>my_configuration_panel_gadget_url</string> <string>my_configuration_application_title</string> <string>my_configuration_hateoas_url</string> </list> diff --git a/bt5/erp5_web_renderjs_ui/SkinTemplateItem/portal_skins/erp5_web_renderjs_ui/WebSection_viewHateoasPreference/my_configuration_panel_gadget_url.xml b/bt5/erp5_web_renderjs_ui/SkinTemplateItem/portal_skins/erp5_web_renderjs_ui/WebSection_viewHateoasPreference/my_configuration_panel_gadget_url.xml new file mode 100644 index 0000000000..a79a871198 --- /dev/null +++ b/bt5/erp5_web_renderjs_ui/SkinTemplateItem/portal_skins/erp5_web_renderjs_ui/WebSection_viewHateoasPreference/my_configuration_panel_gadget_url.xml @@ -0,0 +1,96 @@ +<?xml version="1.0"?> +<ZopeData> + <record id="1" aka="AAAAAAAAAAE="> + <pickle> + <global name="ProxyField" module="Products.ERP5Form.ProxyField"/> + </pickle> + <pickle> + <dictionary> + <item> + <key> <string>delegated_list</string> </key> + <value> + <list> + <string>title</string> + </list> + </value> + </item> + <item> + <key> <string>id</string> </key> + <value> <string>my_configuration_panel_gadget_url</string> </value> + </item> + <item> + <key> <string>message_values</string> </key> + <value> + <dictionary> + <item> + <key> <string>external_validator_failed</string> </key> + <value> <string>The input failed the external validator.</string> </value> + </item> + </dictionary> + </value> + </item> + <item> + <key> <string>overrides</string> </key> + <value> + <dictionary> + <item> + <key> <string>field_id</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>form_id</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>target</string> </key> + <value> <string></string> </value> + </item> + </dictionary> + </value> + </item> + <item> + <key> <string>tales</string> </key> + <value> + <dictionary> + <item> + <key> <string>field_id</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>form_id</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>target</string> </key> + <value> <string></string> </value> + </item> + </dictionary> + </value> + </item> + <item> + <key> <string>values</string> </key> + <value> + <dictionary> + <item> + <key> <string>field_id</string> </key> + <value> <string>my_view_mode_reference</string> </value> + </item> + <item> + <key> <string>form_id</string> </key> + <value> <string>Base_viewFieldLibrary</string> </value> + </item> + <item> + <key> <string>target</string> </key> + <value> <string>Click to edit the target</string> </value> + </item> + <item> + <key> <string>title</string> </key> + <value> <string>Panel Gadget</string> </value> + </item> + </dictionary> + </value> + </item> + </dictionary> + </pickle> + </record> +</ZopeData> -- 2.30.9