mirror of
https://github.com/pretix/pretix.git
synced 2026-05-09 15:54:03 +00:00
Stripe Elements: Fix incorrect JavaScript and display loading indicator
This commit is contained in:
@@ -64,7 +64,7 @@ $(function () {
|
|||||||
|
|
||||||
$(".checkout-button-row .btn-primary").click(
|
$(".checkout-button-row .btn-primary").click(
|
||||||
function (e) {
|
function (e) {
|
||||||
if (($("input[name=payment][value=stripe]").prop('checked') || $("input[type=checkbox][name=payment]").length === 0)
|
if (($("input[name=payment][value=stripe]").prop('checked') || $("input[type=checkbox][name=radio]").length === 0)
|
||||||
&& $("#stripe_token").val() == "") {
|
&& $("#stripe_token").val() == "") {
|
||||||
pretixstripe.start();
|
pretixstripe.start();
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
|||||||
@@ -28,6 +28,9 @@ var pretixstripe = {
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
'load': function () {
|
'load': function () {
|
||||||
|
if (pretixstripe.stripe !== null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
$('.stripe-container').closest("form").find(".btn-primary").prop("disabled", true);
|
$('.stripe-container').closest("form").find(".btn-primary").prop("disabled", true);
|
||||||
$.ajax(
|
$.ajax(
|
||||||
{
|
{
|
||||||
@@ -66,6 +69,9 @@ var pretixstripe = {
|
|||||||
);
|
);
|
||||||
},
|
},
|
||||||
'load_checkout': function () {
|
'load_checkout': function () {
|
||||||
|
if (pretixstripe.checkout_handler !== null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
$('.stripe-container').closest("form").find(".btn-primary").prop("disabled", true);
|
$('.stripe-container').closest("form").find(".btn-primary").prop("disabled", true);
|
||||||
$.ajax(
|
$.ajax(
|
||||||
{
|
{
|
||||||
@@ -151,7 +157,7 @@ $(function () {
|
|||||||
|
|
||||||
$('.stripe-container').closest("form").submit(
|
$('.stripe-container').closest("form").submit(
|
||||||
function () {
|
function () {
|
||||||
if (($("input[name=payment][value=stripe]").prop('checked') || $("input[name=payment][type=checkbox]").length === 0)
|
if (($("input[name=payment][value=stripe]").prop('checked') || $("input[name=payment][type=radio]").length === 0)
|
||||||
&& $("#stripe_token").val() == "") {
|
&& $("#stripe_token").val() == "") {
|
||||||
if ($("#stripe-checkout").length) {
|
if ($("#stripe-checkout").length) {
|
||||||
pretixstripe.show_checkout();
|
pretixstripe.show_checkout();
|
||||||
|
|||||||
@@ -31,6 +31,7 @@
|
|||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
<div id="stripe-card" class="form-control">
|
<div id="stripe-card" class="form-control">
|
||||||
|
<span class="fa fa-spinner fa-spin"></span>
|
||||||
<!-- a Stripe Element will be inserted here. -->
|
<!-- a Stripe Element will be inserted here. -->
|
||||||
</div>
|
</div>
|
||||||
<p class="help-block">
|
<p class="help-block">
|
||||||
|
|||||||
Reference in New Issue
Block a user