Commit 77f6a10c 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 41188d39
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/wait_for_content_loaded" /> <tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/wait_for_content_loaded" />
<tr> <tr>
<td>assertElementPresent</td> <td>assertElementPresent</td>
<td>//a[@data-i18n='Support Request Module']</td> <td>//a[@data-i18n='Support Requests']</td>
<td></td> <td></td>
</tr> </tr>
<tr> <tr>
......
...@@ -78,7 +78,7 @@ ...@@ -78,7 +78,7 @@
<tr> <tr>
<td>assertElementPresent</td> <td>assertElementPresent</td>
<td>//h1/a[@data-i18n="Support Request Module"]</td> <td>//h1/a[@data-i18n="Support Requests"]</td>
<td></td> <td></td>
</tr> </tr>
......
...@@ -10,19 +10,23 @@ ...@@ -10,19 +10,23 @@
/////////////////////////////// ///////////////////////////////
function calculateSynchronousPageTitle(gadget, erp5_document) { function calculateSynchronousPageTitle(gadget, erp5_document) {
var title = erp5_document.title, var title = erp5_document.title,
portal_type = erp5_document._links.type.name; portal_type = erp5_document._links.type.name,
if (/ Module$/.test(erp5_document._links.type.href)) { is_module = / Module$/.test(erp5_document._links.type.href);
return portal_type;
} if ((!is_module) &&
if (erp5_document.hasOwnProperty('_embedded') && erp5_document.hasOwnProperty('_embedded') &&
erp5_document._embedded.hasOwnProperty('_view') && erp5_document._embedded.hasOwnProperty('_view') &&
erp5_document._embedded._view.hasOwnProperty('_links') && erp5_document._embedded._view.hasOwnProperty('_links') &&
erp5_document._embedded._view._links.hasOwnProperty('traversed_document')) { erp5_document._embedded._view._links.hasOwnProperty('traversed_document')) {
// When refreshing the page (after Base_edit), only the form content is recalculated // When refreshing the page (after Base_edit), only the form content is recalculated
// and erp5_document.title may contain the old title value. // and erp5_document.title may contain the old title value.
// Get the title value from the calculated form if possible // 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; title = erp5_document._embedded._view._links.traversed_document.title;
} }
if (is_module) {
return title;
}
return portal_type + ': ' + title; return portal_type + ': ' + title;
} }
......
...@@ -234,7 +234,7 @@ ...@@ -234,7 +234,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>980.25643.17614.37256</string> </value> <value> <string>984.43757.43474.9898</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -252,7 +252,7 @@ ...@@ -252,7 +252,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1584026863.34</float> <float>1592560913.76</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
...@@ -79,7 +79,7 @@ ...@@ -79,7 +79,7 @@
<tr> <tr>
<td>assertElementPresent</td> <td>assertElementPresent</td>
<td>//a[text()='Foo Module']</td> <td>//a[text()='Foos']</td>
<td></td> <td></td>
</tr> </tr>
......
...@@ -33,11 +33,11 @@ ...@@ -33,11 +33,11 @@
<!-- Header has a link to the previous history entry --> <!-- Header has a link to the previous history entry -->
<tr> <tr>
<td>assertElementPresent</td> <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> <td></td>
</tr> </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 metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/click_on_header_link" />
</tal:block> </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_content_loaded" />
......
...@@ -42,7 +42,7 @@ ...@@ -42,7 +42,7 @@
<td colspan="3"><b>Redirected to Bar Module</b></td> <td colspan="3"><b>Redirected to Bar Module</b></td>
</tr> </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 metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/click_on_header_link" />
</tal:block> </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_content_loaded" />
......
...@@ -41,12 +41,12 @@ ...@@ -41,12 +41,12 @@
</tr> </tr>
<tr> <tr>
<td>assertTextPresent</td> <td>assertTextPresent</td>
<td>Foo Module</td> <td>Foos</td>
<td></td> <td></td>
</tr> </tr>
<tr> <tr>
<td>assertTextNotPresent</td> <td>assertTextNotPresent</td>
<td>Bar Module</td> <td>Bars</td>
<td></td> <td></td>
</tr> </tr>
<tr> <tr>
...@@ -63,16 +63,11 @@ ...@@ -63,16 +63,11 @@
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/wait_for_content_loaded" /> <tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/wait_for_content_loaded" />
<tr> <tr>
<td colspan="3"><b>Redireted to Bar Module</b></td> <td colspan="3"><b>Redirected to Bar Module</b></td>
</tr>
<tr>
<td>assertTextNotPresent</td>
<td>Foo Module</td>
<td></td>
</tr> </tr>
<tr> <tr>
<td>assertTextPresent</td> <td>assertTextPresent</td>
<td>Bar Module</td> <td>Foos and Bars</td>
<td></td> <td></td>
</tr> </tr>
<tr> <tr>
......
...@@ -34,12 +34,12 @@ ...@@ -34,12 +34,12 @@
<!-- Header has a link to the front page --> <!-- Header has a link to the front page -->
<tr> <tr>
<td>assertElementPresent</td> <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> <td></td>
</tr> </tr>
<tr> <tr>
<td>click</td> <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> <td></td>
</tr> </tr>
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/wait_for_content_loaded" /> <tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/wait_for_content_loaded" />
......
...@@ -42,19 +42,19 @@ ...@@ -42,19 +42,19 @@
</tr> </tr>
<tr> <tr>
<td>assertTextPresent</td> <td>assertTextPresent</td>
<td>Foo Module</td> <td>Foos</td>
<td></td> <td></td>
</tr> </tr>
<!-- Generate back link --> <!-- Generate back link -->
<tr> <tr>
<td>assertElementPresent</td> <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> <td></td>
</tr> </tr>
<!-- Follow back link --> <!-- 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 metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/click_on_header_link" />
</tal:block> </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_content_loaded" />
......
...@@ -57,7 +57,7 @@ ...@@ -57,7 +57,7 @@
</tr> </tr>
<tr> <tr>
<td>waitForTextPresent</td> <td>waitForTextPresent</td>
<td>Foo Module</td> <td>Foos</td>
<td></td> <td></td>
</tr> </tr>
......
...@@ -109,7 +109,7 @@ ...@@ -109,7 +109,7 @@
</tr> </tr>
<tr> <tr>
<td>assertTextNotPresent</td> <td>assertTextNotPresent</td>
<td>Foo Module</td> <td>Foos</td>
<td></td> <td></td>
</tr> </tr>
<tr> <tr>
......
...@@ -408,7 +408,7 @@ ...@@ -408,7 +408,7 @@
<tr> <tr>
<td>waitForTextPresent</td> <td>waitForTextPresent</td>
<td>Foo Module</td> <td>Foos</td>
<td></td> <td></td>
</tr> </tr>
......
...@@ -44,11 +44,11 @@ ...@@ -44,11 +44,11 @@
<tr> <tr>
<td>assertElementPresent</td> <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> <td></td>
</tr> </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 metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/click_on_header_link" />
</tal:block> </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_content_loaded" />
......
...@@ -44,7 +44,7 @@ ...@@ -44,7 +44,7 @@
<tr> <tr>
<td>assertElementPresent</td> <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> <td></td>
</tr> </tr>
......
...@@ -57,7 +57,7 @@ ...@@ -57,7 +57,7 @@
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/wait_for_content_loaded" /> <tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/wait_for_content_loaded" />
<tr> <tr>
<td>waitForTextPresent</td> <td>waitForTextPresent</td>
<td>Foo Module</td> <td>Foos</td>
<td></td> <td></td>
</tr> </tr>
......
...@@ -55,7 +55,7 @@ ...@@ -55,7 +55,7 @@
<tr> <tr>
<td>assertElementPresent</td> <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> <td></td>
</tr> </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