Merge pull request #5687 from relldoesphp/ckeditor_fix
[civicrm-core.git] / js / crm.livePage.js
index 0d313b3af6451b9a02022f85f793d375899dcba8..35c8b39312dd7cc3a333c4d5dc255b364798e929 100644 (file)
@@ -1,17 +1,12 @@
 // http://civicrm.org/licensing
 // Adds ajaxy behavior to a simple CiviCRM page
-cj(function($) {
+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
-    .on('click', 'a.button, a.action-item:not(".enable-action, .disable-action")', function() {
-      CRM.loadForm($(this).attr('href'), {
-        openInline: 'a'
-      }).on('crmFormSuccess', function(e, data) {
-        // Refresh page when form completes
-        $('#crm-main-content-wrapper').crmSnippet('refresh');
-      });
-      return false;
-    });
+    .off('.crmLivePage')
+    .on('click.crmLivePage', active, CRM.popup)
+    .on('crmPopupFormSuccess.crmLivePage', active, CRM.refreshParent);
 });