diff --git a/src/pretix/presale/templates/pretixpresale/base.html b/src/pretix/presale/templates/pretixpresale/base.html index 99c68986c..82cae0b90 100644 --- a/src/pretix/presale/templates/pretixpresale/base.html +++ b/src/pretix/presale/templates/pretixpresale/base.html @@ -72,11 +72,16 @@
- -

{% trans "We are processing your request …" %}

-

- {% trans "If this takes longer than a few minutes, please contact us." %} -

+
{% if DEBUG %} diff --git a/src/pretix/presale/templates/pretixpresale/event/checkout_addons.html b/src/pretix/presale/templates/pretixpresale/event/checkout_addons.html index cb3ff5fc6..f1feb27f0 100644 --- a/src/pretix/presale/templates/pretixpresale/event/checkout_addons.html +++ b/src/pretix/presale/templates/pretixpresale/event/checkout_addons.html @@ -5,7 +5,8 @@

{% trans "For some of the products in your cart, you can choose additional options before you continue." %}

-
+ {% csrf_token %}
{% for form in forms %} diff --git a/src/pretix/presale/templates/pretixpresale/event/checkout_confirm.html b/src/pretix/presale/templates/pretixpresale/event/checkout_confirm.html index b4b3b5f3f..69b214276 100644 --- a/src/pretix/presale/templates/pretixpresale/event/checkout_confirm.html +++ b/src/pretix/presale/templates/pretixpresale/event/checkout_confirm.html @@ -8,7 +8,8 @@

{% trans "Review order" %}

{% include "pretixpresale/event/fragment_checkoutflow.html" %}

{% trans "Please review the details below and confirm your order." %}

