Commit 08260ec3 authored by Romain Courteaud's avatar Romain Courteaud

erp5_web_renderjs_ui: display the module title instead of its portal type

Improve consistency with document view
parent 4b4e13f1
......@@ -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>980.25643.17614.37256</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>1584026863.34</float>
<float>1592560913.76</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -79,7 +79,7 @@
<tr>
<td>assertElementPresent</td>
<td>//a[text()='Foo Module']</td>
<td>//a[text()='Foos']</td>
<td></td>
</tr>
......
......@@ -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" />
......
......@@ -42,7 +42,7 @@
<td colspan="3"><b>Redirected to Bar Module</b></td>
</tr>
<tal:block tal:define="click_configuration python: {'text': 'Bar Module'}">
<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" />
......
......@@ -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>
......
......@@ -34,12 +34,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, '#!history_previous')]</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, '#!history_previous')]</td>
<td>//div[@data-gadget-scope='header']//a[text()='Foos' and contains(@href, '#!history_previous')]</td>
<td></td>
</tr>
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/wait_for_content_loaded" />
......
......@@ -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>
......
......@@ -408,7 +408,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