diff --git a/src/Umbraco.Web.UI.Client/lib/umbraco/LegacyUmbClientMgr.js b/src/Umbraco.Web.UI.Client/lib/umbraco/LegacyUmbClientMgr.js
index 1933a22727..5ff0db913a 100644
--- a/src/Umbraco.Web.UI.Client/lib/umbraco/LegacyUmbClientMgr.js
+++ b/src/Umbraco.Web.UI.Client/lib/umbraco/LegacyUmbClientMgr.js
@@ -243,10 +243,14 @@ Umbraco.Sys.registerNamespace("Umbraco.Application");
}
//just call the native dialog close() method to remove the dialog
- lastModal.scope.close();
+ lastModal.close();
}
else {
- dialogService.closeAll(rVal);
+ //instead of calling just the dialog service we funnel it through the global
+ //event emitter
+ getRootScope().$emit("closeDialogs", event);
+
+ //dialogService.closeAll(rVal);
}
},
_debug: function(strMsg) {
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 b0186354d2..af086eb608 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
@@ -37,7 +37,7 @@ angular.module('umbraco.services')
function removeAllDialogs(args) {
for (var i = 0; i < dialogs.length; i++) {
var dialog = dialogs[i];
- dialog.scope.close(args);
+ dialog.close(args);
//removeDialog(dialog, args);
dialogs.splice(i, 1);
@@ -93,18 +93,7 @@ angular.module('umbraco.services')
}, 500);
- //basic events for submitting and closing
- scope.submit = function(data) {
- if (dialog.callback) {
- dialog.callback(data);
- }
-
- dialog.element.modal('hide');
- dialog.element.remove();
- $("#" + dialog.element.attr("id")).remove();
- };
-
- scope.close = function(data) {
+ dialog.close = function(data) {
if (dialog.closeCallback) {
dialog.closeCallback(data);
}
@@ -118,7 +107,7 @@ angular.module('umbraco.services')
//if iframe is enabled, inject that instead of a template
if (dialog.iframe) {
- var html = $("");
+ var html = $("");
dialog.element.html(html);
//append to body or whatever element is passed in as options.containerElement
@@ -179,6 +168,21 @@ angular.module('umbraco.services')
$("#" + dialog.element.attr("id")).remove();
};
+ //basic events for submitting and closing
+ scope.submit = function(data) {
+ if (dialog.callback) {
+ dialog.callback(data);
+ }
+
+ dialog.element.modal('hide');
+ dialog.element.remove();
+ $("#" + dialog.element.attr("id")).remove();
+ };
+
+ scope.close = function(data) {
+ dialog.close(data);
+ };
+
scope.show = function() {
dialog.element.modal('show');
};
@@ -261,8 +265,8 @@ angular.module('umbraco.services')
* @param {Object} args if specified this object will be sent to any callbacks registered on the dialogs.
*/
close: function (dialog, args) {
- if(dialog && dialog.scope){
- dialog.scope.close();
+ if(dialog){
+ dialog.close();
}
//removeDialog(dialog, args);