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