Commit a8470353 authored by Xiaowu Zhang's avatar Xiaowu Zhang

erp5_web_renderjs_ui: redirect to first object_view when no view defined

parent 0409ed1f
...@@ -131,6 +131,7 @@ ...@@ -131,6 +131,7 @@
/////////////////////////////////////////////////////////////////\n /////////////////////////////////////////////////////////////////\n
.declareAcquiredMethod("jio_getAttachment", "jio_getAttachment")\n .declareAcquiredMethod("jio_getAttachment", "jio_getAttachment")\n
.declareAcquiredMethod("updateHeader", "updateHeader")\n .declareAcquiredMethod("updateHeader", "updateHeader")\n
.declareAcquiredMethod("redirect", "redirect")\n
\n \n
/////////////////////////////////////////////////////////////////\n /////////////////////////////////////////////////////////////////\n
// declared methods\n // declared methods\n
...@@ -146,18 +147,33 @@ ...@@ -146,18 +147,33 @@
element = gadget.props.element,\n element = gadget.props.element,\n
erp5_document,\n erp5_document,\n
erp5_form,\n erp5_form,\n
queue,\n
form_gadget;\n form_gadget;\n
\n \n
gadget.props.jio_key = options.jio_key;\n gadget.props.jio_key = options.jio_key;\n
gadget.props.options = options;\n gadget.props.options = options;\n
\n \n
return gadget.jio_getAttachment(options.jio_key, options.view)\n queue = gadget.jio_getAttachment(options.jio_key, options.view);\n
queue\n
.push(function (result) {\n .push(function (result) {\n
var uri;\n
if (!result._embedded) {\n
return gadget.jio_getAttachment(options.jio_key, "links")\n
.push(function (result) {\n
return gadget.redirect({command: \'change\', options: {\n
view: result._links.view[0].href,\n
editable: undefined,\n
page: undefined\n
}});\n
});\n
}\n
if (options.hasOwnProperty("form_validation_error")) {\n if (options.hasOwnProperty("form_validation_error")) {\n
result._embedded._view = options.form_validation_error;\n result._embedded._view = options.form_validation_error;\n
}\n }\n
var uri = new URI(result._embedded._view._links.form_definition.href);\n uri = new URI(result._embedded._view._links.form_definition.href);\n
erp5_document = result;\n erp5_document = result;\n
queue\n
.push(function () {\n
return gadget.jio_getAttachment(uri.segment(2), "view");\n return gadget.jio_getAttachment(uri.segment(2), "view");\n
})\n })\n
.push(function (result) {\n .push(function (result) {\n
...@@ -199,6 +215,8 @@ ...@@ -199,6 +215,8 @@
$(element).trigger("create");\n $(element).trigger("create");\n
}\n }\n
});\n });\n
});\n
return queue;\n
})\n })\n
\n \n
.allowPublicAcquisition("displayFormulatorValidationError", function (param_list) {\n .allowPublicAcquisition("displayFormulatorValidationError", function (param_list) {\n
...@@ -344,7 +362,7 @@ ...@@ -344,7 +362,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>948.17480.10033.55347</string> </value> <value> <string>949.26608.26326.12817</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -362,7 +380,7 @@ ...@@ -362,7 +380,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1452010103.81</float> <float>1456489995.58</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ZopePageTemplate" module="Products.PageTemplates.ZopePageTemplate"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_bind_names</string> </key>
<value>
<object>
<klass>
<global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>_asgns</string> </key>
<value>
<dictionary>
<item>
<key> <string>name_subpath</string> </key>
<value> <string>traverse_subpath</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>_text</string> </key>
<value> <unicode encoding="cdata"><![CDATA[
<html xmlns:tal="http://xml.zope.org/namespaces/tal"\n
xmlns:metal="http://xml.zope.org/namespaces/metal">\n
<head>\n
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">\n
<title>Test RenderJS UI</title>\n
</head>\n
<body>\n
<table cellpadding="1" cellspacing="1" border="1">\n
<thead>\n
<tr><td rowspan="1" colspan="3">Test RenderJS UI</td></tr>\n
</thead><tbody>\n
<tal:block metal:use-macro="here/Zuite_CommonTemplate/macros/init" />\n
\n
\n
<tr>\n
<td>open</td>\n
<td>${base_url}/web_site_module/renderjs_runner/#/accounting_module</td>\n
<td></td>\n
</tr>\n
\n
<tr>\n
<td>waitForElementPresent</td>\n
<td>//a[@data-i18n=\'Add\']</td>\n
<td></td>\n
</tr>\n
\n
<tr>\n
<td>click</td>\n
<td>link=Add</td>\n
<td></td>\n
</tr>\n
\n
<tr>\n
<td>waitForElementPresent</td>\n
<td>//button[@data-i18n=\'Proceed\']</td>\n
<td></td>\n
</tr>\n
\n
<tr>\n
<td>select</td>\n
<td>//select[@name=\'field_your_portal_type\']</td>\n
<td>label=Sale Invoice Transaction</td>\n
</tr>\n
\n
<tr>\n
<td>click</td>\n
<td>//button[@data-i18n=\'Proceed\']</td>\n
<td></td>\n
</tr>\n
\n
\n
\n
<tr>\n
<td>waitForElementPresent</td>\n
<td>//button[@data-i18n=\'Proceed\']</td>\n
<td></td>\n
</tr>\n
\n
<tr>\n
<td>waitForElementPresent</td>\n
<td>//div[@data-gadget-scope="field_my_translated_simulation_state_title"]</td>\n
<td></td>\n
</tr>\n
\n
\n
</tbody></table>\n
</body>\n
</html>
]]></unicode> </value>
</item>
<item>
<key> <string>content_type</string> </key>
<value> <string>text/html</string> </value>
</item>
<item>
<key> <string>expand</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>testRedirectWhenNoViewDefined</string> </value>
</item>
<item>
<key> <string>output_encoding</string> </key>
<value> <string>utf-8</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <unicode></unicode> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
...@@ -39,6 +39,7 @@ class TestRenderJSUICore(ERP5TypeFunctionalTestCase): ...@@ -39,6 +39,7 @@ class TestRenderJSUICore(ERP5TypeFunctionalTestCase):
'erp5_web_renderjs_ui', 'erp5_web_renderjs_ui',
'erp5_web_renderjs_ui_test', 'erp5_web_renderjs_ui_test',
'erp5_ui_test_core', 'erp5_ui_test_core',
'erp5_accounting',
) )
def test_suite(): def test_suite():
......
erp5_ui_test_core erp5_ui_test_core
erp5_ui_test erp5_ui_test
erp5_web_renderjs_ui erp5_web_renderjs_ui
erp5_accounting
\ No newline at end of file
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment