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

@@ -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 %}