Enabled asynchronous cart/order actions

This commit is contained in:
Raphael Michel
2015-10-04 19:54:17 +02:00
parent 4c6b292968
commit c4638a3402
28 changed files with 572 additions and 196 deletions

View File

@@ -13,6 +13,7 @@
<script type="text/javascript" src="{% static "js/jquery.formset.js" %}"></script>
<script type="text/javascript" src="{% static "bootstrap/dist/js/bootstrap.js" %}"></script>
<script type="text/javascript" src="{% static "pretixpresale/js/ui/main.js" %}"></script>
<script type="text/javascript" src="{% static "pretixpresale/js/ui/asynctask.js" %}"></script>
{% endcompress %}
{{ html_head|safe }}
<meta name="viewport" content="width=device-width, initial-scale=1">
@@ -63,6 +64,16 @@
{% endblocktrans %}
{% endwith %}
</footer>
<script type="text/javascript">
var default_loading_message = '{% trans "We are processing your request…" %}';
</script>
<div id="loadingmodal">
<i class="fa fa-cog big-rotating-icon"></i>
<h1>{% trans "We are processing your request…" %}</h1>
<p>
{% trans "If this takes longer than a few minutes, please contact us." %}
</p>
</div>
{% compress js %}
<script type="text/javascript" src="{% static "lightbox/js/lightbox.min.js" %}"></script>
{% endcompress %}

View File

@@ -5,7 +5,7 @@
{% block content %}
<h2>{% trans "Confirm order" %}</h2>
<p>{% trans "Please review the details below and confirm your order." %}</p>
<form method="post">
<form method="post" data-asynctask>
{% csrf_token %}
<div class="panel panel-primary cart">
<div class="panel-heading">

View File

@@ -37,7 +37,7 @@
{{ line.count }}
{% if editable %}
<form action="{% url "presale:event.cart.add" event=event.slug organizer=event.organizer.slug %}"
method="post">
method="post" data-asynctask>
{% csrf_token %}
{% if line.variation %}
<input type="hidden" name="variation_{{ line.item.identity }}_{{ line.variation.identity }}"

View File

@@ -50,7 +50,7 @@
</div>
{% endif %}
{% if event.presale_is_running or event.settings.show_items_outside_presale_period %}
<form method="post"
<form method="post" data-asynctask
action="{% url "presale:event.cart.add" organizer=request.event.organizer.slug event=request.event.slug %}?next={{ request.path|urlencode }}">
{% csrf_token %}
{% for tup in items_by_category %}

View File

@@ -3,11 +3,16 @@
{% load bootstrap3 %}
{% block title %}{% trans "Order details" %}{% endblock %}
{% block content %}
{% if "thanks" in request.GET %}
{% if "thanks" in request.GET or "paid" in request.GET %}
<div class="thank-you">
<span class="fa fa-check-circle"></span>
<h2>{% trans "Thank you!" %}</h2>
<p>{% trans "Your order has been placed successfully. See below for details." %}</p>
{% if order.status != 'p' %}
<p>{% trans "Your order has been placed successfully. See below for details." %}</p>
{% else %}
<p>{% trans "We successfully received your payment. See below for details." %}</p>
{% endif %}
<p>{% trans "We also sent you an email with a link to this page if you want to come back later." %}</p>
</div>
{% endif %}
@@ -18,7 +23,7 @@
{% include "pretixpresale/event/fragment_order_status.html" with order=order class="pull-right" %}
<div class="clearfix"></div>
</h2>
{% if order.status == "n" %}
{% if order.status == "n" %}
<div class="panel panel-danger">
<div class="panel-heading">
<h3 class="panel-title">
@@ -28,12 +33,14 @@
<div class="panel-body">
{% if can_retry %}
<a href="{% url "presale:event.order.pay" organizer=request.event.organizer.slug event=request.event.slug secret=order.secret order=order.code %}"
class="btn btn-primary pull-right"><i class="fa fa-money"></i> {% trans "Complete payment" %}</a>
class="btn btn-primary pull-right"><i class="fa fa-money"></i> {% trans "Complete payment" %}
</a>
{% endif %}
{{ payment }}
<strong>{% blocktrans trimmed with date=order.expires|date:"SHORT_DATE_FORMAT" %}
Please complete your payment before {{ date }}
{% endblocktrans %}</strong>
<div class="clearfix"></div>
</div>
</div>
@@ -88,7 +95,7 @@
<div class="col-md-12 text-right">
<p>
<a href="{% url 'presale:event.order.cancel' event=request.event.slug organizer=request.event.organizer.slug secret=order.secret order=order.code %}"
class="btn btn-danger">
class="btn btn-danger">
<span class="fa fa-remove"></span>
{% trans "Cancel order" %}
</a>

View File

@@ -0,0 +1,37 @@
{% load compress %}
{% load i18n %}
{% load staticfiles %}
<!DOCTYPE html>
<html>
<head>
<title>{{ settings.PRETIX_INSTANCE_NAME }}</title>
{% compress css %}
<link rel="stylesheet" type="text/less" href="{% static "pretixpresale/less/waiting.less" %}"/>
{% endcompress %}
{% compress js %}
<script type="text/javascript" src="{% static "jquery/js/jquery-2.1.1.min.js" %}"></script>
{% endcompress %}
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta http-equiv="refresh" content="1">
</head>
<body>
<div class="container">
<i class="fa fa-cog big-rotating-icon"></i>
<h1>{% trans "We are processing your request…" %}</h1>
<p>
{% trans "If this takes longer than a few minutes, please contact us." %}
</p>
</div>
<script type="text/javascript">
window.setInterval(function () {
$.get(location.href + '&ajax=1', function (data, status) {
if (data.ready && data.redirect) {
location.href = data.redirect;
}
}, 'json');
}, 2000);
</script>
</body>
</html>