From 217bfb2e8828432180aebe959e1c83e8555ee87e Mon Sep 17 00:00:00 2001 From: Coleman Watts Date: Tue, 2 Feb 2016 22:20:48 -0700 Subject: [PATCH] CRM-17960 - Handle redirects in popups --- js/crm.ajax.js | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/js/crm.ajax.js b/js/crm.ajax.js index 91565ef603..b01e814bf0 100644 --- a/js/crm.ajax.js +++ b/js/crm.ajax.js @@ -240,6 +240,10 @@ if (this.options.crmForm) $('form', this.element).ajaxFormUnbind(); if (this.options.block) this.element.block(); $.getJSON(url, function(data) { + if (data.status === 'redirect') { + that.options.url = data.userContext; + return that.refresh(); + } if (that.options.block) that.element.unblock(); if (!$.isPlainObject(data)) { that._onFailure(data); @@ -276,13 +280,6 @@ $('.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())) { - this.remove(); - } - }); - } if (this.options.crmForm) $('form', this.element).ajaxFormUnbind(); }, _destroy: function() { @@ -442,7 +439,7 @@ }, settings.ajaxForm)); if (settings.openInline) { settings.autoClose = $el.crmSnippet('isOriginalUrl'); - $(this).on('click', settings.openInline, function(e) { + $(this).off('.openInline').on('click.openInline', settings.openInline, function(e) { if ($(this).is(exclude + ', .crm-popup')) { return; } -- 2.25.1