Commit 87bae553 authored by Jérome Perrin's avatar Jérome Perrin

officejs_support_request_ui: show jump actions in panel

For consistency with default ERP5JS and because it's convinient to have the
jump here, to access the document tab that is now a jump action.
parent 4d5d4c93
Pipeline #16512 passed with stage
in 0 seconds
......@@ -58,6 +58,12 @@
<a data-i18n="{{title}}" class="ui-body-inherit" href="{{href}}">{{title}}</a>
</dd>
{{/each}}
<dt class="ui-content-title ui-body-c ui-btn ui-btn-icon-left ui-icon-plane" data-i18n="Jumps">Jumps</dt>
{{#each jump_list}}
<dd data-role="listview" data-theme="c" data-inset="true" class="document-listview">
<a data-i18n="{{title}}" class="ui-body-inherit" href="{{href}}">{{title}}</a>
</dd>
{{/each}}
</script>
<!-- custom script -->
......
......@@ -256,7 +256,7 @@
</tuple>
<state>
<tuple>
<float>1593352275.81</float>
<float>1625463570.56</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -50,24 +50,31 @@
.declareMethod('render', function (options) {
var erp5_document = options.erp5_document,
workflow_list,
view_list;
view_list,
jump_list;
if (erp5_document !== undefined) {
workflow_list = erp5_document._links.action_workflow || [];
view_list = erp5_document._links.action_object_view || [];
jump_list = erp5_document._links.action_object_jio_jump || [];
if (workflow_list.constructor !== Array) {
workflow_list = [workflow_list];
}
if (view_list.constructor !== Array) {
view_list = [view_list];
}
// Prevent has much as possible to modify the DOM panel
if (jump_list.constructor !== Array) {
jump_list = [jump_list];
}
// Prevent as much as possible to modify the DOM panel
// stateChange prefer to compare strings
workflow_list = JSON.stringify(workflow_list);
view_list = JSON.stringify(view_list);
jump_list = JSON.stringify(jump_list);
}
return this.changeState({
workflow_list: workflow_list,
view_list: view_list,
jump_list: jump_list,
global: true,
editable: options.editable
});
......@@ -134,7 +141,8 @@
(modification_dict.hasOwnProperty("desktop") ||
modification_dict.hasOwnProperty("editable") ||
modification_dict.hasOwnProperty("workflow_list") ||
modification_dict.hasOwnProperty("view_list"))) {
modification_dict.hasOwnProperty("view_list") ||
modification_dict.hasOwnProperty("jump_list"))) {
if (!(this.state.desktop && (this.state.view_list !== undefined))) {
queue
.push(function () {
......@@ -146,7 +154,8 @@
var i = 0,
promise_list = [],
workflow_list = JSON.parse(gadget.state.workflow_list),
view_list = JSON.parse(gadget.state.view_list);
view_list = JSON.parse(gadget.state.view_list),
jump_list = JSON.parse(gadget.state.jump_list);
for (i = 0; i < workflow_list.length; i += 1) {
promise_list.push(
......@@ -170,15 +179,27 @@
})
);
}
for (i = 0; i < jump_list.length; i += 1) {
promise_list.push(
gadget.getUrlFor({
command: 'change',
options: {
view: jump_list[i].href,
page: undefined
}
})
);
}
return RSVP.all(promise_list);
})
.push(function (result_list) {
var i,
result_workflow_list = [],
result_view_list = [],
result_jump_list = [],
workflow_list = JSON.parse(gadget.state.workflow_list),
view_list = JSON.parse(gadget.state.view_list);
view_list = JSON.parse(gadget.state.view_list),
jump_list = JSON.parse(gadget.state.jump_list);
for (i = 0; i < workflow_list.length; i += 1) {
result_workflow_list.push({
title: workflow_list[i].title,
......@@ -191,10 +212,17 @@
href: result_list[i + workflow_list.length]
});
}
for (i = 0; i < jump_list.length; i += 1) {
result_jump_list.push({
title: jump_list[i].title,
href: result_list[i + workflow_list.length + view_list.length]
});
}
return gadget.translateHtml(
panel_template_body_desktop({
workflow_list: result_workflow_list,
view_list: result_view_list
view_list: result_view_list,
jump_list: result_jump_list
})
).push(function (my_translated_or_plain_html) {
gadget.element.querySelector("dl").innerHTML = my_translated_or_plain_html;
......
......@@ -258,7 +258,7 @@
</tuple>
<state>
<tuple>
<float>1613149288.51</float>
<float>1625467130.12</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -236,6 +236,73 @@
<td></td>
</tr>
</tal:block>
<!-- Attached documents can also be found from "Documents" action -->
<tal:block tal:define="click_configuration python: {'text': 'Views'}">
<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': 'Documents'}">
<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 tal:define="notification_configuration python: {'class': 'success',
'text': 'Documents related to Support Request : test.'}">
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/wait_for_notification" />
</tal:block>
<!-- dismiss this notification, because we'll have another one later. -->
<tr>
<td>click</td>
<td>//div[@data-gadget-scope='notification' and @class='visible']//button</td>
<td></td>
</tr>
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/wait_for_no_notification" />
<tr>
<td>waitForTextPresent</td>
<td>test_support_request_text</td>
<td></td>
</tr>
<tr>
<td>waitForTextPresent</td>
<td>test_support_request_text</td>
<td></td>
</tr>
<!-- on "desktop", this is always visible from the main view -->
<!-- fake a large enough screen -->
<tr>
<td>getEval</td>
<td>
window.matchMedia = function () {return {matches:true}};
event = document.createEvent("Event");
event.initEvent('resize', true, true);
window.dispatchEvent(event);
</td>
<td></td>
</tr>
<tr>
<td>waitForElementPresent</td>
<td>//div[@data-gadget-scope="panel"]//a[@data-i18n="Documents"]</td>
<td></td>
</tr>
<tr>
<td>click</td>
<td>//div[@data-gadget-scope="panel"]//a[@data-i18n="Documents"]</td>
<td></td>
</tr>
<tal:block tal:define="notification_configuration python: {'class': 'success',
'text': 'Documents related to Support Request : test.'}">
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/wait_for_notification" />
</tal:block>
<tr>
<td>waitForTextPresent</td>
<td>test_support_request_text</td>
<td></td>
</tr>
</tbody>
</table>
</body>
......
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