Commit a9ba9e7c authored by Romain Courteaud's avatar Romain Courteaud Committed by Gabriel Monnerat

erp5_web_renderjs_ui: display the module title instead of its portal type

Improve consistency with document view
parent 940d9917
......@@ -24,7 +24,7 @@
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/wait_for_content_loaded" />
<tr>
<td>assertElementPresent</td>
<td>//a[@data-i18n='Support Request Module']</td>
<td>//a[@data-i18n='Support Requests']</td>
<td></td>
</tr>
<tr>
......
......@@ -78,7 +78,7 @@
<tr>
<td>assertElementPresent</td>
<td>//h1/a[@data-i18n="Support Request Module"]</td>
<td>//h1/a[@data-i18n="Support Requests"]</td>
<td></td>
</tr>
......
......@@ -10,19 +10,23 @@
///////////////////////////////
function calculateSynchronousPageTitle(gadget, erp5_document) {
var title = erp5_document.title,
portal_type = erp5_document._links.type.name;
if (/ Module$/.test(erp5_document._links.type.href)) {
return portal_type;
}
if (erp5_document.hasOwnProperty('_embedded') &&
portal_type = erp5_document._links.type.name,
is_module = / Module$/.test(erp5_document._links.type.href);
if ((!is_module) &&
erp5_document.hasOwnProperty('_embedded') &&
erp5_document._embedded.hasOwnProperty('_view') &&
erp5_document._embedded._view.hasOwnProperty('_links') &&
erp5_document._embedded._view._links.hasOwnProperty('traversed_document')) {
// When refreshing the page (after Base_edit), only the form content is recalculated
// and erp5_document.title may contain the old title value.
// Get the title value from the calculated form if possible
// No need to do this for module, which do not use Base_edit
title = erp5_document._embedded._view._links.traversed_document.title;
}
if (is_module) {
return title;
}
return portal_type + ': ' + title;
}
......
......@@ -234,7 +234,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>979.58035.58376.38417</string> </value>
<value> <string>984.43757.43474.9898</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -252,7 +252,7 @@
</tuple>
<state>
<tuple>
<float>1574157261.21</float>
<float>1592560913.76</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -98,8 +98,8 @@
</tr>
<tr>
<td>waitForElementPresent</td>
<td>//a[@data-i18n='Foo Module']</td>
<td>assertElementPresent</td>
<td>//a[text()='Foos']</td>
<td></td>
</tr>
......@@ -118,4 +118,4 @@
</tbody></table>
</body>
</html>
\ No newline at end of file
</html>
......@@ -33,11 +33,11 @@
<!-- Header has a link to the previous history entry -->
<tr>
<td>assertElementPresent</td>
<td>//div[@data-gadget-scope='header']//a[text()='Foo Module' and contains(@href, '#!cancel_dialog_with_history')]</td>
<td>//div[@data-gadget-scope='header']//a[text()='Foos' and contains(@href, '#!cancel_dialog_with_history')]</td>
<td></td>
</tr>
<tal:block tal:define="click_configuration python: {'text': 'Foo Module'}">
<tal:block tal:define="click_configuration python: {'text': 'Foos'}">
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/click_on_header_link" />
</tal:block>
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/wait_for_content_loaded" />
......
<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 Workflow Transition with Invalid Form</title>
</head>
<body>
<table cellpadding="1" cellspacing="1" border="1">
<thead>
<tr><td rowspan="1" colspan="3">Test dialog with multiple forms</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</td>
<td></td>
</tr>
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/wait_for_app_loaded" />
<tal:block tal:define="search_query python: 'foobar from module1'">
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/search_in_form_list" />
</tal:block>
<tal:block tal:define="click_configuration python: {'text': 'Actions'}">
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/click_on_header_link" />
</tal:block>
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/wait_for_content_loaded" />
<tal:block tal:define="click_configuration python: {'text': 'Other Context'}">
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/click_on_page_link" />
</tal:block>
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/wait_for_content_loaded" />
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/submit_dialog" />
<tal:block tal:define="notification_configuration python: {'class': 'success',
'text': 'bar_module'}">
<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 colspan="3"><b>Redirected to Bar Module</b></td>
</tr>
<tal:block tal:define="click_configuration python: {'text': 'Bars'}">
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/click_on_header_link" />
</tal:block>
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/wait_for_content_loaded" />
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/wait_for_listbox_loaded" />
<tal:block tal:define="parsed_query python: '';
search_query python: 'foobar from module1'">
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/check_search_in_form_list" />
</tal:block>
</tbody></table>
</body>
</html>
\ No newline at end of file
......@@ -41,12 +41,12 @@
</tr>
<tr>
<td>assertTextPresent</td>
<td>Foo Module</td>
<td>Foos</td>
<td></td>
</tr>
<tr>
<td>assertTextNotPresent</td>
<td>Bar Module</td>
<td>Bars</td>
<td></td>
</tr>
<tr>
......@@ -63,16 +63,11 @@
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/wait_for_content_loaded" />
<tr>
<td colspan="3"><b>Redireted to Bar Module</b></td>
</tr>
<tr>
<td>assertTextNotPresent</td>
<td>Foo Module</td>
<td></td>
<td colspan="3"><b>Redirected to Bar Module</b></td>
</tr>
<tr>
<td>assertTextPresent</td>
<td>Bar Module</td>
<td>Foos and Bars</td>
<td></td>
</tr>
<tr>
......
......@@ -32,12 +32,12 @@
<!-- Header has a link to the front page -->
<tr>
<td>assertElementPresent</td>
<td>//div[@data-gadget-scope='header']//a[text()='Foo Module' and contains(@href, '#!display')]</td>
<td>//div[@data-gadget-scope='header']//a[text()='Foos' and contains(@href, '#!history_previous')]</td>
<td></td>
</tr>
<tr>
<td>click</td>
<td>//div[@data-gadget-scope='header']//a[text()='Foo Module' and contains(@href, '#!display')]</td>
<td>//div[@data-gadget-scope='header']//a[text()='Foos' and contains(@href, '#!history_previous')]</td>
<td></td>
</tr>
<tr>
......@@ -48,4 +48,4 @@
</tbody></table>
</body>
</html>
\ No newline at end of file
</html>
......@@ -42,19 +42,19 @@
</tr>
<tr>
<td>assertTextPresent</td>
<td>Foo Module</td>
<td>Foos</td>
<td></td>
</tr>
<!-- Generate back link -->
<tr>
<td>assertElementPresent</td>
<td>//div[@data-gadget-scope='header']//a[text()='Foo Module' and contains(@href, '#!cancel_dialog_with_history')]</td>
<td>//div[@data-gadget-scope='header']//a[text()='Foos' and contains(@href, '#!cancel_dialog_with_history')]</td>
<td></td>
</tr>
<!-- Follow back link -->
<tal:block tal:define="click_configuration python: {'text': 'Foo Module'}">
<tal:block tal:define="click_configuration python: {'text': 'Foos'}">
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/click_on_header_link" />
</tal:block>
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/wait_for_content_loaded" />
......
......@@ -57,7 +57,7 @@
</tr>
<tr>
<td>waitForTextPresent</td>
<td>Foo Module</td>
<td>Foos</td>
<td></td>
</tr>
......
......@@ -109,7 +109,7 @@
</tr>
<tr>
<td>assertTextNotPresent</td>
<td>Foo Module</td>
<td>Foos</td>
<td></td>
</tr>
<tr>
......
......@@ -411,7 +411,7 @@
<tr>
<td>waitForTextPresent</td>
<td>Foo Module</td>
<td>Foos</td>
<td></td>
</tr>
......
......@@ -44,11 +44,11 @@
<tr>
<td>assertElementPresent</td>
<td>//div[@data-gadget-scope='header']//a[text()='Foo Module' and contains(@href, '#!cancel_dialog_with_history') and contains(@href, 'p.cancel=%7B%22extended_search')]</td>
<td>//div[@data-gadget-scope='header']//a[text()='Foos' and contains(@href, '#!cancel_dialog_with_history') and contains(@href, 'p.cancel=%7B%22extended_search')]</td>
<td></td>
</tr>
<tal:block tal:define="click_configuration python: {'text': 'Foo Module'}">
<tal:block tal:define="click_configuration python: {'text': 'Foos'}">
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/click_on_header_link" />
</tal:block>
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/wait_for_content_loaded" />
......
......@@ -44,7 +44,7 @@
<tr>
<td>assertElementPresent</td>
<td>//div[@data-gadget-scope='header']//a[text()='Foo Module' and contains(@href, '#!cancel_dialog_with_history') and contains(@href, 'p.cancel=%7B%22extended_search')]</td>
<td>//div[@data-gadget-scope='header']//a[text()='Foos' and contains(@href, '#!cancel_dialog_with_history') and contains(@href, 'p.cancel=%7B%22extended_search')]</td>
<td></td>
</tr>
......
......@@ -57,7 +57,7 @@
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/wait_for_content_loaded" />
<tr>
<td>waitForTextPresent</td>
<td>Foo Module</td>
<td>Foos</td>
<td></td>
</tr>
......
......@@ -55,7 +55,7 @@
<tr>
<td>assertElementPresent</td>
<td>//div[@data-gadget-scope='header']//a[text()='Foo Module' and contains(@href, '#!cancel_dialog_with_history') and contains(@href, 'p.cancel=%7B%22extended_search')]</td>
<td>//div[@data-gadget-scope='header']//a[text()='Foos' and contains(@href, '#!cancel_dialog_with_history') and contains(@href, 'p.cancel=%7B%22extended_search')]</td>
<td></td>
</tr>
......
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