CRM-15906 - Related js cleanup
authorColeman Watts <coleman@civicrm.org>
Mon, 2 Feb 2015 22:52:13 +0000 (17:52 -0500)
committerColeman Watts <coleman@civicrm.org>
Mon, 2 Feb 2015 22:52:13 +0000 (17:52 -0500)
CRM/Pledge/Form/Payment.php
templates/CRM/Pledge/Form/Payment.tpl

index de3c76e0db5aae1f465ff8fb166f62c8b0f6e834..182c1c2f41be525127e9080bdc8007bccad45e49 100644 (file)
@@ -100,13 +100,11 @@ class CRM_Pledge_Form_Payment extends CRM_Core_Form {
 
     $this->addMoney('scheduled_amount',
       ts('Scheduled Amount'), TRUE,
-      array(
-        'READONLY' => TRUE,
-        'style' => "background-color:#EBECE4",
-      ),
+      array('readonly' => TRUE),
       TRUE,
       'currency',
-      NULL, TRUE
+      NULL,
+      TRUE
     );
 
     $optionTypes = array('1' => ts('Adjust Pledge Payment Schedule?'),
index e7386081b683c9ed4ecbb3b23d62c26841378cfa..913948349bc1ecaf535c4600808d901e7120df92 100644 (file)
             <span class="description">{ts}Scheduled Date for Pledge payment.{/ts}</span></td></tr>
         </td></tr>
   <tr><td class="label">{$form.scheduled_amount.label}</td><td class="form-layout">{$form.currency.html}&nbsp;{$form.scheduled_amount.html}
-      {if !$pledgePayment}{ts}<a href="#" onclick="adjustPayment();">adjust scheduled amount</a>{help id="adjust-payment-amount"}{/ts}{/if}
+      {if !$pledgePayment}
+        <a href="#" class="crm-hover-button action-item adjust-pledge-payment">
+          {ts}Adjust scheduled amount{/ts}
+        </a>
+        {help id="adjust-payment-amount"}
+      {/if}
       </td>
   </tr>
   <tr id="adjust-option-type" class="crm-contribution-form-block-option_type">
 <script type="text/javascript">
   CRM.$(function($) {
     $('#adjust-option-type').hide();
+
+    $('a.adjust-pledge-payment').click(function(e) {
+      e.preventDefault();
+      $(this).hide();
+      $('#adjust-option-type').show();
+      $("#scheduled_amount").prop("readonly", false);
+    });
   });
-  function adjustPayment( ) {
-    cj('#adjust-option-type').show();
-    cj("#scheduled_amount").removeAttr("READONLY").css('background-color', '#ffffff');
-  }
 </script>
 {/literal}