- + {% csrf_token %}
diff --git a/src/pretix/presale/templates/pretixpresale/event/fragment_cart.html b/src/pretix/presale/templates/pretixpresale/event/fragment_cart.html index 62406bf53..fe5272ea0 100644 --- a/src/pretix/presale/templates/pretixpresale/event/fragment_cart.html +++ b/src/pretix/presale/templates/pretixpresale/event/fragment_cart.html @@ -81,6 +81,7 @@
{% if editable %} {% csrf_token %} @@ -92,6 +93,8 @@ {{ line.count }} {% if editable %} {% csrf_token %} diff --git a/src/pretix/presale/templates/pretixpresale/event/index.html b/src/pretix/presale/templates/pretixpresale/event/index.html index d1931ef10..c6d64b8d2 100644 --- a/src/pretix/presale/templates/pretixpresale/event/index.html +++ b/src/pretix/presale/templates/pretixpresale/event/index.html @@ -180,6 +180,8 @@ {% if ev.presale_is_running or event.settings.show_items_outside_presale_period %} {% csrf_token %} diff --git a/src/pretix/presale/templates/pretixpresale/event/voucher.html b/src/pretix/presale/templates/pretixpresale/event/voucher.html index ee273ad5e..dac545883 100644 --- a/src/pretix/presale/templates/pretixpresale/event/voucher.html +++ b/src/pretix/presale/templates/pretixpresale/event/voucher.html @@ -21,7 +21,11 @@ {% if event.presale_is_running or event.settings.show_items_outside_presale_period %} + {% if new_tab %}target="_blank"{% else %} + data-asynctask + data-asynctask-headline="{% trans "We're now trying to reserve this for you!" %}" + data-asynctask-text="{% blocktrans with time=event.settings.reservation_time %}Once the items are in your cart, you will have {{ time }} minutes to complete your purchase.{% endblocktrans %}" + {% endif %}> {% csrf_token %} diff --git a/src/pretix/static/pretixbase/js/asynctask.js b/src/pretix/static/pretixbase/js/asynctask.js index 921c0c8ca..121a79d63 100644 --- a/src/pretix/static/pretixbase/js/asynctask.js +++ b/src/pretix/static/pretixbase/js/asynctask.js @@ -35,13 +35,17 @@ function async_task_check_callback(data, jqXHR, status) { async_task_timeout = window.setTimeout(async_task_check, 250); if (async_task_is_long) { - $("#loadingmodal p").text(gettext('Your request has been queued on the server and will now be ' + - 'processed. Depending on the size of your event, this might take up to a ' + - 'few minutes.')); + $("#loadingmodal p.status").text(gettext( + 'Your request has been queued on the server and will now be ' + + 'processed. Depending on the size of your event, this might take up to a ' + + 'few minutes.' + )); } else { - $("#loadingmodal p").text(gettext('Your request has been queued on the server and will now be ' + - 'processed. If this takes longer than two minutes, please contact us or go ' + - 'back in your browser and try again.')); + $("#loadingmodal p.status").text(gettext( + 'Your request arrived on the server but we still wait for it to be ' + + 'processed. If this takes longer than two minutes, please contact us or go ' + + 'back in your browser and try again.' + )); } } @@ -62,7 +66,7 @@ function async_task_check_error(jqXHR, textStatus, errorThrown) { alert(gettext('An error of type {code} occurred.').replace(/\{code\}/, jqXHR.status)); } else { // 500 can be an application error or overload in some cases :( - $("#loadingmodal p").text(gettext('We currently cannot reach the server, but we keep trying.' + + $("#loadingmodal p.status").text(gettext('We currently cannot reach the server, but we keep trying.' + ' Last error code: {code}').replace(/\{code\}/, jqXHR.status)); async_task_timeout = window.setTimeout(async_task_check, 5000); } @@ -87,13 +91,17 @@ function async_task_callback(data, jqXHR, status) { async_task_timeout = window.setTimeout(async_task_check, 100); if (async_task_is_long) { - $("#loadingmodal p").text(gettext('Your request has been queued on the server and will now be ' + - 'processed. Depending on the size of your event, this might take up to a ' + - 'few minutes.')); + $("#loadingmodal p.status").text(gettext( + 'Your request has been queued on the server and will now be ' + + 'processed. Depending on the size of your event, this might take up to a ' + + 'few minutes.' + )); } else { - $("#loadingmodal p").text(gettext('Your request has been queued on the server and will now be ' + - 'processed. If this takes longer than two minutes, please contact us or go ' + - 'back in your browser and try again.')); + $("#loadingmodal p.status").text(gettext( + 'Your request arrived on the server but we still wait for it to be ' + + 'processed. If this takes longer than two minutes, please contact us or go ' + + 'back in your browser and try again.' + )); } if (location.href.indexOf("async_id") === -1) { history.pushState({}, "Waiting", async_task_check_url.replace(/ajax=1/, '')); @@ -134,10 +142,21 @@ $(function () { async_task_is_long = $(this).is("[data-asynctask-long]"); async_task_old_url = location.href; $("body").data('ajaxing', true); - waitingDialog.show(gettext('We are processing your request …')); - $("#loadingmodal p").text(gettext('We are currently sending your request to the server. If this takes longer ' + - 'than one minute, please check your internet connection and then reload ' + - 'this page and try again.')); + if ($(this).is("[data-asynctask-headline]")) { + waitingDialog.show($(this).attr("data-asynctask-headline")); + } else { + waitingDialog.show(gettext('We are processing your request …')); + } + if ($(this).is("[data-asynctask-text]")) { + $("#loadingmodal p.text").text($(this).attr("data-asynctask-text")).show(); + } else { + $("#loadingmodal p.text").hide(); + } + $("#loadingmodal p.status").text(gettext( + 'We are currently sending your request to the server. If this takes longer ' + + 'than one minute, please check your internet connection and then reload ' + + 'this page and try again.' + )); $.ajax( { @@ -157,7 +176,7 @@ $(function () { var waitingDialog = { show: function (message) { "use strict"; - $("#loadingmodal").find("h1").html(message); + $("#loadingmodal").find("h3").html(message); $("body").addClass("loading"); }, hide: function () { diff --git a/src/pretix/static/pretixpresale/scss/main.scss b/src/pretix/static/pretixpresale/scss/main.scss index 1891233bb..8307c38a7 100644 --- a/src/pretix/static/pretixpresale/scss/main.scss +++ b/src/pretix/static/pretixpresale/scss/main.scss @@ -96,7 +96,6 @@ body.loading .container { height: 100vh; background: rgba(255, 255, 255, .7); opacity: 0; - text-align: center; z-index: 900000; visibility: hidden; padding: 10px; @@ -107,14 +106,53 @@ body.loading .container { color: $brand-primary; } - .big-rotating-icon { - -webkit-animation: fa-spin 8s infinite linear; - animation: fa-spin 8s infinite linear; - margin-top: 50px; - font-size: 200px; - color: $brand-primary; + .modal-card { + margin: 50px auto 0; + top: 50px; + width: 90%; + max-width: 600px; + background: white; + border-radius: $border-radius-large; + box-shadow: 0 7px 14px 0 rgba(78, 50, 92, 0.1),0 3px 6px 0 rgba(0,0,0,.07); + padding: 20px; + min-height: 160px; + + .modal-card-icon { + float: left; + width: 150px; + text-align: center; + .big-rotating-icon { + -webkit-animation: fa-spin 8s infinite linear; + animation: fa-spin 8s infinite linear; + font-size: 120px; + color: $brand-primary; + } + } + .modal-card-content { + margin-left: 160px; + text-align: left; + h3 { + margin-top: 0; + } + } } } +@media (max-width: 700px) { + #loadingmodal, #ajaxerr { + .modal-card { + .modal-card-icon { + float: none; + width: 100%; + } + .modal-card-content { + text-align: center; + margin-left: 0; + margin-top: 10px; + } + } + } +} + #ajaxerr { background: rgba(236, 236, 236, .9); } diff --git a/src/pretix/testutils/settings.py b/src/pretix/testutils/settings.py index 966bc4e5f..54ae81b72 100644 --- a/src/pretix/testutils/settings.py +++ b/src/pretix/testutils/settings.py @@ -29,6 +29,9 @@ PASSWORD_HASHERS = ['django.contrib.auth.hashers.MD5PasswordHasher'] # Disable celery CELERY_ALWAYS_EAGER = True HAS_CELERY = False +CELERY_BROKER_URL = None +CELERY_RESULT_BACKEND = None +CELERY_TASK_ALWAYS_EAGER = True # Don't use redis SESSION_ENGINE = "django.contrib.sessions.backends.db"