Commit 8863ec26 authored by Romain Courteaud's avatar Romain Courteaud

erp5_web_renderjs_ui: show the clone action in the panel

parent 0f71fa66
......@@ -67,6 +67,7 @@
workflow_list,
view_list,
action_list,
clone_list,
jump_list,
i;
......@@ -86,6 +87,7 @@
action_list = ensureArray(erp5_document._links.action_object_jio_action)
.concat(ensureArray(erp5_document._links.action_object_jio_button))
.concat(ensureArray(erp5_document._links.action_object_jio_fast_input));
clone_list = ensureArray(erp5_document._links.action_object_clone_action);
jump_list = ensureArray(erp5_document._links.action_object_jio_jump);
if (view === 'view') {
......@@ -102,6 +104,9 @@
for (i = 0; i < action_list.length; i += 1) {
action_list[i].class_name = action_list[i].href === view ? 'active' : '';
}
for (i = 0; i < clone_list.length; i += 1) {
clone_list[i].class_name = clone_list[i].href === view ? 'active' : '';
}
for (i = 0; i < jump_list.length; i += 1) {
jump_list[i].class_name = ((jump_list[i].href === jump_view) || (jump_list[i].href === view)) ? 'active' : '';
}
......@@ -111,6 +116,7 @@
workflow_list = JSON.stringify(workflow_list);
view_list = JSON.stringify(view_list);
action_list = JSON.stringify(action_list);
clone_list = JSON.stringify(clone_list);
jump_list = JSON.stringify(jump_list);
}
return context.getUrlParameter('editable')
......@@ -121,6 +127,7 @@
workflow_list: workflow_list,
view_list: view_list,
action_list: action_list,
clone_list: clone_list,
jump_list: jump_list,
global: true,
jio_key: jio_key,
......@@ -246,6 +253,7 @@
modification_dict.hasOwnProperty("jump_view") ||
modification_dict.hasOwnProperty("workflow_list") ||
modification_dict.hasOwnProperty("action_list") ||
modification_dict.hasOwnProperty("clone_list") ||
modification_dict.hasOwnProperty("jump_list") ||
modification_dict.hasOwnProperty("jio_key") ||
modification_dict.hasOwnProperty("view_list"))) {
......@@ -258,6 +266,7 @@
parameter_list = [],
view_list = JSON.parse(gadget.state.view_list),
action_list = JSON.parse(gadget.state.action_list),
clone_list = JSON.parse(gadget.state.clone_list),
jump_list = JSON.parse(gadget.state.jump_list);
workflow_list = JSON.parse(gadget.state.workflow_list);
......@@ -288,6 +297,16 @@
}
});
}
for (i = 0; i < clone_list.length; i += 1) {
parameter_list.push({
command: 'display_dialog_with_history',
options: {
jio_key: gadget.state.jio_key,
view: clone_list[i].href,
editable: true
}
});
}
for (i = 0; i < jump_list.length; i += 1) {
parameter_list.push({
command: 'display_dialog_with_history',
......@@ -308,6 +327,7 @@
dl_fragment = document.createDocumentFragment(),
view_list = JSON.parse(gadget.state.view_list),
action_list = JSON.parse(gadget.state.action_list),
clone_list = JSON.parse(gadget.state.clone_list),
jump_list = JSON.parse(gadget.state.jump_list);
appendDt(dl_fragment, result_list[1][0], 'eye',
......@@ -318,12 +338,12 @@
workflow_list, result_list[0], view_list.length);
}
appendDt(dl_fragment, result_list[1][2], 'cogs',
action_list, result_list[0],
action_list.concat(clone_list), result_list[0],
view_list.length + workflow_list.length);
appendDt(dl_fragment, result_list[1][3], 'plane',
jump_list, result_list[0],
view_list.length + workflow_list.length +
action_list.length);
action_list.length + clone_list.length);
dl_element = gadget.element.querySelector("dl");
while (dl_element.firstChild) {
......
......@@ -234,7 +234,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>987.27464.21813.55483</string> </value>
<value> <string>988.65434.35774.5563</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -252,7 +252,7 @@
</tuple>
<state>
<tuple>
<float>1604411452.55</float>
<float>1609322633.89</float>
<string>UTC</string>
</tuple>
</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>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>testFormViewMenuActionLink</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>
<html xmlns:tal="http://xml.zope.org/namespaces/tal"
xmlns:metal="http://xml.zope.org/namespaces/metal">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Test Page Front</title>
</head>
<body>
<table cellpadding="1" cellspacing="1" border="1">
<thead>
<tr><td rowspan="1" colspan="3">Test Page Tab Link List</td></tr>
</thead><tbody>
<tal:block metal:use-macro="here/PTZuite_CommonTemplate/macros/init" />
<tr>
<td>open</td>
<td>${base_url}/web_site_module/renderjs_runner/#/foo_module/1</td>
<td></td>
</tr>
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/wait_for_app_loaded" />
<!-- Go to the action from the panel -->
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/open_menu_panel" />
<tr>
<td>assertElementPresent</td>
<td>//div[@data-gadget-scope='panel']//a[text()='Clone Document' and contains(@href, '#!display_dialog_with_history') and contains(@href, 'clone_document')]</td>
<td></td>
</tr>
<!-- Follow one link -->
<tal:block tal:define="click_configuration python: {'text': 'Clone Document'}">
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/click_on_panel_link" />
</tal:block>
<tal:block tal:define="notification_configuration python: {'class': 'success',
'text': 'Created Clone Foo.'}">
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/wait_for_notification" />
</tal:block>
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/wait_for_content_loaded" />
<tr>
<td>assertElementPresent</td>
<td>//div[@data-gadget-url='${base_url}/web_site_module/renderjs_runner/gadget_erp5_pt_form_view_editable.html']</td>
<td></td>
</tr>
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/verify_is_editable_mode" />
</tbody></table>
</body>
</html>
\ 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