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

@@ -6,6 +6,7 @@ localecompile:
localegen: localegen:
./manage.py makemessages --all --ignore "pretix/helpers/*" ./manage.py makemessages --all --ignore "pretix/helpers/*"
./manage.py makemessages --all -d djangojs --ignore "pretix/helpers/*"
staticfiles: staticfiles:
./manage.py collectstatic --noinput ./manage.py collectstatic --noinput

View File

@@ -10,6 +10,7 @@
{% endcompress %} {% endcompress %}
{% compress js %} {% compress js %}
<script type="text/javascript" src="{% static "jquery/js/jquery-2.1.1.min.js" %}"></script> <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 %} {% endcompress %}
<meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="viewport" content="width=device-width, initial-scale=1">
</head> </head>
@@ -21,14 +22,5 @@
{% trans "If this takes longer than a few minutes, please contact us." %} {% trans "If this takes longer than a few minutes, please contact us." %}
</p> </p>
</div> </div>
<script type="text/javascript">
window.setInterval(function() {
$.get(location.href + '?ajax=1', function(data, status) {
if (data === "1") {
location.reload();
}
});
}, 500);
</script>
</body> </body>
</html> </html>

View File

@@ -83,19 +83,4 @@
</button> </button>
</div> </div>
</form> </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 %} {% 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" %} {% extends "pretixcontrol/event/base.html" %}
{% load i18n %} {% load i18n %}
{% load bootstrap3 %} {% load bootstrap3 %}
{% load staticfiles %}
{% block title %}{% trans "pretixdroid configuration" %}{% endblock %} {% block title %}{% trans "pretixdroid configuration" %}{% endblock %}
{% block content %} {% block content %}
<h1>{% trans "pretixdroid configuration" %}</h1> <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. If you try to configure the app, it will ask you to scan the QR code below.
{% endblocktrans %}</p> {% endblocktrans %}</p>
<div id="qrcodeCanvas"></div> <div id="qrcodeCanvas"></div>
<script type="text/javascript"> <script type="text/javascript" src="{% static "pretixplugins/pretixdroid/pretixdroid.js" %}"></script>
jQuery('#qrcodeCanvas').qrcode({
text: '{{ qrdata|safe }}'
});
</script>
<a href="?flush_key=1" class="btn btn-default">{% trans "Reset authentication token" %}</a> <a href="?flush_key=1" class="btn btn-default">{% trans "Reset authentication token" %}</a>
{% endblock %} {% 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 id="obp_chart" style="height: 250px;"></div>
</div> </div>
</div> </div>
<script type="text/javascript"> <script type="application/json" id="obd-data">{{ obd_data|safe }}</script>
new Morris.Area({ <script type="application/json" id="rev-data">{{ rev_data|safe }}</script>
element: 'obd_chart', <script type="application/json" id="obp-data">{{ obp_data|safe }}</script>
data: {{ obd_data|safe }}, <script type="application/javascript" src="{% static "pretixplugins/statistics/statistics.js" %}"></script>
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>
{% endblock %} {% endblock %}

View File

@@ -9,6 +9,7 @@
<link rel="stylesheet" type="text/css" href="{% static "lightbox/css/lightbox.css" %}" /> <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" %}" /> <link rel="stylesheet" type="text/x-scss" href="{% static "pretixpresale/scss/main.scss" %}" />
{% endcompress %} {% endcompress %}
<script type="text/javascript" src="{% url 'javascript-catalog' %}"></script>
{% compress js %} {% compress js %}
<script type="text/javascript" src="{% static "jquery/js/jquery-2.1.1.min.js" %}"></script> <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> <script type="text/javascript" src="{% static "js/jquery.formset.js" %}"></script>
@@ -36,9 +37,6 @@
{% endblocktrans %} {% endblocktrans %}
{% endwith %} {% endwith %}
</footer> </footer>
<script type="text/javascript">
var default_loading_message = '{% trans "We are processing your request…" %}';
</script>
<div id="loadingmodal"> <div id="loadingmodal">
<i class="fa fa-cog big-rotating-icon"></i> <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>

View File

@@ -10,28 +10,20 @@
{% endcompress %} {% endcompress %}
{% compress js %} {% compress js %}
<script type="text/javascript" src="{% static "jquery/js/jquery-2.1.1.min.js" %}"></script> <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 %} {% endcompress %}
<meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="viewport" content="width=device-width, initial-scale=1">
<meta http-equiv="refresh" content="1"> <meta http-equiv="refresh" content="1">
</head> </head>
<body> <body>
<div class="container"> <div class="container">
<i class="fa fa-cog big-rotating-icon"></i> <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> <p>
{% trans "If this takes longer than a few minutes, please contact us." %} {% trans "If this takes longer than a few minutes, please contact us." %}
</p> </p>
</div> </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> </body>
</html> </html>

View File

@@ -1,16 +1,33 @@
import uuid
from django.conf import settings from django.conf import settings
from django.conf.urls import include, url 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.control.urls
import pretix.presale.urls import pretix.presale.urls
from .base.views import cachedfiles
# This is not a valid Django URL configuration, as the final # This is not a valid Django URL configuration, as the final
# configuration is done by the pretix.multidomain package. # 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 = [ base_patterns = [
url(r'^download/(?P<id>[^/]+)/$', pretix.base.views.cachedfiles.DownloadView.as_view(), url(r'^download/(?P<id>[^/]+)/$', cachedfiles.DownloadView.as_view(),
name='cachedfile.download') 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 = [ control_patterns = [

View File

@@ -0,0 +1,7 @@
window.setInterval(function () {
$.get(location.href + '?ajax=1', function (data, status) {
if (data === "1") {
location.reload();
}
});
}, 500);

View File

@@ -0,0 +1,7 @@
window.setInterval(function () {
$.get(location.href + '?ajax=1', function (data, status) {
if (data === "1") {
location.reload();
}
});
}, 500);

View File

@@ -1,5 +1,13 @@
/*global $*/ /*global $*/
function question_page_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);
}
$(function () { $(function () {
"use strict"; "use strict";
@@ -37,4 +45,12 @@ $(function () {
}); });
$('.collapsible').collapse(); $('.collapsible').collapse();
// Question editor
if ($("#answer-options").length) {
$("#id_type").change(question_page_toggle_view);
$("#id_required").change(question_page_toggle_view);
question_page_toggle_view();
}
}); });

View File

@@ -1,4 +1,4 @@
/*global $, waitingDialog, default_loading_message */ /*global $, waitingDialog, gettext */
var async_task_id = null; var async_task_id = null;
var async_task_timeout = null; var async_task_timeout = null;
var async_task_check_url = null; var async_task_check_url = null;
@@ -56,7 +56,7 @@ $(function () {
return; return;
} }
$(this).data('ajaxing', true); $(this).data('ajaxing', true);
waitingDialog.show(default_loading_message); waitingDialog.show(gettext('We are processing your request…'));
$.ajax( $.ajax(
{ {