diff --git a/src/Makefile b/src/Makefile index 75bf37cfeb..c5edda3ab1 100644 --- a/src/Makefile +++ b/src/Makefile @@ -6,6 +6,7 @@ localecompile: localegen: ./manage.py makemessages --all --ignore "pretix/helpers/*" + ./manage.py makemessages --all -d djangojs --ignore "pretix/helpers/*" staticfiles: ./manage.py collectstatic --noinput diff --git a/src/pretix/base/templates/pretixbase/cachedfiles/pending.html b/src/pretix/base/templates/pretixbase/cachedfiles/pending.html index ec9ccca154..a24ca46234 100644 --- a/src/pretix/base/templates/pretixbase/cachedfiles/pending.html +++ b/src/pretix/base/templates/pretixbase/cachedfiles/pending.html @@ -10,6 +10,7 @@ {% endcompress %} {% compress js %} + {% endcompress %} @@ -21,14 +22,5 @@ {% trans "If this takes longer than a few minutes, please contact us." %}

- diff --git a/src/pretix/control/templates/pretixcontrol/items/question.html b/src/pretix/control/templates/pretixcontrol/items/question.html index c849f32c0c..f26719bc27 100644 --- a/src/pretix/control/templates/pretixcontrol/items/question.html +++ b/src/pretix/control/templates/pretixcontrol/items/question.html @@ -83,19 +83,4 @@ - {% endblock %} diff --git a/src/pretix/locale/de/LC_MESSAGES/djangojs.po b/src/pretix/locale/de/LC_MESSAGES/djangojs.po new file mode 100644 index 0000000000..a13c80727d --- /dev/null +++ b/src/pretix/locale/de/LC_MESSAGES/djangojs.po @@ -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 , 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 \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…" diff --git a/src/pretix/locale/de_Informal/LC_MESSAGES/djangojs.po b/src/pretix/locale/de_Informal/LC_MESSAGES/djangojs.po new file mode 100644 index 0000000000..a13c80727d --- /dev/null +++ b/src/pretix/locale/de_Informal/LC_MESSAGES/djangojs.po @@ -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 , 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 \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…" diff --git a/src/pretix/plugins/pretixdroid/static/pretixplugins/pretixdroid/pretixdroid.js b/src/pretix/plugins/pretixdroid/static/pretixplugins/pretixdroid/pretixdroid.js new file mode 100644 index 0000000000..d8edf42794 --- /dev/null +++ b/src/pretix/plugins/pretixdroid/static/pretixplugins/pretixdroid/pretixdroid.js @@ -0,0 +1,7 @@ +$(function () { + jQuery('#qrcodeCanvas').qrcode( + { + text: '{{ qrdata|safe }}' + } + ); +}); diff --git a/src/pretix/plugins/pretixdroid/templates/pretixplugins/pretixdroid/configuration.html b/src/pretix/plugins/pretixdroid/templates/pretixplugins/pretixdroid/configuration.html index 438cceec9c..d25ee91579 100644 --- a/src/pretix/plugins/pretixdroid/templates/pretixplugins/pretixdroid/configuration.html +++ b/src/pretix/plugins/pretixdroid/templates/pretixplugins/pretixdroid/configuration.html @@ -1,6 +1,7 @@ {% extends "pretixcontrol/event/base.html" %} {% load i18n %} {% load bootstrap3 %} +{% load staticfiles %} {% block title %}{% trans "pretixdroid configuration" %}{% endblock %} {% block content %}

{% trans "pretixdroid configuration" %}

@@ -9,11 +10,7 @@ If you try to configure the app, it will ask you to scan the QR code below. {% endblocktrans %}

