Commit 0c3ed5a9 authored by Tristan Cavelier's avatar Tristan Cavelier

[erp5_web_renderjs_ui] Display module actions in panel

- Hardcodes a panel "VIEWS: List" to hide "consistency", "history" and "metadata".
- Only show "WORKFLOWS" on module document.

/reviewed-on nexedi/erp5!673
parent 1bebf235
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ActionInformation" module="Products.CMFCore.ActionInformation"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>action</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item>
<key> <string>categories</string> </key>
<value>
<tuple>
<string>action_type/object_jio_action</string>
</tuple>
</value>
</item>
<item>
<key> <string>category</string> </key>
<value> <string>object_jio_action</string> </value>
</item>
<item>
<key> <string>condition</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>icon</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>do_nothing_action_jio</string> </value>
</item>
<item>
<key> <string>permissions</string> </key>
<value>
<tuple>
<string>View</string>
</tuple>
</value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Action Information</string> </value>
</item>
<item>
<key> <string>priority</string> </key>
<value> <float>1.0</float> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Do Nothing Action</string> </value>
</item>
<item>
<key> <string>visible</string> </key>
<value> <int>1</int> </value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="Expression" module="Products.CMFCore.Expression"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>text</string> </key>
<value> <string>string:${object_url}/Foo_viewDoNothingActionDialog</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -9,6 +9,7 @@ Foo Line | view
Foo Line | view_contentlist
Foo Line | view_dynamic_matrixbox
Foo Line | view_matrixbox
Foo Module | do_nothing_action_jio
Foo Module | do_nothing_report_jio
Foo Module | empty_mass_action
Foo Module | list
......
......@@ -6,6 +6,7 @@ data-i18n=You do not have the permissions to edit the object.
data-i18n=You are offline.
data-i18n=Action succeeded.
data-i18n=Data received.
data-i18n=List
-->
<html>
<head>
......
......@@ -232,7 +232,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>973.40657.63647.56780</string> </value>
<value> <string>974.59811.2178.43622</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -250,7 +250,7 @@
</tuple>
<state>
<tuple>
<float>1554191060.89</float>
<float>1556802379.3</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -49,6 +49,7 @@ and handling data send&receive.
'gadget_html5_textarea.html',
'gadget_html5_select.html'
],
erp5_module_regexp = /^[^\/]+_module$/,
erp5_module_document_regexp = /^[^\/]+_module\/.+$/;
/*jslint regexp: false*/
......@@ -114,6 +115,7 @@ and handling data send&receive.
.declareAcquiredMethod("notifyChange", "notifyChange")
.declareAcquiredMethod("notifySubmitting", "notifySubmitting")
.declareAcquiredMethod("notifySubmitted", "notifySubmitted")
.declareAcquiredMethod("getTranslationList", "getTranslationList")
/////////////////////////////////////////////////////////////////
// Proxy methods to the child gadget
......@@ -307,17 +309,27 @@ and handling data send&receive.
}
})
.push(function () {
return gadget.getTranslationList(["List"]);
})
.push(function (translation_list) {
var jio_key = gadget.state.options.jio_key;
/*jslint regexp: true*/
if ((erp5_module_document_regexp.test(jio_key)) || (/^portal_.*\/.+$/.test(jio_key))) {
if (erp5_module_regexp.test(jio_key)) {
if (erp5_document._links) {
// hardcode "VIEWS: List" to hide "consistency", "history" and "metadata"
erp5_document._links.action_object_view =
[{"name": "view", "title": translation_list[0], "href": "view", "icon": null}];
}
/*jslint regexp: true*/
} else if (!(erp5_module_document_regexp.test(jio_key) || (/^portal_.*\/.+$/.test(jio_key)))) {
/*jslint regexp: false*/
return gadget.updatePanel({
erp5_document: erp5_document,
editable: gadget.state.options.editable,
jio_key: jio_key,
view: options.view
});
return;
}
return gadget.updatePanel({
erp5_document: erp5_document,
editable: gadget.state.options.editable,
jio_key: jio_key,
view: options.view
});
});
})
/** SubmitContent should be called by the gadget which renders submit button
......
......@@ -228,7 +228,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>972.50141.1687.13277</string> </value>
<value> <string>975.29177.14819.23859</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -246,7 +246,7 @@
</tuple>
<state>
<tuple>
<float>1546616402.84</float>
<float>1556806941.14</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -3,6 +3,8 @@
(function (window, document, rJS, RSVP, Node, asBoolean, ensureArray) {
"use strict";
var erp5_module_document_regexp = /^[^\/]+_module\/.+$/;
function appendDt(fragment, dt_title, dt_icon,
action_list, href_list, index) {
// <dt class="ui-btn-icon-left ui-icon-eye">Views</dt>
......@@ -278,8 +280,11 @@
appendDt(dl_fragment, result_list[1][0], 'eye',
view_list, result_list[0], 0);
appendDt(dl_fragment, result_list[1][1], 'random',
workflow_list, result_list[0], view_list.length);
if (erp5_module_document_regexp.test(gadget.state.jio_key)) {
// show Workflows only on document
appendDt(dl_fragment, result_list[1][1], 'random',
workflow_list, result_list[0], view_list.length);
}
appendDt(dl_fragment, result_list[1][2], 'cogs',
action_list, result_list[0],
view_list.length + workflow_list.length);
......
......@@ -228,7 +228,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>972.50145.12391.26965</string> </value>
<value> <string>975.28786.11454.38434</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -246,7 +246,7 @@
</tuple>
<state>
<tuple>
<float>1546958744.66</float>
<float>1556783632.84</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>testFormListMenuActionLink</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 Form View Editable Save Action</title>
</head>
<body>
<table cellpadding="1" cellspacing="1" border="1">
<thead>
<tr><td rowspan="1" colspan="3">Test Default Module View</td></tr>
</thead><tbody>
<tal:block metal:use-macro="here/PTZuite_CommonTemplate/macros/init" />
<tr>
<td>open</td>
<td>&#36;{base_url}/web_site_module/renderjs_runner/#/foo_module</td>
<td></td>
</tr>
<!-- Wait for gadget to be loaded -->
<tr>
<td>waitForElementPresent</td>
<td>//div[@data-gadget-url='&#36;{base_url}/web_site_module/renderjs_runner/gadget_erp5_pt_form_list.html']</td>
<td></td>
</tr>
<tr>
<td>waitForTextPresent</td>
<td>Add</td>
<td></td>
</tr>
<!-- 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' and contains(@class, 'visible')]//a[text()='Do Nothing Action']</td>
<td></td>
</tr>
<tr>
<td>click</td>
<td>//div[@data-gadget-scope='panel']//a[text()='Do Nothing Action']</td>
<td></td>
</tr>
<tr>
<td>waitForElementPresent</td>
<td>//div[@data-gadget-url='&#36;{base_url}/web_site_module/renderjs_runner/gadget_erp5_pt_form_dialog.html']</td>
<td></td>
</tr>
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/submit_dialog" />
<tal:block tal:define="notification_configuration python: {'class': 'success',
'text': '&quot;Nothing&quot; action is done.'}">
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/wait_for_notification" />
</tal:block>
</tbody></table>
</body>
</html>
\ No newline at end of file
<?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>testFormListMenuViewLink</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 Default Module View</title>
</head>
<body>
<table cellpadding="1" cellspacing="1" border="1">
<thead>
<tr><td rowspan="1" colspan="3">Test Default Module View</td></tr>
</thead><tbody>
<tal:block metal:use-macro="here/PTZuite_CommonTemplate/macros/init" />
<tr>
<td>open</td>
<td>&#36;{base_url}/web_site_module/renderjs_runner/#/foo_module</td>
<td></td>
</tr>
<!-- Wait for gadget to be loaded -->
<tr>
<td>waitForElementPresent</td>
<td>//div[@data-gadget-url='&#36;{base_url}/web_site_module/renderjs_runner/gadget_erp5_pt_form_list.html']</td>
<td></td>
</tr>
<tr>
<td>waitForTextPresent</td>
<td>Add</td>
<td></td>
</tr>
<!-- Go to the views 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' and contains(@class, 'visible')]//a[text()='List']</td>
<td></td>
</tr>
<tr>
<td>click</td>
<td>//div[@data-gadget-scope='panel']//a[text()='List']</td>
<td></td>
</tr>
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/wait_for_content_loaded" />
<tr>
<td>waitForElementPresent</td>
<td>//div[@data-gadget-url='&#36;{base_url}/web_site_module/renderjs_runner/gadget_erp5_pt_form_list.html']</td>
<td></td>
</tr>
</tbody></table>
</body>
</html>
\ No newline at end of file
......@@ -75,6 +75,7 @@ param_dict = [
{ 'message': 'Foo Category', 'translation': 'Foo leibie', 'language': 'wo'},
{ 'message': 'Configure', 'translation': 'peizhi', 'language': 'wo'},
{ 'message': 'Configure Editor', 'translation': 'peizhibianjiqi', 'language': 'wo'},
{ 'message': 'List', 'translation': 'liebiao', 'language': 'wo'},
{ 'message': 'This page contains unsaved changes, do you really want to leave the page ?', 'translation': 'querenlikai?', 'language': 'wo'}
]
for tmp in param_dict:
......
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