Add pager to contact pledge tab
authorColeman Watts <coleman@civicrm.org>
Tue, 19 Aug 2014 20:30:32 +0000 (21:30 +0100)
committerColeman Watts <coleman@civicrm.org>
Tue, 19 Aug 2014 20:57:46 +0000 (21:57 +0100)
CRM/Pledge/Page/Tab.php
templates/CRM/Pledge/Form/Selector.tpl

index 68df77e40c9416ececddf5a37301df44244231f4..0aaa6291f5afe696d1628c7b8ad8d85f0f564e81 100644 (file)
@@ -48,6 +48,7 @@ class CRM_Pledge_Page_Tab extends CRM_Core_Page {
     $controller->reset();
     $controller->set('cid', $this->_contactId);
     $controller->set('context', 'pledge');
+    $controller->set('limit', '25');
     $controller->process();
     $controller->run();
 
index ffb510e64a343f6bf89c353742cca9460beb5c28..2dd8e9a3f994115822e969403c7b2c895fe2fab9 100644 (file)
  | see the CiviCRM license FAQ at http://civicrm.org/licensing        |
  +--------------------------------------------------------------------+
 *}
-{if $context EQ 'Search'}
     {include file="CRM/common/pager.tpl" location="top"}
-{/if}
 
-{capture assign=iconURL}<img src="{$config->resourceBase}i/TreePlus.gif" alt="{ts}open section{/ts}"/>{/capture}
-{ts 1=$iconURL}Click %1 to view pledge payments.{/ts}
+<p class="description">
+  {ts}Click arrow to view pledge payments.{/ts}
+</p>
 {strip}
 <table class="selector row-highlight">
     <thead class="sticky">
                 {if ! $single }
                     &nbsp;{$row.contact_type}<br/>
                 {/if}
-                <span id="{$row.pledge_id}_show">
+                <span id="{$row.pledge_id}_show" title="{ts}Show payments{/ts}">
                     <a href="#" onclick="cj('#paymentDetails{$row.pledge_id},#minus{$row.pledge_id}_hide,#{$row.pledge_id}_hide').show();
                         buildPaymentDetails('{$row.pledge_id}','{$row.contact_id}');
                         cj('#{$row.pledge_id}_show').hide();
-                        return false;"><img src="{$config->resourceBase}i/TreePlus.gif" class="action-icon" alt="{ts}open section{/ts}"/></a>
+                        return false;"><img src="{$config->resourceBase}i/TreePlus.gif" class="action-icon" alt="&gt;"/></a>
                 </span>
-                <span id="minus{$row.pledge_id}_hide">
+                <span id="minus{$row.pledge_id}_hide" title="{ts}Hide payments{/ts}">
                     <a href="#" onclick="cj('#paymentDetails{$row.pledge_id},#{$row.pledge_id}_hide,#minus{$row.pledge_id}_hide').hide();
                             cj('#{$row.pledge_id}_show').show();
-                            return false;"><img src="{$config->resourceBase}i/TreeMinus.gif" class="action-icon" alt="{ts}open section{/ts}"/></a>
+                            return false;"><img src="{$config->resourceBase}i/TreeMinus.gif" class="action-icon" alt="^"/></a>
                 </span>
             </td>
             {if ! $single }
 </table>
 {/strip}
 
-{if $context EQ 'Search'}
     {include file="CRM/common/pager.tpl" location="bottom"}
-{/if}
 
 {* Build pledge payment details*}
 {literal}
     function buildPaymentDetails( pledgeId, contactId )
     {
         var dataUrl = {/literal}"{crmURL p='civicrm/pledge/payment' h=0 q="action=browse&snippet=4&context=`$context`&pledgeId="}"{literal} + pledgeId + '&cid=' + contactId;
-
-        cj.ajax({
-                url     : dataUrl,
-                dataType: "html",
-                timeout : 5000, //Time in milliseconds
-                success : function( data ){
-                            cj( '#paymentDetails' + pledgeId ).html( data ).trigger('crmLoad');
-                          },
-                error   : function( XMLHttpRequest, textStatus, errorThrown ) {
-                            console.error( 'Error: '+ textStatus );
-                          }
-             });
+        CRM.loadPage(dataUrl, {target: '#paymentDetails' + pledgeId});
     }
 </script>
 {/literal}