Commit 718a229c authored by Romain Courteaud's avatar Romain Courteaud

erp5_web_renderjs_ui: display jump action in the panel

parent 1f2b8971
...@@ -17,6 +17,7 @@ ...@@ -17,6 +17,7 @@
data-i18n=Views data-i18n=Views
data-i18n=Workflows data-i18n=Workflows
data-i18n=Actions data-i18n=Actions
data-i18n=Jumps
--> -->
<!-- renderjs --> <!-- renderjs -->
......
...@@ -238,7 +238,7 @@ ...@@ -238,7 +238,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>979.2850.38922.48298</string> </value> <value> <string>985.48809.10432.44578</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -256,7 +256,7 @@ ...@@ -256,7 +256,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1589291863.85</float> <float>1596701351.5</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
...@@ -66,6 +66,7 @@ ...@@ -66,6 +66,7 @@
workflow_list, workflow_list,
view_list, view_list,
action_list, action_list,
jump_list,
i; i;
if (visible === undefined) { if (visible === undefined) {
...@@ -84,6 +85,7 @@ ...@@ -84,6 +85,7 @@
action_list = ensureArray(erp5_document._links.action_object_jio_action) action_list = ensureArray(erp5_document._links.action_object_jio_action)
.concat(ensureArray(erp5_document._links.action_object_jio_button)) .concat(ensureArray(erp5_document._links.action_object_jio_button))
.concat(ensureArray(erp5_document._links.action_object_jio_fast_input)); .concat(ensureArray(erp5_document._links.action_object_jio_fast_input));
jump_list = ensureArray(erp5_document._links.action_object_jio_jump);
if (view === 'view') { if (view === 'view') {
for (i = 0; i < view_list.length; i += 1) { for (i = 0; i < view_list.length; i += 1) {
...@@ -99,12 +101,16 @@ ...@@ -99,12 +101,16 @@
for (i = 0; i < action_list.length; i += 1) { for (i = 0; i < action_list.length; i += 1) {
action_list[i].class_name = action_list[i].href === view ? 'active' : ''; action_list[i].class_name = action_list[i].href === view ? 'active' : '';
} }
for (i = 0; i < jump_list.length; i += 1) {
jump_list[i].class_name = jump_list[i].href === view ? 'active' : '';
}
} }
// Prevent has much as possible to modify the DOM panel // Prevent has much as possible to modify the DOM panel
// stateChange prefer to compare strings // stateChange prefer to compare strings
workflow_list = JSON.stringify(workflow_list); workflow_list = JSON.stringify(workflow_list);
view_list = JSON.stringify(view_list); view_list = JSON.stringify(view_list);
action_list = JSON.stringify(action_list); action_list = JSON.stringify(action_list);
jump_list = JSON.stringify(jump_list);
} }
return context.getUrlParameter('editable') return context.getUrlParameter('editable')
.push(function (editable) { .push(function (editable) {
...@@ -114,6 +120,7 @@ ...@@ -114,6 +120,7 @@
workflow_list: workflow_list, workflow_list: workflow_list,
view_list: view_list, view_list: view_list,
action_list: action_list, action_list: action_list,
jump_list: jump_list,
global: true, global: true,
jio_key: jio_key, jio_key: jio_key,
editable: asBoolean(options.editable) || asBoolean(editable) || false editable: asBoolean(options.editable) || asBoolean(editable) || false
...@@ -234,6 +241,7 @@ ...@@ -234,6 +241,7 @@
(modification_dict.hasOwnProperty("editable") || (modification_dict.hasOwnProperty("editable") ||
modification_dict.hasOwnProperty("workflow_list") || modification_dict.hasOwnProperty("workflow_list") ||
modification_dict.hasOwnProperty("action_list") || modification_dict.hasOwnProperty("action_list") ||
modification_dict.hasOwnProperty("jump_list") ||
modification_dict.hasOwnProperty("jio_key") || modification_dict.hasOwnProperty("jio_key") ||
modification_dict.hasOwnProperty("view_list"))) { modification_dict.hasOwnProperty("view_list"))) {
if (this.state.view_list === undefined) { if (this.state.view_list === undefined) {
...@@ -244,7 +252,8 @@ ...@@ -244,7 +252,8 @@
var i = 0, var i = 0,
parameter_list = [], parameter_list = [],
view_list = JSON.parse(gadget.state.view_list), view_list = JSON.parse(gadget.state.view_list),
action_list = JSON.parse(gadget.state.action_list); action_list = JSON.parse(gadget.state.action_list),
jump_list = JSON.parse(gadget.state.jump_list);
workflow_list = JSON.parse(gadget.state.workflow_list); workflow_list = JSON.parse(gadget.state.workflow_list);
for (i = 0; i < view_list.length; i += 1) { for (i = 0; i < view_list.length; i += 1) {
...@@ -274,16 +283,27 @@ ...@@ -274,16 +283,27 @@
} }
}); });
} }
for (i = 0; i < jump_list.length; i += 1) {
parameter_list.push({
command: 'display_dialog_with_history',
options: {
jio_key: gadget.state.jio_key,
view: jump_list[i].href
}
});
}
return RSVP.all([ return RSVP.all([
gadget.getUrlForList(parameter_list), gadget.getUrlForList(parameter_list),
gadget.getTranslationList(['Views', 'Workflows', 'Actions']) gadget.getTranslationList(['Views', 'Workflows', 'Actions',
'Jumps'])
]); ]);
}) })
.push(function (result_list) { .push(function (result_list) {
var dl_element, var dl_element,
dl_fragment = document.createDocumentFragment(), dl_fragment = document.createDocumentFragment(),
view_list = JSON.parse(gadget.state.view_list), view_list = JSON.parse(gadget.state.view_list),
action_list = JSON.parse(gadget.state.action_list); action_list = JSON.parse(gadget.state.action_list),
jump_list = JSON.parse(gadget.state.jump_list);
appendDt(dl_fragment, result_list[1][0], 'eye', appendDt(dl_fragment, result_list[1][0], 'eye',
view_list, result_list[0], 0); view_list, result_list[0], 0);
...@@ -295,6 +315,10 @@ ...@@ -295,6 +315,10 @@
appendDt(dl_fragment, result_list[1][2], 'cogs', appendDt(dl_fragment, result_list[1][2], 'cogs',
action_list, result_list[0], action_list, result_list[0],
view_list.length + workflow_list.length); view_list.length + workflow_list.length);
appendDt(dl_fragment, result_list[1][3], 'plane',
jump_list, result_list[0],
view_list.length + workflow_list.length +
action_list.length);
dl_element = gadget.element.querySelector("dl"); dl_element = gadget.element.querySelector("dl");
while (dl_element.firstChild) { while (dl_element.firstChild) {
......
...@@ -234,7 +234,7 @@ ...@@ -234,7 +234,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>975.56491.25907.38877</string> </value> <value> <string>986.32404.49746.11571</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>1558448423.72</float> <float>1600352235.33</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
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