From 2e50b3f8ee69ee57c243a68a5ca00deb0816d870 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Fri, 15 Sep 2017 19:44:49 +0200 Subject: [PATCH] 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 --- src/sao.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/sao.js b/src/sao.js index b7f8ba5e1d..5a80bc3647 100644 --- a/src/sao.js +++ b/src/sao.js @@ -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))