Permalink
Browse files

Do better job of disabling/enabling stripe button.

  • Loading branch information...
1 parent c32fdd1 commit baf48978e12bb9e2186e643d164943d8d62cdfbf @bsimpson63 bsimpson63 committed with chromakode Feb 28, 2013
Showing with 7 additions and 9 deletions.
  1. +3 −2 r2/r2/controllers/ipn.py
  2. +1 −1 r2/r2/public/static/css/reddit.less
  3. +3 −6 r2/r2/public/static/js/gold.js
View
@@ -749,12 +749,12 @@ def POST_goldcharge(self, form, jquery, token, passthrough, pennies, months):
customer['active_card']['address_zip_check'] == 'fail'):
form.set_html('.status',
_('error: address verification failed'))
- form.find('.stripe-submit').removeClass("disabled").end()
+ form.find('.stripe-submit').removeAttr('disabled').end()
return
if customer['active_card']['cvc_check'] == 'fail':
form.set_html('.status', _('error: cvc check failed'))
- form.find('.stripe-submit').removeClass("disabled").end()
+ form.find('.stripe-submit').removeAttr('disabled').end()
return
charge = stripe.Charge.create(
@@ -765,6 +765,7 @@ def POST_goldcharge(self, form, jquery, token, passthrough, pennies, months):
)
except stripe.CardError as e:
form.set_html('.status', 'error: %s' % e.message)
+ form.find('.stripe-submit').removeAttr('disabled').end()
except stripe.InvalidRequestError as e:
form.set_html('.status', _('invalid request'))
except stripe.APIConnectionError as e:
@@ -5435,7 +5435,7 @@ body:not(.gold) .allminus-link {
text-shadow: 0px 1px 0px hsla(0,0%,100%,.7);
}
-.gold-button.disabled {
+.gold-button.disabled, .gold-button:disabled {
color: #999;
background-color: #ccc;
border-color: #aaa;
@@ -134,9 +134,8 @@ r.gold = {
cardZip = form.find('.card-address_zip').val()
var stripeResponseHandler = function(status, response) {
- window.clearTimeout(workingTimer)
if (response.error) {
- submit.removeClass("disabled")
+ submit.removeAttr('disabled')
status.html(response.error.message)
} else {
token.val(response.id)
@@ -164,10 +163,8 @@ r.gold = {
status.text(r.strings('missing_credit_zip'))
} else {
- var workingTimer = setTimeout(function () {
- submit.addClass('disabled')
- }, 200)
-
+ status.text('')
+ submit.attr('disabled', 'disabled')
Stripe.createToken({
name: cardName,
number: cardNumber,

0 comments on commit baf4897

Please sign in to comment.