Skip to content
This repository has been archived by the owner on Feb 8, 2018. It is now read-only.

Commit

Permalink
really disable the button instead of only changing its opacity
Browse files Browse the repository at this point in the history
  • Loading branch information
Changaco committed Mar 17, 2015
1 parent 0360b58 commit 6545ff4
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions js/gratipay/payments.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ Gratipay.payments.submitDeleteForm = function(e) {
};

Gratipay.payments.onError = function(response) {
$('button#save').css('opacity', 1);
$('button#save').prop('disabled', false);
var msg = response.status_code + ": " +
$.map(response.errors, function(obj) { return obj.description }).join(', ');
Gratipay.forms.showFeedback(null, [msg]);
Expand All @@ -62,7 +62,7 @@ Gratipay.payments.onSuccess = function(data) {
}, 8000);
$('#delete').show();
Gratipay.forms.clearFeedback();
$('button#save').css('opacity', 1);
$('button#save').prop('disabled', false);
setTimeout(function() {
window.location.href = '/' + Gratipay.participantId + '/';
}, 1000);
Expand All @@ -82,7 +82,7 @@ Gratipay.payments.ba.init = function(participantId) {
Gratipay.payments.ba.submit = function (e) {
e.preventDefault();

$('button#save').css('opacity', 0.5);
$('button#save').prop('disabled', true);
Gratipay.forms.clearFeedback();

var bankAccount = {
Expand Down Expand Up @@ -150,7 +150,7 @@ Gratipay.payments.ba.submit = function (e) {


if (errors.length) {
$('button#save').css('opacity', 1);
$('button#save').prop('disabled', false);
Gratipay.forms.showFeedback(null, errors);
} else {
balanced.bankAccount.create( bankAccount
Expand Down Expand Up @@ -182,7 +182,7 @@ Gratipay.payments.ba.handleResponse = function (response) {
];
}
Gratipay.forms.showFeedback(data.problem, messages);
$('button#save').css('opacity', 1);
$('button#save').prop('disabled', false);
}

var detailsToSubmit = Gratipay.payments.ba.merchantData;
Expand Down Expand Up @@ -340,7 +340,7 @@ Gratipay.payments.cc.submit = function(e) {

e.stopPropagation();
e.preventDefault();
$('button#save').css('opacity', 0.5);
$('button#save').prop('disabled', true);
Gratipay.forms.clearFeedback();

// Adapt our form lingo to balanced nomenclature.
Expand Down Expand Up @@ -379,17 +379,17 @@ Gratipay.payments.cc.submit = function(e) {
credit_card.expiration_year = year.length == 2 ? '20' + year : year;

if (!balanced.card.isCardNumberValid(credit_card.number)) {
$('button#save').css('opacity', 1);
$('button#save').prop('disabled', false);
Gratipay.forms.showFeedback(null, ["Your card number is bad."]);
} else if (!balanced.card.isExpiryValid( credit_card.expiration_month
, credit_card.expiration_year
)) {
$('button#save').css('opacity', 1);
$('button#save').prop('disabled', false);
Gratipay.forms.showFeedback(null, ["Your expiration date is bad."]);
} else if (!balanced.card.isSecurityCodeValid( credit_card.number
, credit_card.cvv
)) {
$('button#save').css('opacity', 1);
$('button#save').prop('disabled', false);
Gratipay.forms.showFeedback(null, ["Your CVV is bad."]);
} else {
balanced.card.create(credit_card, Gratipay.payments.cc.handleResponse);
Expand Down Expand Up @@ -418,7 +418,7 @@ Gratipay.payments.cc.handleResponse = function(response) {
$('#delete').show();
var details = [];
Gratipay.forms.showFeedback(data.problem, [data.error]);
$('button#save').css('opacity', 1);
$('button#save').prop('disabled', false);
}

Gratipay.forms.submit( "/credit-card.json"
Expand Down

0 comments on commit 6545ff4

Please sign in to comment.