CRM-13863 - Add more sugar to CRM popup helper
[civicrm-core.git] / templates / CRM / common / TabHeader.js
index 104ead9a0f7196f8e4d516ad4a45038a6361fba4..c28fbb716fbe9ebbec29fc179b302e2038d84196 100644 (file)
@@ -32,13 +32,10 @@ cj(function($) {
         if (ui.tab.hasClass('livePage') && CRM.config.ajax_popups_enabled) {
           ui.panel
             .off('click.crmLivePage')
-            .on('click.crmLivePage', 'a.button, a.action-item', function() {
-              return !$(this).crmPopup({
-                crmFormSuccess: function() {
-                  // Refresh panel when form completes
-                  ui.panel.crmSnippet('refresh');
-                }
-              });
+            .on('click.crmLivePage', 'a.button, a.action-item', CRM.popup)
+            .on('crmPopupFormSuccess.crmLivePage', 'a.button, a.action-item', function() {
+              // Refresh panel when form completes
+              ui.panel.crmSnippet('refresh');
             });
         }
         ui.panel