Fix enableDisableApi to fire crmPopupFormSuccess event
[civicrm-core.git] / js / crm.livePage.js
index 48a327c479b85c1cdfd36cab5f2834b864de637d..35c8b39312dd7cc3a333c4d5dc255b364798e929 100644 (file)
@@ -1,15 +1,12 @@
 // http://civicrm.org/licensing
 // Adds ajaxy behavior to a simple CiviCRM page
-cj(function($) {
-  var active = 'a.button, a.action-item, a.crm-popup';
+CRM.$(function($) {
+  var active = 'a.button, a.action-item:not(.crm-enable-disable), a.crm-popup';
   $('#crm-main-content-wrapper')
     // Widgetize the content area
     .crmSnippet()
     // Open action links in a popup
     .off('.crmLivePage')
     .on('click.crmLivePage', active, CRM.popup)
-    .on('crmPopupFormSuccess.crmLivePage', active, function() {
-      // Refresh page when form completes
-      $('#crm-main-content-wrapper').crmSnippet('refresh');
-    });
+    .on('crmPopupFormSuccess.crmLivePage', active, CRM.refreshParent);
 });