X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=js%2Fcrm.ajax.js;h=02a4a6312b041409efbeed994bee7c78a40864a0;hb=0beba0f4d9181ca86917d32432fb4897a21547a3;hp=8a8e74cc49e60a72bbb73228a208c57f74369386;hpb=4c12c9b771bde931077f56685b632bd34504b238;p=civicrm-core.git diff --git a/js/crm.ajax.js b/js/crm.ajax.js index 8a8e74cc49..02a4a6312b 100644 --- a/js/crm.ajax.js +++ b/js/crm.ajax.js @@ -252,9 +252,6 @@ var that = this; var url = this._formatUrl(this.options.url); if (this.options.crmForm) $('form', this.element).ajaxFormUnbind(); - if (this._originalContent === null) { - this._originalContent = this.element.contents().detach(); - } if (this.options.block) this.element.block(); $.getJSON(url, function(data) { if (that.options.block) that.element.unblock(); @@ -280,6 +277,11 @@ // Perform any cleanup needed before removing/replacing content _beforeRemovingContent: function() { var that = this; + // Save original content to be restored if widget is destroyed + if (this._originalContent === null) { + $('.blockUI', this.element).remove(); + this._originalContent = this.element.contents().detach(); + } if (window.tinyMCE && tinyMCE.editors) { $.each(tinyMCE.editors, function(k) { if ($.contains(that.element[0], this.getElement())) { @@ -311,10 +313,12 @@ // Create new dialog if (settings.dialog) { settings.dialog = CRM.utils.adjustDialogDefaults(settings.dialog); - $('
' + ts('Loading') + '...
').dialog(settings.dialog); + $('
').dialog(settings.dialog); + } + if ($(settings.target).data('uiDialog')) { $(settings.target) .on('dialogclose', function() { - if ($(this).attr('data-unsaved-changes') !== 'true') { + if (settings.dialog && $(this).attr('data-unsaved-changes') !== 'true') { $(this).crmSnippet('destroy').dialog('destroy').remove(); } })