Removed all inline <script> tags

This commit is contained in:
Raphael Michel
2016-04-10 16:44:49 +02:00
parent eafbe95370
commit 5cca426cd3
16 changed files with 157 additions and 87 deletions

View File

@@ -10,6 +10,7 @@
{% endcompress %}
{% compress js %}
<script type="text/javascript" src="{% static "jquery/js/jquery-2.1.1.min.js" %}"></script>
<script type="text/javascript" src="{% static "pretixbase/js/reloadpending.js" %}"></script>
{% endcompress %}
<meta name="viewport" content="width=device-width, initial-scale=1">
</head>
@@ -21,14 +22,5 @@
{% 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 === "1") {
location.reload();
}
});
}, 500);
</script>
</body>
</html>

View File

@@ -83,19 +83,4 @@
</button>
</div>
</form>
<script type="text/javascript">
$(function () {
function toggle_view() {
var show = $("#id_type").val() == "C" || $("#id_type").val() == "M";
$("#answer-options").toggle(show);
show = $("#id_type").val() == "B" && $("#id_required").prop("checked");
$(".alert-required-boolean").toggle(show);
}
$("#id_type").change(toggle_view);
$("#id_required").change(toggle_view);
toggle_view();
});
</script>
{% endblock %}

View File

@@ -0,0 +1,23 @@
# pretix translation file German
# Copyright (C) 2016 the pretix authors
# This file is distributed under the same license as the pretix package.
# Raphael Michel <michel@rami.io>, 2016.
#
msgid ""
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2016-04-10 14:29+0000\n"
"PO-Revision-Date: 2016-04-10 16:29+0200\n"
"Language: de\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
"Last-Translator: Raphael Michel <michel@rami.io>\n"
"Language-Team: \n"
"X-Generator: Poedit 1.8.7.1\n"
#: static/pretixpresale/js/ui/asynctask.js:59
msgid "We are processing your request…"
msgstr "Wir verarbeiten deine Anfrage…"

View File

@@ -0,0 +1,23 @@
# pretix translation file German
# Copyright (C) 2016 the pretix authors
# This file is distributed under the same license as the pretix package.
# Raphael Michel <michel@rami.io>, 2016.
#
msgid ""
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2016-04-10 14:29+0000\n"
"PO-Revision-Date: 2016-04-10 16:29+0200\n"
"Language: de\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
"Last-Translator: Raphael Michel <michel@rami.io>\n"
"Language-Team: \n"
"X-Generator: Poedit 1.8.7.1\n"
#: static/pretixpresale/js/ui/asynctask.js:59
msgid "We are processing your request…"
msgstr "Wir verarbeiten deine Anfrage…"

View File

@@ -0,0 +1,7 @@
$(function () {
jQuery('#qrcodeCanvas').qrcode(
{
text: '{{ qrdata|safe }}'
}
);
});

View File

@@ -1,6 +1,7 @@
{% extends "pretixcontrol/event/base.html" %}
{% load i18n %}
{% load bootstrap3 %}
{% load staticfiles %}
{% block title %}{% trans "pretixdroid configuration" %}{% endblock %}
{% block content %}
<h1>{% trans "pretixdroid configuration" %}</h1>
@@ -9,11 +10,7 @@
If you try to configure the app, it will ask you to scan the QR code below.
{% endblocktrans %}</p>
<div id="qrcodeCanvas"></div>
<script type="text/javascript">
jQuery('#qrcodeCanvas').qrcode({
text: '{{ qrdata|safe }}'
});
</script>
<script type="text/javascript" src="{% static "pretixplugins/pretixdroid/pretixdroid.js" %}"></script>
<a href="?flush_key=1" class="btn btn-default">{% trans "Reset authentication token" %}</a>
{% endblock %}

View File

@@ -0,0 +1,35 @@
/*globals $, Morris*/
$(function () {
new Morris.Area({
element: 'obd_chart',
data: JSON.parse($("#obd-data").html()),
xkey: 'date',
ykeys: ['ordered', 'paid'],
labels: ['{% trans "Placed orders" %}', '{% trans "Paid orders" %}'],
lineColors: ['#000099', '#009900'],
smooth: false,
resize: true,
fillOpacity: 0.3,
behaveLikeLine: true
});
new Morris.Area({
element: 'rev_chart',
data: JSON.parse($("#rev-data").html()),
xkey: 'date',
ykeys: ['revenue'],
labels: ['{% trans "Total revenue" %}'],
smooth: false,
resize: true,
fillOpacity: 0.3,
preUnits: '{{ request.event.currency }} '
});
new Morris.Bar({
element: 'obp_chart',
data: JSON.parse($("#odp-data").html()),
xkey: 'item',
ykeys: ['ordered', 'paid'],
labels: ['{% trans "Placed orders" %}', '{% trans "Paid orders" %}'],
barColors: ['#000099', '#009900'],
resize: true
});
});

