Commit 07c84e19 authored by Romain Courteaud's avatar Romain Courteaud

[erp5_web_renderjs_ui] Router: do not translate during startup if not needed

This prevent to load the translation gadget during the page load
parent c544623c
......@@ -624,6 +624,7 @@
return redirectToParent(gadget, jio_key, previous_options);
}
}
// XXX XXX XXX
if (previous_options.back_field) {
queue
.push(function () {
......@@ -915,11 +916,21 @@
//execute an url command without saving
if (gadget.props.modified && command[0] === PREFIX_COMMAND && !gadget.props.form_content) {
if (!window.confirm(gadget.props.warning_message)) {
//back to previous hash
gadget.props.hasUnsaved = true;
return synchronousChangeState(evt.oldURL);
}
return gadget.translate(
"This page contains unsaved changes, do you really want to leave the page ?"
)
.push(function (warning_message) {
if (window.confirm(warning_message)) {
return gadget.route({
method: command[0],
path: command.substr(1),
args: args
});
}
//back to previous hash
gadget.props.hasUnsaved = true;
return synchronousChangeState(evt.oldURL);
});
}
//don't rerender old page when back to the previous hash
if (gadget.props.hasUnsaved) {
......@@ -1075,8 +1086,7 @@
return RSVP.all([
gadget.getSetting("selected_language"),
gadget.getSetting("default_selected_language"),
gadget.getSetting("language_map"),
gadget.translate("This page contains unsaved changes, do you really want to leave the page ?")
gadget.getSetting("language_map")
]);
})
.push(function (results) {
......@@ -1088,7 +1098,6 @@
}
});
}
gadget.props.warning_message = results[3];
return gadget.listenHashChange();
})
.push(undefined, function (error) {
......
......@@ -232,7 +232,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>971.10497.43311.42888</string> </value>
<value> <string>971.50995.42315.11776</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -250,7 +250,7 @@
</tuple>
<state>
<tuple>
<float>1540805313.26</float>
<float>1543248439.12</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