Awight has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/180313

Change subject: Prevent double clicks on gc cc forms (take 2)
......................................................................

Prevent double clicks on gc cc forms (take 2)

Sketchy 5-second delay just to make us look less broken than we are.

Change-Id: I808d094400350b3fc2eba9b66bbc532628523d57
---
M globalcollect_gateway/forms/js/gc.cc.js
M globalcollect_gateway/forms/js/gc.js
2 files changed, 11 insertions(+), 1 deletion(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/DonationInterface 
refs/changes/13/180313/1

diff --git a/globalcollect_gateway/forms/js/gc.cc.js 
b/globalcollect_gateway/forms/js/gc.cc.js
index 5f19108..71c15d4 100644
--- a/globalcollect_gateway/forms/js/gc.cc.js
+++ b/globalcollect_gateway/forms/js/gc.cc.js
@@ -55,10 +55,12 @@
        } );
 
        // Set the cards to progress to step 3
-       $( '.cardradio' ).live( 'click', function () {
+       $( '.cardradio' ).live( 'change', function (event) {
+
                if ( validate_personal( document.payment ) && validateAmount() 
) {
                        $( '#payment' ).animate( { height: '314px' }, 1000 );
                        displayCreditCardForm();
+
                        // hide the continue button so that people don't get 
confused with two of them
                        $( '#paymentContinue' ).hide();
                } else {
diff --git a/globalcollect_gateway/forms/js/gc.js 
b/globalcollect_gateway/forms/js/gc.js
index 26f6237..73b5c08 100644
--- a/globalcollect_gateway/forms/js/gc.js
+++ b/globalcollect_gateway/forms/js/gc.js
@@ -63,6 +63,8 @@
                sendData.street_supplemental = $( 
'input[name="street_supplemental"]' ).val();
        }
 
+       $('.cardradio').prop('disabled', true);
+
        $.ajax( {
                url: mw.util.wikiScript( 'api' ),
                data: sendData,
@@ -85,6 +87,12 @@
                },
                error: function ( xhr ) {
                        alert( mw.msg( 'donate_interface-error-msg-general' ) );
+               },
+               complete: function ( xhr ) {
+                       // Make sure our radio buttons are reenabled at some 
point.
+                       window.setTimeout( function() {
+                               $( '.cardradio' ).prop( 'disabled', false );
+                       }, 5000 );
                }
        } );
 };

-- 
To view, visit https://gerrit.wikimedia.org/r/180313
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I808d094400350b3fc2eba9b66bbc532628523d57
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/DonationInterface
Gerrit-Branch: master
Gerrit-Owner: Awight <[email protected]>
Gerrit-Reviewer: Ssmith <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to