r103067 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r103066‎ | r103067 | r103068 >
Date:23:14, 14 November 2011
Author:kaldari
Status:ok
Tags:
Comment:
make sure 2nd step is displayed when changing amount on 2nd step forms, make sure all forms have proper amount setting logic
Modified paths:
  • /trunk/extensions/DonationInterface/globalcollect_gateway/forms/js/webitects.bt.js (modified) (history)
  • /trunk/extensions/DonationInterface/globalcollect_gateway/forms/js/webitects2nd-US.js (modified) (history)
  • /trunk/extensions/DonationInterface/globalcollect_gateway/forms/js/webitects2nd.js (modified) (history)
  • /trunk/extensions/DonationInterface/globalcollect_gateway/forms/js/webitects_2_3step.js (modified) (history)

Diff [purge]

Index: trunk/extensions/DonationInterface/globalcollect_gateway/forms/js/webitects_2_3step.js
@@ -72,13 +72,7 @@
7373 $( 'input#other-amount' ).val( previousAmount );
7474 }
7575 }
76 - // For when people switch back to Other from another value
77 - $( '#input_amount_other' ).click( function() {
78 - var otherAmount = $( 'input#other-amount' ).val();
79 - if ( otherAmount ) {
80 - setAmount( $( 'input#other-amount' ) );
81 - }
82 - } );
 76+
8377 $( "#cc" ).click( function() {
8478 /* safety check for people who hit the back button */
8579 checkedValue = $( "input[name='amountRadio']:checked" ).val();
@@ -148,6 +142,14 @@
149143 displayCreditCardForm();
150144 }
151145 } );
 146+
 147+ // For when people switch back to Other from another value
 148+ $( '#input_amount_other' ).click( function() {
 149+ var otherAmount = $( 'input#other-amount' ).val();
 150+ if ( otherAmount ) {
 151+ setAmount( $( 'input#other-amount' ) );
 152+ }
 153+ } );
152154 // Set selected amount to amount
153155 $( 'input[name="amountRadio"]' ).click( function() {
154156 if ( !isNaN( $( this ).val() ) ) {
@@ -156,7 +158,9 @@
157159 } );
158160 // reset the amount field when "other" is changed
159161 $( "#other-amount" ).keyup( function() {
160 - setAmount( $( this ) );
 162+ if ( $( '#input_amount_other' ).is(':checked') ) {
 163+ setAmount( $( this ) );
 164+ }
161165 } );
162166
163167 // show the CVV help image on click
Index: trunk/extensions/DonationInterface/globalcollect_gateway/forms/js/webitects.bt.js
@@ -57,13 +57,24 @@
5858 showAmount( $( 'input[name="amount"]' ) );
5959 }
6060
 61+ // For when people switch back to Other from another value
 62+ $( '#input_amount_other' ).click( function() {
 63+ var otherAmount = $( 'input#other-amount' ).val();
 64+ if ( otherAmount ) {
 65+ setAmount( $( 'input#other-amount' ) );
 66+ }
 67+ } );
6168 // Set selected amount to amount
6269 $( 'input[name="amountRadio"]' ).click( function() {
63 - setAmount( $( this ) );
 70+ if ( !isNaN( $( this ).val() ) ) {
 71+ setAmount( $( this ) );
 72+ }
6473 } );
6574 // reset the amount field when "other" is changed
66 - $( "#other-amount" ).change( function() {
67 - setAmount( $( this ) );
 75+ $( "#other-amount" ).keyup( function() {
 76+ if ( $( '#input_amount_other' ).is(':checked') ) {
 77+ setAmount( $( this ) );
 78+ }
6879 } );
6980
7081 $( "#step1header" ).click( function() {
Index: trunk/extensions/DonationInterface/globalcollect_gateway/forms/js/webitects2nd.js
@@ -83,18 +83,30 @@
8484 showAmount( $( 'input[name="amount"]' ) );
8585 }
8686
 87+ // For when people switch back to Other from another value
 88+ $( '#input_amount_other' ).click( function() {
 89+ var otherAmount = $( 'input#other-amount' ).val();
 90+ if ( otherAmount ) {
 91+ setAmount( $( 'input#other-amount' ) );
 92+ }
 93+ } );
8794 // Set selected amount to amount
8895 $( 'input[name="amountRadio"]' ).click( function() {
89 - setAmount( $( this ) );
 96+ if ( !isNaN( $( this ).val() ) ) {
 97+ setAmount( $( this ) );
 98+ }
9099 } );
91100 // reset the amount field when "other" is changed
92 - $( "#other-amount" ).change( function() {
93 - setAmount( $( this ) );
 101+ $( "#other-amount" ).keyup( function() {
 102+ if ( $( '#input_amount_other' ).is(':checked') ) {
 103+ setAmount( $( this ) );
 104+ }
94105 } );
95106
96107 $( "#step1header" ).click( function() {
97108 // show the correct sections
98109 $( "#step1wrapper" ).slideDown();
 110+ $( "#step2wrapper" ).slideDown();
99111 $( "#step3wrapper" ).slideUp();
100112 $( "#change-amount" ).hide();
101113 } );
Index: trunk/extensions/DonationInterface/globalcollect_gateway/forms/js/webitects2nd-US.js
@@ -82,19 +82,31 @@
8383 } else {
8484 showAmount( $( 'input[name="amount"]' ) );
8585 }
86 -
 86+
 87+ // For when people switch back to Other from another value
 88+ $( '#input_amount_other' ).click( function() {
 89+ var otherAmount = $( 'input#other-amount' ).val();
 90+ if ( otherAmount ) {
 91+ setAmount( $( 'input#other-amount' ) );
 92+ }
 93+ } );
8794 // Set selected amount to amount
8895 $( 'input[name="amountRadio"]' ).click( function() {
89 - setAmount( $( this ) );
 96+ if ( !isNaN( $( this ).val() ) ) {
 97+ setAmount( $( this ) );
 98+ }
9099 } );
91100 // reset the amount field when "other" is changed
92 - $( "#other-amount" ).change( function() {
93 - setAmount( $( this ) );
 101+ $( "#other-amount" ).keyup( function() {
 102+ if ( $( '#input_amount_other' ).is(':checked') ) {
 103+ setAmount( $( this ) );
 104+ }
94105 } );
95106
96107 $( "#step1header" ).click( function() {
97108 // show the correct sections
98109 $( "#step1wrapper" ).slideDown();
 110+ $( "#step2wrapper" ).slideDown();
99111 $( "#step3wrapper" ).slideUp();
100112 $( "#change-amount" ).hide();
101113 } );

Follow-up revisions

RevisionCommit summaryAuthorDate
r103069MFT r103067awjrichards23:20, 14 November 2011

Status & tagging log