Commit 04639363 authored by Nicolas Wavrant's avatar Nicolas Wavrant

erp5_web_renderjs_ui: allow to keep current page in history on redirect

parent 4a7c43e8
...@@ -102,8 +102,12 @@ ...@@ -102,8 +102,12 @@
////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////
// Change URL functions // Change URL functions
////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////
function synchronousChangeState(hash) { function synchronousChangeState(hash, push_history) {
window.location.replace(hash); if (push_history) {
window.location = hash;
} else {
window.location.replace(hash);
}
// Prevent execution of all next asynchronous code // Prevent execution of all next asynchronous code
throw new RSVP.CancellationError('Redirecting to ' + hash); throw new RSVP.CancellationError('Redirecting to ' + hash);
} }
...@@ -970,14 +974,14 @@ ...@@ -970,14 +974,14 @@
return hash; return hash;
}) })
.declareMethod('redirect', function (options) { .declareMethod('redirect', function (options, push_history) {
this.props.form_content = options.form_content; this.props.form_content = options.form_content;
// XXX Should we make it a second method parameter // XXX Should we make it a second method parameter
this.props.keep_message = true; this.props.keep_message = true;
delete options.form_content; delete options.form_content;
return this.getCommandUrlFor(options) return this.getCommandUrlFor(options)
.push(function (hash) { .push(function (hash) {
return synchronousChangeState(hash); return synchronousChangeState(hash, push_history);
}); });
}) })
......
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