Ask confirmation to unload the page

If there are any tabs open, we should ask confirmation to prevent user to
loose unsaved data.
We should also save the tree state of the menu like it is done on logout.

issue6756
review44301002
This commit is contained in:
Cédric Krier committed 2017-09-15 19:44:49 +02:00
1 parent 3f09fb349a
commit 2e50b3f8ee
1 file changed
+11
+11
View File
@@ -80,6 +80,17 @@ var Sao = {};
})()
});
window.onbeforeunload = function(e) {
if (Sao.main_menu_screen) {
Sao.main_menu_screen.save_tree_state(true);
}
if (Sao.Tab.tabs.length) {
var dialog = Sao.i18n.gettext("Are your sure to leave?");
e.returnValue = dialog;
return dialog;
}
};
Sao.class_ = function(Parent, props) {
var ClassConstructor = function() {
if (!(this instanceof ClassConstructor))