CRM-17960 - Handle redirects in popups
authorColeman Watts <coleman@civicrm.org>
Wed, 3 Feb 2016 05:20:48 +0000 (22:20 -0700)
committerColeman Watts <coleman@civicrm.org>
Wed, 3 Feb 2016 05:20:48 +0000 (22:20 -0700)
js/crm.ajax.js

index 91565ef6030ff35b0dbb79c59ad9cfd51964f473..b01e814bf076d3c0613793ef8a43d97d5fd3e69b 100644 (file)
       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);
         $('.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() {
       }, 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;
           }