- + {% trans "Reset authentication token" %} {% endblock %} diff --git a/src/pretix/plugins/statistics/static/pretixplugins/statistics/statistics.js b/src/pretix/plugins/statistics/static/pretixplugins/statistics/statistics.js new file mode 100644 index 0000000000..a47de0db7f --- /dev/null +++ b/src/pretix/plugins/statistics/static/pretixplugins/statistics/statistics.js @@ -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 + }); +}); \ No newline at end of file diff --git a/src/pretix/plugins/statistics/templates/pretixplugins/statistics/index.html b/src/pretix/plugins/statistics/templates/pretixplugins/statistics/index.html index 0a40df1453..814492728c 100644 --- a/src/pretix/plugins/statistics/templates/pretixplugins/statistics/index.html +++ b/src/pretix/plugins/statistics/templates/pretixplugins/statistics/index.html @@ -29,39 +29,9 @@
- + + + + {% endblock %} diff --git a/src/pretix/presale/templates/pretixpresale/base.html b/src/pretix/presale/templates/pretixpresale/base.html index 70f0aff9b3..89b6642943 100644 --- a/src/pretix/presale/templates/pretixpresale/base.html +++ b/src/pretix/presale/templates/pretixpresale/base.html @@ -9,6 +9,7 @@ {% endcompress %} + {% compress js %} @@ -36,9 +37,6 @@ {% endblocktrans %} {% endwith %} -

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

diff --git a/src/pretix/presale/templates/pretixpresale/waiting.html b/src/pretix/presale/templates/pretixpresale/waiting.html index e4fcdb4680..7a8f3d78b9 100644 --- a/src/pretix/presale/templates/pretixpresale/waiting.html +++ b/src/pretix/presale/templates/pretixpresale/waiting.html @@ -10,28 +10,20 @@ {% endcompress %} {% compress js %} + {% endcompress %} -
- +
+ -

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

+

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

-

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

-
- +

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

+
diff --git a/src/pretix/urls.py b/src/pretix/urls.py index bba8892af9..e72fd53b6c 100644 --- a/src/pretix/urls.py +++ b/src/pretix/urls.py @@ -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[^/]+)/$', pretix.base.views.cachedfiles.DownloadView.as_view(), - name='cachedfile.download') + url(r'^download/(?P[^/]+)/$', 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 = [ diff --git a/src/static/pretixbase/js/ajaxpending.js b/src/static/pretixbase/js/ajaxpending.js new file mode 100644 index 0000000000..788f24a361 --- /dev/null +++ b/src/static/pretixbase/js/ajaxpending.js @@ -0,0 +1,7 @@ +window.setInterval(function () { + $.get(location.href + '?ajax=1', function (data, status) { + if (data === "1") { + location.reload(); + } + }); +}, 500); diff --git a/src/static/pretixbase/js/reloadpending.js b/src/static/pretixbase/js/reloadpending.js new file mode 100644 index 0000000000..788f24a361 --- /dev/null +++ b/src/static/pretixbase/js/reloadpending.js @@ -0,0 +1,7 @@ +window.setInterval(function () { + $.get(location.href + '?ajax=1', function (data, status) { + if (data === "1") { + location.reload(); + } + }); +}, 500); diff --git a/src/static/pretixcontrol/js/ui/main.js b/src/static/pretixcontrol/js/ui/main.js index c883207571..980462328f 100644 --- a/src/static/pretixcontrol/js/ui/main.js +++ b/src/static/pretixcontrol/js/ui/main.js @@ -1,5 +1,13 @@ /*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 () { "use strict"; @@ -37,4 +45,12 @@ $(function () { }); $('.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(); + } }); diff --git a/src/static/pretixpresale/js/ui/asynctask.js b/src/static/pretixpresale/js/ui/asynctask.js index 4be61adc6b..143a95962b 100644 --- a/src/static/pretixpresale/js/ui/asynctask.js +++ b/src/static/pretixpresale/js/ui/asynctask.js @@ -1,4 +1,4 @@ -/*global $, waitingDialog, default_loading_message */ +/*global $, waitingDialog, gettext */ var async_task_id = null; var async_task_timeout = null; var async_task_check_url = null; @@ -56,7 +56,7 @@ $(function () { return; } $(this).data('ajaxing', true); - waitingDialog.show(default_loading_message); + waitingDialog.show(gettext('We are processing your request…')); $.ajax( {