From cd66bbfb0f5706cb177d070a807e4807ca032974 Mon Sep 17 00:00:00 2001 From: Mads Rasmussen Date: Tue, 5 Jan 2016 11:46:02 +0100 Subject: [PATCH] Fixes: U4-7629 Help-dialog doesn't open, when user-dialog is open --- .../application/umbsections.directive.js | 71 +++++++++++-------- .../overlays/umboverlay.directive.js | 6 +- 2 files changed, 44 insertions(+), 33 deletions(-) diff --git a/src/Umbraco.Web.UI.Client/src/common/directives/components/application/umbsections.directive.js b/src/Umbraco.Web.UI.Client/src/common/directives/components/application/umbsections.directive.js index 31b7cb9506..5ce3eac8a0 100644 --- a/src/Umbraco.Web.UI.Client/src/common/directives/components/application/umbsections.directive.js +++ b/src/Umbraco.Web.UI.Client/src/common/directives/components/application/umbsections.directive.js @@ -88,44 +88,54 @@ function sectionsDirective($timeout, $window, navigationService, treeService, se scope.avatarClick = function(){ + if(scope.helpDialog) { + closeHelpDialog(); + } + if(!scope.userDialog) { - - scope.userDialog = {}; - scope.userDialog.view = "user"; - scope.userDialog.show = true; - - scope.userDialog.close = function(oldModel) { - scope.userDialog.show = false; - scope.userDialog = null; + scope.userDialog = { + view: "user", + show: true, + close: function(oldModel) { + closeUserDialog(); + } }; - } else { - scope.userDialog.show = false; - scope.userDialog = null; + closeUserDialog(); } }; + function closeUserDialog() { + scope.userDialog.show = false; + scope.userDialog = null; + } + scope.helpClick = function(){ + if(scope.userDialog) { + closeUserDialog(); + } + if(!scope.helpDialog) { - - scope.helpDialog = {}; - scope.helpDialog.show = true; - scope.helpDialog.view = "help"; - - scope.helpDialog.close = function(oldModel) { - scope.helpDialog.show = false; - scope.helpDialog = null; + scope.helpDialog = { + view: "help", + show: true, + close: function(oldModel) { + closeHelpDialog(); + } }; - } else { - scope.helpDialog.show = false; - scope.helpDialog = null; + closeHelpDialog(); } }; + function closeHelpDialog() { + scope.helpDialog.show = false; + scope.helpDialog = null; + } + scope.sectionClick = function (event, section) { if (event.ctrlKey || @@ -136,12 +146,11 @@ function sectionsDirective($timeout, $window, navigationService, treeService, se return; } - - if (navigationService.userDialog) { - navigationService.userDialog.close(); + if (scope.userDialog) { + closeUserDialog(); } - if (navigationService.helpDialog) { - navigationService.helpDialog.close(); + if (scope.helpDialog) { + closeHelpDialog(); } navigationService.hideSearch(); @@ -155,11 +164,11 @@ function sectionsDirective($timeout, $window, navigationService, treeService, se scope.trayClick = function () { // close dialogs - if (navigationService.userDialog) { - navigationService.userDialog.close(); + if (scope.userDialog) { + closeUserDialog(); } - if (navigationService.helpDialog) { - navigationService.helpDialog.close(); + if (scope.helpDialog) { + closeHelpDialog(); } if (appState.getGlobalState("showTray") === true) { diff --git a/src/Umbraco.Web.UI.Client/src/common/directives/components/overlays/umboverlay.directive.js b/src/Umbraco.Web.UI.Client/src/common/directives/components/overlays/umboverlay.directive.js index 294e2767ac..a76162be24 100644 --- a/src/Umbraco.Web.UI.Client/src/common/directives/components/overlays/umboverlay.directive.js +++ b/src/Umbraco.Web.UI.Client/src/common/directives/components/overlays/umboverlay.directive.js @@ -23,8 +23,6 @@ setButtonText(); - registerOverlay(); - modelCopy = makeModelCopy(scope.model); $timeout(function() { @@ -33,6 +31,10 @@ setTargetPosition(); } + // this has to be done inside a timeout to ensure the destroy + // event on other overlays is run before registering a new one + registerOverlay(); + setOverlayIndent(); });