CRM-14486 - ts and link for empowered by image
[civicrm-core.git] / templates / CRM / common / enableDisableApi.tpl
index 29462f0578661926a8af01500d66fd48ce6c3451..83a9964c39e27e9e75e596aba4c42a2f66d361ed 100644 (file)
@@ -26,8 +26,8 @@
 {* handle common enable/disable actions *}
 {literal}
 <script type="text/javascript">
-  cj(function($) {
-    var $row, $table, info, enabled, fieldLabel;
+  CRM.$(function($) {
+    var $row, info, enabled, fieldLabel;
 
     function successMsg() {
       {/literal} {* client-side variable substitutions in smarty are AWKWARD! *}
     }
 
     function refresh() {
-      // Call native refresh method on ajax datatables
-      if ($.fn.DataTable.fnIsDataTable($table[0]) && $table.dataTable().fnSettings().sAjaxSource) {
-        $.each($.fn.dataTable.fnTables(), function() {
-          $(this).dataTable().fnSettings().sAjaxSource && $(this).unblock().dataTable().fnDraw();
-        });
-      }
-      // Otherwise refresh the content area using crmSnippet
-      else {
-        $row.closest('.crm-ajax-container, #crm-main-content-wrapper').crmSnippet().crmSnippet('refresh');
-      }
+      CRM.refreshParent($row);
     }
 
     function save() {
-      $table = $row.closest('table');
-      $table.block();
+      $row.closest('table').block();
       CRM.api3(info.entity, 'setvalue', {id: info.id, field: 'is_active', value: enabled ? 0 : 1}, {success: successMsg}).done(refresh);
       if (enabled) {
         $(this).dialog('close');