Fixes: Legacy dialogs couldnt close

This commit is contained in:
perploug
2013-09-18 13:09:40 +02:00
parent 9e7cd28ab4
commit 445e749372
2 changed files with 26 additions and 18 deletions

View File

@@ -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) {

View File

@@ -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 = $("<iframe auto-scale='0' src='" + dialog.template + "' style='width: 100%; height: 100%;'></iframe>");
var html = $("<iframe auto-scale='0' src='" + dialog.template + "' style='border: none; width: 100%; height: 100%;'></iframe>");
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);