From 07d31edc23e07ff593c50d7b1706faa73585ce49 Mon Sep 17 00:00:00 2001 From: Sven Franck <sven.franck@nexedi.com> Date: Thu, 4 Sep 2014 08:31:34 +0000 Subject: [PATCH] erp5_web_renderjs_ui: move tab gadget back inside form gadget --- .../web_page_module/rjs_gadget_erp5_js.xml | 11 ++------ .../rjs_gadget_erp5_pt_form_view_html.xml | 9 +++++-- .../rjs_gadget_erp5_pt_form_view_js.xml | 26 +++++++++++++------ .../rjs_gadget_erp5_tab_list_js.xml | 8 +++--- 4 files changed, 32 insertions(+), 22 deletions(-) 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 712023ca90..a3d2016298 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 @@ -199,7 +199,6 @@ ]);\n })\n .push(function (result) {\n - var content_list = [];\n \n sub_options = options.form_gadget || {};\n sub_options.erp5_document = result[0].data;\n @@ -210,15 +209,11 @@ return RSVP.all([\n gadget.declareGadget("gadget_erp5_pt_" + sub_options.form_definition.pt + ".html", {\n scope: "form_gadget"\n - }),\n - gadget.declareGadget("gadget_erp5_tab_list.html", {\n - scope: "erp5_tab"\n })\n ]);\n })\n .push(function (gadget_list) {\n var form_gadget = gadget_list[0],\n - tab_gadget = gadget_list[1],\n new_content_action = sub_options.erp5_document._links.action_object_new_content_action,\n plus_queue,\n new_element;\n @@ -240,8 +235,6 @@ }\n \n return RSVP.all([\n - tab_gadget.render(sub_options),\n - tab_gadget.getElement(),\n form_gadget.render(sub_options),\n form_gadget.getElement(),\n gadget.props.breadcrumb_gadget.render(breadcrumb_options),\n @@ -564,7 +557,7 @@ </item> <item> <key> <string>serial</string> </key> - <value> <string>937.8167.39223.50892</string> </value> + <value> <string>937.22192.46889.64802</string> </value> </item> <item> <key> <string>state</string> </key> @@ -582,7 +575,7 @@ </tuple> <state> <tuple> - <float>1408975361.84</float> + <float>1409819356.02</float> <string>GMT</string> </tuple> </state> diff --git a/bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_pt_form_view_html.xml b/bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_pt_form_view_html.xml index f65c55164b..20a3c9c7a0 100644 --- a/bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_pt_form_view_html.xml +++ b/bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_pt_form_view_html.xml @@ -129,6 +129,11 @@ \n </head>\n <body>\n + \n + <div data-gadget-url="gadget_erp5_tab_list.html"\n + data-gadget-scope="erp5_tab"\n + data-gadget-sandbox="public">\n + </div>\n \n <!-- XXX action, method, fieldset -->\n <form class="save_form">\n @@ -283,7 +288,7 @@ </item> <item> <key> <string>serial</string> </key> - <value> <string>936.54726.55391.8362</string> </value> + <value> <string>937.22212.34746.7150</string> </value> </item> <item> <key> <string>state</string> </key> @@ -301,7 +306,7 @@ </tuple> <state> <tuple> - <float>1407836841.44</float> + <float>1409817872.15</float> <string>GMT</string> </tuple> </state> diff --git a/bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_pt_form_view_js.xml b/bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_pt_form_view_js.xml index 3414fb9f58..732c0a7dd9 100644 --- a/bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_pt_form_view_js.xml +++ b/bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_pt_form_view_js.xml @@ -152,10 +152,11 @@ .declareMethod(\'render\', function (options) {\n var erp5_document = options.erp5_document,\n action_list = erp5_document._links.action_workflow || [],\n + fragment = document.createDocumentFragment(),\n form_gadget = this,\n - i,\n - promise_list = [];\n -\n + promise_list = [],\n + i;\n + \n for (i = 0; i < action_list.length; i += 1) {\n promise_list.push(this.whoWantToDisplayThisPage({\n name: action_list[i].name\n @@ -168,13 +169,15 @@ return new RSVP.Queue()\n .push(function () {\n return RSVP.all([\n + form_gadget.getDeclaredGadget("erp5_tab"),\n form_gadget.getDeclaredGadget("erp5_form"),\n RSVP.all(promise_list)\n ]);\n })\n .push(function (all_gadget) {\n var form_options = options.erp5_form || {},\n - all_result = all_gadget[1],\n + tab_options = options.erp5_tag || {},\n + all_result = all_gadget[2],\n actionlist = [],\n class_list,\n i;\n @@ -182,6 +185,11 @@ form_options.erp5_document = options.erp5_document;\n form_options.form_definition = options.form_definition;\n form_options.view = options.view;\n + \n + tab_options.erp5_document = options.erp5_document;\n + tab_options.form_definition = options.form_definition;\n + tab_options.view = options.view;\n + tab_options.action_view = options.action_view;\n \n for (i = 0; i < all_result.length; i += 1) {\n switch (i) {\n @@ -201,12 +209,14 @@ link: all_result[i],\n });\n }\n + form_gadget.__element.appendChild(fragment);\n form_gadget.__element.querySelector("div.ui-controlgroup-controls")\n .innerHTML = workflow_template({actionlist: actionlist});\n -\n + \n \n return RSVP.all([\n - all_gadget[0].render(form_options),\n + all_gadget[0].render(tab_options),\n + all_gadget[1].render(form_options)\n ]);\n });\n \n @@ -373,7 +383,7 @@ </item> <item> <key> <string>serial</string> </key> - <value> <string>936.54729.48588.29371</string> </value> + <value> <string>937.22215.35138.15906</string> </value> </item> <item> <key> <string>state</string> </key> @@ -391,7 +401,7 @@ </tuple> <state> <tuple> - <float>1407836873.52</float> + <float>1409818069.12</float> <string>GMT</string> </tuple> </state> diff --git a/bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_tab_list_js.xml b/bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_tab_list_js.xml index b2f2c653bd..8cbe9e73a3 100644 --- a/bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_tab_list_js.xml +++ b/bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_tab_list_js.xml @@ -147,7 +147,8 @@ // declared methods\n /////////////////////////////////////////////////////////////////\n .declareMethod(\'render\', function (options) {\n - var nav_element = this.props.element.querySelector(".grid-container"),\n + var tab_gadget = this, \n + nav_element = tab_gadget.props.element.querySelector(".grid-container"),\n erp5_document = options.erp5_document,\n view_list = erp5_document._links[options.action_view],\n nav_html = \'<nav data-role="navbar"><ul class="grid-items">\',\n @@ -190,6 +191,7 @@ nav_html += \'</ul></nav>\';\n nav_element.innerHTML = nav_html;\n \n + return tab_gadget;\n });\n \n });\n @@ -331,7 +333,7 @@ </item> <item> <key> <string>serial</string> </key> - <value> <string>936.54906.24658.1911</string> </value> + <value> <string>937.690.6828.44612</string> </value> </item> <item> <key> <string>state</string> </key> @@ -349,7 +351,7 @@ </tuple> <state> <tuple> - <float>1407848815.35</float> + <float>1409818434.1</float> <string>GMT</string> </tuple> </state> -- 2.30.9