diff --git a/ui-eln-lims/src/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/controllers/MainController.js b/ui-eln-lims/src/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/controllers/MainController.js index d121a757f234311a5f1a872b6c145d30f15fec50..52967707541516dfa81958e7d5074b15ac8a35f6 100644 --- a/ui-eln-lims/src/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/controllers/MainController.js +++ b/ui-eln-lims/src/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/controllers/MainController.js @@ -377,22 +377,31 @@ function MainController(profile) { this.changeView = function(newViewChange, arg, shouldStateBePushToHistory) { this._changeView(newViewChange, arg, true, shouldStateBePushToHistory); } + this._changeView = function(newViewChange, arg, shouldURLBePushToHistory, shouldStateBePushToHistory) { LayoutManager.isBlocked = false; + var _this = this; + var _next = function() { + Util.unblockUI(); + _this._changeViewNext(newViewChange, arg, shouldURLBePushToHistory, shouldStateBePushToHistory); + } // // Dirty forms management, to avoid loosing changes. // var discardChanges = null; - if( this.currentView && - this.currentView.isDirty && + if( this.currentView && + this.currentView.isDirty && this.currentView.isDirty()) { //Ask the user if wants to leave the view in case is dirty - discardChanges = window.confirm("Leaving this window will discard any changes, are you sure?"); - } - - if(discardChanges != null && !discardChanges) { - return; + Util.blockUIConfirm("Leaving this window will discard any changes, are you sure?", _next, null /* Do nothing */); + } else { + _next(); } + } + + this._changeViewNext = function(newViewChange, arg, shouldURLBePushToHistory, shouldStateBePushToHistory) { + LayoutManager.isBlocked = false; + // // Finalize view, used to undo mayor modifications to how layout and events are handled //