From 2ef0b1d56e58d861576f8fc140686727e792cbea Mon Sep 17 00:00:00 2001 From: Per Ploug Krogslund Date: Thu, 8 Aug 2013 16:01:21 +0200 Subject: [PATCH] Fixes dialog closing too fast --- .../src/common/services/dialog.service.js | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/Umbraco.Web.UI.Client/src/common/services/dialog.service.js b/src/Umbraco.Web.UI.Client/src/common/services/dialog.service.js index 5ffd67efad..1e75bae95d 100644 --- a/src/Umbraco.Web.UI.Client/src/common/services/dialog.service.js +++ b/src/Umbraco.Web.UI.Client/src/common/services/dialog.service.js @@ -29,8 +29,7 @@ */ angular.module('umbraco.services') -.factory('dialogService', ['$rootScope', '$compile', '$http', '$timeout', '$q', '$templateCache', - function ($rootScope, $compile, $http, $timeout, $q, $templateCache) { +.factory('dialogService', function ($rootScope, $compile, $http, $timeout, $q, $templateCache, $log) { var dialogs = []; @@ -49,12 +48,13 @@ angular.module('umbraco.services') $timeout(function () { dialog.remove(); - //$("#" + dialog.attr("id")).remove(); }, 250); } /** Internal method that handles opening all dialogs */ function openDialog(options) { + + if (!options) { options = {}; } @@ -89,8 +89,11 @@ angular.module('umbraco.services') .addClass(modalClass); //push the modal into the global modal collection - dialogs.push($modal); - + //we halt the .push because a link click will trigger a closeAll right away + $timeout(function () { + dialogs.push($modal); + }, 250); + //if iframe is enabled, inject that instead of a template if (options.iframe) { var html = $(""); @@ -190,14 +193,11 @@ angular.module('umbraco.services') if (options.show) { $modal.modal('show'); } - }); //Return the modal object outside of the promise! return $modal; } - - } /** Handles the closeDialogs event */ @@ -363,4 +363,4 @@ angular.module('umbraco.services') }); } }; - }]); \ No newline at end of file + }); \ No newline at end of file