Contact summary group tab - Smart group layout and code cleanup
authorColeman Watts <coleman@civicrm.org>
Fri, 15 Aug 2014 15:09:20 +0000 (16:09 +0100)
committerColeman Watts <coleman@civicrm.org>
Fri, 15 Aug 2014 15:09:20 +0000 (16:09 +0100)
templates/CRM/Contact/Page/View/GroupContact.tpl

index e4659dde324b3362c9ced5f3680630843a5d1788..1f2b1b8e2fa90addf629051b7148a6bae4492088 100644 (file)
@@ -76,6 +76,7 @@
   {/if}
 
   {if $contactSmartGroupSettings neq 3}
+    <div class="spacer" style="height: 1.5em;"></div>
     <div class="accordion ui-accordion ui-widget ui-helper-reset">
       <div class="crm-accordion-wrapper crm-ajax-accordion crm-smartgroup-accordion {if $contactSmartGroupSettings eq 1}collapsed{/if}">
         <div class="crm-accordion-header" id="crm-contact_smartgroup" contact_id="{$contactId}">
@@ -83,7 +84,7 @@
         </div>
         <!-- /.crm-accordion-header -->
         <div class="crm-accordion-body">
-          <div class="crm-contact_smartgroup"></div>
+          <div class="crm-contact_smartgroup" style="min-height: 3em;"></div>
         </div>
         <!-- /.crm-accordion-body -->
       </div>
   CRM.$(function($) {
     // load panes function calls for snippet based on id of crm-accordion-header
     function loadPanes() {
-      var id = $(this).attr('id');
+      var $el = $(this).parent().find('div.crm-contact_smartgroup');
       var contactId = $(this).attr('contact_id');
-      if (!$('div.' + id).html()) {
-        var loading = '<img src="{/literal}{$config->resourceBase}i/loading.gif{literal}" alt="{/literal}{ts escape='js'}loading{/ts}{literal}" />&nbsp;{/literal}{ts escape='js'}Loading{/ts}{literal}...';
-        $('div.' + id).html(loading).load(CRM.url('civicrm/contact/view/smartgroup', {snippet: 4, cid: contactId}));
+      if (!$el.html()) {
+        CRM.loadPage(CRM.url('civicrm/contact/view/smartgroup', {cid: contactId}), {target: $el});
       }
     }
     // bind first click of accordion header to load crm-accordion-body with snippet