View File

@@ -29,39 +29,9 @@
<div id="obp_chart" style="height: 250px;"></div>
</div>
</div>
<script type="text/javascript">
new Morris.Area({
element: 'obd_chart',
data: {{ obd_data|safe }},
xkey: 'date',
ykeys: ['ordered', 'paid'],
labels: ['{% trans "Placed orders" %}', '{% trans "Paid orders" %}'],
lineColors: ['#000099', '#009900'],
smooth: false,
resize: true,
fillOpacity: 0.3,
behaveLikeLine: true
});
new Morris.Area({
element: 'rev_chart',
data: {{ rev_data|safe }},
xkey: 'date',
ykeys: ['revenue'],
labels: ['{% trans "Total revenue" %}'],
smooth: false,
resize: true,
fillOpacity: 0.3,
preUnits: '{{ request.event.currency }} '
});
new Morris.Bar({
element: 'obp_chart',
data: {{ obp_data|safe }},
xkey: 'item',
ykeys: ['ordered', 'paid'],
labels: ['{% trans "Placed orders" %}', '{% trans "Paid orders" %}'],
barColors: ['#000099', '#009900'],
resize: true
});
</script>
<script type="application/json" id="obd-data">{{ obd_data|safe }}</script>
<script type="application/json" id="rev-data">{{ rev_data|safe }}</script>
<script type="application/json" id="obp-data">{{ obp_data|safe }}</script>
<script type="application/javascript" src="{% static "pretixplugins/statistics/statistics.js" %}"></script>
{% endblock %}

View File

@@ -9,6 +9,7 @@
<link rel="stylesheet" type="text/css" href="{% static "lightbox/css/lightbox.css" %}" />
<link rel="stylesheet" type="text/x-scss" href="{% static "pretixpresale/scss/main.scss" %}" />
{% endcompress %}
<script type="text/javascript" src="{% url 'javascript-catalog' %}"></script>
{% compress js %}
<script type="text/javascript" src="{% static "jquery/js/jquery-2.1.1.min.js" %}"></script>
<script type="text/javascript" src="{% static "js/jquery.formset.js" %}"></script>
@@ -36,9 +37,6 @@
{% 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>

View File

@@ -10,28 +10,20 @@
{% endcompress %}
{% compress js %}
<script type="text/javascript" src="{% static "jquery/js/jquery-2.1.1.min.js" %}"></script>
<script type="text/javascript" src="{% static "pretixbase/js/ajaxpending.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>
<div class="container">
<i class="fa fa-cog big-rotating-icon"></i>
<h1>{% trans "We are processing your request…" %}</h1>
<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>
<p>
{% trans "If this takes longer than a few minutes, please contact us." %}
</p>
</div>
</body>
</html>

View File

@@ -1,16 +1,33 @@
import uuid
from django.conf import settings
from django.conf.urls import include, url
from django.utils import timezone
from django.views.decorators.cache import cache_page
from django.views.decorators.http import etag
from django.views.i18n import javascript_catalog
import pretix.base.views.cachedfiles
import pretix.control.urls
import pretix.presale.urls
from .base.views import cachedfiles
# This is not a valid Django URL configuration, as the final
# configuration is done by the pretix.multidomain package.
js_info_dict = {
'packages': ('pretix',),
}
# Yes, we want to regenerate this every time the module has been imported to
# refresh the cache at least at every code deployment
import_date = timezone.now().strftime("%Y%m%d%H%M")
base_patterns = [
url(r'^download/(?P<id>[^/]+)/$', pretix.base.views.cachedfiles.DownloadView.as_view(),
name='cachedfile.download')
url(r'^download/(?P<id>[^/]+)/$', cachedfiles.DownloadView.as_view(),
name='cachedfile.download'),
url(r'^jsi18n/$',
etag(lambda *s, **k: import_date)(cache_page(3600, key_prefix='js18n-%s' % import_date)(javascript_catalog)),
js_info_dict, name='javascript-catalog'),
]
control_patterns = [