Commit 2419299d authored by Romain Courteaud's avatar Romain Courteaud

erp5_web_renderjs_ui: fix history previous in case of no history and no jio_key

parent 54a73770
......@@ -649,6 +649,12 @@
});
}
function redirectToHomePage(gadget, previous_options) {
var options = {};
copyStickyParameterDict(previous_options, options);
return gadget.redirect({command: 'display', options: options});
}
function redirectToParent(gadget, jio_key, previous_options) {
return gadget.jio_getAttachment(jio_key, "links")
.push(function (erp5_document) {
......@@ -667,9 +673,7 @@
}, function (error) {
if ((error instanceof jIO.util.jIOError) &&
(error.status_code === 404)) {
var options = {};
copyStickyParameterDict(previous_options, options);
return gadget.redirect({command: 'display', options: options});
return redirectToHomePage(gadget, previous_options);
}
throw error;
});
......@@ -683,9 +687,10 @@
queue = new RSVP.Queue(),
previous_id;
if (history === undefined) {
if (jio_key !== undefined) {
return redirectToParent(gadget, jio_key, previous_options);
if (jio_key === undefined) {
return redirectToHomePage(gadget, previous_options);
}
return redirectToParent(gadget, jio_key, previous_options);
}
// XXX XXX XXX
if (previous_options.back_field) {
......
......@@ -236,7 +236,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>989.17133.23517.28876</string> </value>
<value> <string>989.17139.27691.33245</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -254,7 +254,7 @@
</tuple>
<state>
<tuple>
<float>1610357005.28</float>
<float>1610357319.16</float>
<string>UTC</string>
</tuple>
</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