mirror of
https://github.com/pretix/pretix.git
synced 2026-05-08 15:44:02 +00:00
PPv2: Fix continue button behaviour (#2821)
Co-authored-by: Richard Schreiber <wiffbi@gmail.com>
This commit is contained in:
@@ -73,12 +73,21 @@ var pretixpaypal = {
|
|||||||
pretixpaypal.locale = this.guessLocale();
|
pretixpaypal.locale = this.guessLocale();
|
||||||
}
|
}
|
||||||
|
|
||||||
// If no payment option is selected, and we're not on the paypage (which doesn't have a continue button),
|
$("input[name=payment][value^='paypal']").change(function () {
|
||||||
// disable the continue button
|
if (pretixpaypal.paypal !== null) {
|
||||||
if (!pretixpaypal.paypage) {
|
pretixpaypal.renderButton($(this).val());
|
||||||
if (!pretixpaypal.continue_button[0].form.elements['payment'].value) {
|
} else {
|
||||||
pretixpaypal.continue_button.prop("disabled", true);
|
pretixpaypal.continue_button.prop("disabled", true);
|
||||||
}
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
$("input[name=payment]").not("[value^='paypal']").change(function () {
|
||||||
|
pretixpaypal.restore();
|
||||||
|
});
|
||||||
|
|
||||||
|
// If paypal is pre-selected, we must disable the continue button and handle it after SDK is loaded
|
||||||
|
if ($("input[name=payment][value^='paypal']").is(':checked')) {
|
||||||
|
pretixpaypal.continue_button.prop("disabled", true);
|
||||||
}
|
}
|
||||||
|
|
||||||
// We are setting the cogwheel already here, as the renderAPM() method might take some time to get loaded.
|
// We are setting the cogwheel already here, as the renderAPM() method might take some time to get loaded.
|
||||||
@@ -139,14 +148,6 @@ var pretixpaypal = {
|
|||||||
pretixpaypal.renderAPMs();
|
pretixpaypal.renderAPMs();
|
||||||
}
|
}
|
||||||
|
|
||||||
$("input[name=payment][value^='paypal']").change(function () {
|
|
||||||
pretixpaypal.renderButton($(this).val());
|
|
||||||
});
|
|
||||||
|
|
||||||
$("input[name=payment]").not("[value^='paypal']").change(function () {
|
|
||||||
pretixpaypal.restore();
|
|
||||||
});
|
|
||||||
|
|
||||||
if ($("input[name=payment][value^='paypal']").is(':checked')) {
|
if ($("input[name=payment][value^='paypal']").is(':checked')) {
|
||||||
pretixpaypal.renderButton($("input[name=payment][value^='paypal']:checked").val());
|
pretixpaypal.renderButton($("input[name=payment][value^='paypal']:checked").val());
|
||||||
} else if ($(".payment-redo-form").length) {
|
} else if ($(".payment-redo-form").length) {
|
||||||
@@ -162,8 +163,8 @@ var pretixpaypal = {
|
|||||||
$('#paypal-button-container').empty()
|
$('#paypal-button-container').empty()
|
||||||
pretixpaypal.continue_button.text(gettext('Continue'));
|
pretixpaypal.continue_button.text(gettext('Continue'));
|
||||||
pretixpaypal.continue_button.show();
|
pretixpaypal.continue_button.show();
|
||||||
pretixpaypal.continue_button.prop("disabled", false);
|
|
||||||
}
|
}
|
||||||
|
pretixpaypal.continue_button.prop("disabled", false);
|
||||||
},
|
},
|
||||||
|
|
||||||
renderButton: function (method) {
|
renderButton: function (method) {
|
||||||
@@ -321,6 +322,15 @@ var pretixpaypal = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
$(function () {
|
$(function () {
|
||||||
|
// This script is always loaded if paypal is enabled as a payment method, regardless of
|
||||||
|
// whether it is available (it could e.g. be hidden or limited to certain countries).
|
||||||
|
// We do not want to unnecessarily load the sdk.
|
||||||
|
// If no paypal/paypal_apm payment option is present and we are not on
|
||||||
|
// the (APM) PayView, then we do not need the SDK.
|
||||||
|
if (!$("input[name=payment][value^='paypal']").length && !$('#paypal-button-container').data('paypage')) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
pretixpaypal.load();
|
pretixpaypal.load();
|
||||||
|
|
||||||
(async() => {
|
(async() => {
|
||||||
|
|||||||
Reference in New Issue
Block a user