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