r102227 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r102226‎ | r102227 | r102228 >
Date:01:44, 7 November 2011
Author:kaldari
Status:ok
Tags:
Comment:
adding amount restoration to webitects forms
Modified paths:
  • /trunk/extensions/DonationInterface/globalcollect_gateway/forms/js/lightbox1.js (modified) (history)
  • /trunk/extensions/DonationInterface/globalcollect_gateway/forms/js/webitects_2_3step.js (modified) (history)
  • /trunk/extensions/DonationInterface/payflowpro_gateway/forms/js/webitects_2_3step.js (modified) (history)

Diff [purge]

Index: trunk/extensions/DonationInterface/globalcollect_gateway/forms/js/lightbox1.js
@@ -7,6 +7,23 @@
88 modal: true,
99 title: 'Donate by Credit Card'
1010 } );
 11+
 12+ // If the form is being reloaded, restore the amount
 13+ var previousAmount = $( 'input[name="amount"]' ).val();
 14+ if ( previousAmount ) {
 15+ var matched = false;
 16+ $( 'input[name="amountRadio"]' ).each( function( index ) {
 17+ if ( $( this ).val() == previousAmount ) {
 18+ $( this ).attr( 'checked', true );
 19+ matched = true;
 20+ }
 21+ } );
 22+ if ( !matched ) {
 23+ $( 'input#input_amount_other' ).attr( 'checked', true );
 24+ $( 'input#other-amount' ).val( previousAmount );
 25+ }
 26+ }
 27+
1128 $( '#cc' ).click( function() {
1229 if ( validateAmount( document.paypalcontribution ) ) {
1330 $( '#dialog' ).dialog( 'open' );
Index: trunk/extensions/DonationInterface/globalcollect_gateway/forms/js/webitects_2_3step.js
@@ -56,6 +56,22 @@
5757 }
5858 showAmount( $( 'input[name="amount"]' ) ); // lets go ahead and assume there is something to show
5959 }
 60+
 61+ // If the form is being reloaded, restore the amount
 62+ var previousAmount = $( 'input[name="amount"]' ).val();
 63+ if ( previousAmount ) {
 64+ var matched = false;
 65+ $( 'input[name="amountRadio"]' ).each( function( index ) {
 66+ if ( $( this ).val() == previousAmount ) {
 67+ $( this ).attr( 'checked', true );
 68+ matched = true;
 69+ }
 70+ } );
 71+ if ( !matched ) {
 72+ $( 'input#input_amount_other' ).attr( 'checked', true );
 73+ $( 'input#other-amount' ).val( previousAmount );
 74+ }
 75+ }
6076
6177 $( "#cc" ).click( function() {
6278 /* safety check for people who hit the back button */
Index: trunk/extensions/DonationInterface/payflowpro_gateway/forms/js/webitects_2_3step.js
@@ -56,6 +56,22 @@
5757 }
5858 showAmount( $( 'input[name="amount"]' ) ); // lets go ahead and assume there is something to show
5959 }
 60+
 61+ // If the form is being reloaded, restore the amount
 62+ var previousAmount = $( 'input[name="amount"]' ).val();
 63+ if ( previousAmount ) {
 64+ var matched = false;
 65+ $( 'input[name="amountRadio"]' ).each( function( index ) {
 66+ if ( $( this ).val() == previousAmount ) {
 67+ $( this ).attr( 'checked', true );
 68+ matched = true;
 69+ }
 70+ } );
 71+ if ( !matched ) {
 72+ $( 'input#input_amount_other' ).attr( 'checked', true );
 73+ $( 'input#other-amount' ).val( previousAmount );
 74+ }
 75+ }
6076
6177 $( "#cc" ).click( function() {
6278 if ( validateAmount() ) {

Follow-up revisions

RevisionCommit summaryAuthorDate
r102230follow-up to r102227 - in case amount is set as 0.00 due to defaults, also ad...kaldari02:26, 7 November 2011
r102243MFT r102191, r102195, r102196, r102200, r102203, r102213, r102214, r102215, r...awjrichards03:31, 7 November 2011

Status & tagging log