Moved static files and celery.py

This commit is contained in:
Raphael Michel
2017-01-04 21:59:31 +01:00
parent dd074a11d4
commit c639cd96f5
441 changed files with 453 additions and 15 deletions

View File

@@ -0,0 +1,60 @@
/*global $, waitingDialog, gettext */
var async_dl_url = null;
var async_dl_timeout = null;
function async_dl_check() {
"use strict";
$.ajax(
{
'type': 'GET',
'url': async_dl_url + '?ajax=1',
'success': async_dl_check_callback,
'error': async_dl_check_error,
'context': this,
}
);
}
function async_dl_check_callback(data, jqXHR, status) {
"use strict";
if (data == 1) {
$("body").data('ajaxing', false);
location.href = async_dl_url;
waitingDialog.hide();
return;
}
async_dl_timeout = window.setTimeout(async_dl_check, 250);
$("#loadingmodal p").text(gettext('Your request has been queued on the server and will now be ' +
'processed. If this takes longer than two minutes, please contact us or go ' +
'back in your browser and try again.'));
}
function async_dl_check_error(jqXHR, textStatus, errorThrown) {
"use strict";
$("body").data('ajaxing', false);
waitingDialog.hide();
var c = $(jqXHR.responseText).filter('.container');
if (c.length > 0) {
ajaxErrDialog.show(c.first().html());
} else if (jqXHR.status >= 400) {
alert(gettext('An error of type {code} occured.').replace(/\{code\}/, jqXHR.status));
}
}
$(function () {
"use strict";
$("body").on('click', 'a[data-asyncdownload]', function (e) {
e.preventDefault();
if ($("body").data('ajaxing')) {
return;
}
async_dl_url = $(this).attr("href");
$("body").data('ajaxing', true);
waitingDialog.show(gettext('We are processing your request …'));
$("#loadingmodal p").text(gettext('We are currently sending your request to the server. If this takes longer ' +
'than one minute, please check your internet connection and then reload ' +
'this page and try again.'));
async_dl_check();
});
});

View File

@@ -0,0 +1,121 @@
/*global $, waitingDialog, gettext */
var async_task_id = null;
var async_task_timeout = null;
var async_task_check_url = null;
function async_task_check() {
"use strict";
$.ajax(
{
'type': 'GET',
'url': async_task_check_url,
'success': async_task_check_callback,
'error': async_task_check_error,
'context': this,
'dataType': 'json'
}
);
}
function async_task_check_callback(data, jqXHR, status) {
"use strict";
if (data.ready && data.redirect) {
location.href = data.redirect;
return;
}
async_task_timeout = window.setTimeout(async_task_check, 250);
$("#loadingmodal p").text(gettext('Your request has been queued on the server and will now be ' +
'processed. If this takes longer than two minutes, please contact us or go ' +
'back in your browser and try again.'));
}
function async_task_check_error(jqXHR, textStatus, errorThrown) {
"use strict";
var c = $(jqXHR.responseText).filter('.container');
if (c.length > 0) {
$("body").data('ajaxing', false);
waitingDialog.hide();
ajaxErrDialog.show(c.first().html());
} else {
if (jqXHR.status >= 400 && jqXHR.status < 500) {
$("body").data('ajaxing', false);
waitingDialog.hide();
alert(gettext('An error of type {code} occured.').replace(/\{code\}/, jqXHR.status));
} else {
// 500 can be an application error or overload in some cases :(
$("#loadingmodal p").text(gettext('We currenctly cannot reach the server, but we keep trying.' +
' Last error code: {code}').replace(/\{code\}/, jqXHR.status));
async_task_timeout = window.setTimeout(async_task_check, 5000);
}
}
}
function async_task_callback(data, jqXHR, status) {
"use strict";
$("body").data('ajaxing', false);
if (data.redirect) {
location.href = data.redirect;
return;
}
async_task_id = data.async_id;
async_task_check_url = data.check_url;
async_task_timeout = window.setTimeout(async_task_check, 100);
$("#loadingmodal p").text(gettext('Your request has been queued on the server and will now be ' +
'processed. If this takes longer than two minutes, please contact us or go ' +
'back in your browser and try again.'));
if (location.href.indexOf("async_id") === -1) {
history.pushState({}, "Waiting", async_task_check_url.replace(/ajax=1/, ''));
}
}
function async_task_error(jqXHR, textStatus, errorThrown) {
"use strict";
$("body").data('ajaxing', false);
if (textStatus === "timeout") {
alert(gettext("The request took to long. Please try again."));
waitingDialog.hide();
} else if (jqXHR.responseText.indexOf('container') > 0) {
var c = $(jqXHR.responseText).filter('.container');
waitingDialog.hide();
ajaxErrDialog.show(c.first().html());
} else {
if (jqXHR.status >= 400 && jqXHR.status < 500) {
waitingDialog.hide();
alert(gettext('An error of type {code} occured.').replace(/\{code\}/, jqXHR.status));
} else {
waitingDialog.hide();
alert(gettext('We currenctly cannot reach the server. Please try again. ' +
'Error code: {code}').replace(/\{code\}/, jqXHR.status));
}
}
}
$(function () {
"use strict";
$("body").on('submit', 'form[data-asynctask]', function (e) {
e.preventDefault();
if ($("body").data('ajaxing')) {
return;
}
async_task_id = null;
$("body").data('ajaxing', true);
waitingDialog.show(gettext('We are processing your request …'));
$("#loadingmodal p").text(gettext('We are currently sending your request to the server. If this takes longer ' +
'than one minute, please check your internet connection and then reload ' +
'this page and try again.'));
$.ajax(
{
'type': 'POST',
'url': $(this).attr('action'),
'data': $(this).serialize() + '&ajax=1',
'success': async_task_callback,
'error': async_task_error,
'context': this,
'dataType': 'json',
'timeout': 60000,
}
);
});
});

View File

@@ -0,0 +1,37 @@
/*global $,gettext,ngettext */
var cart = {
_deadline: null,
_deadline_interval: null,
draw_deadline: function () {
var diff = Math.floor(cart._deadline.diff(moment()) / 1000 / 60);
if (diff < 0) {
$("#cart-deadline").text(gettext("The items in your cart are no longer reserved for you."));
window.clearInterval(cart._deadline_interval);
} else {
$("#cart-deadline").text(ngettext(
"The items in your cart are reserved for you for one minute.",
"The items in your cart are reserved for you for {num} minutes.",
diff
).replace(/\{num\}/g, diff));
}
},
init: function () {
"use strict";
cart._deadline = moment($("#cart-deadline").attr("data-expires"));
cart._deadline_interval = window.setInterval(cart.draw_deadline, 2000);
cart.draw_deadline();
}
};
$(function () {
"use strict";
moment.locale($("body").attr("data-locale").substr(0, 2));
if ($("#cart-deadline").length) {
cart.init();
}
});

View File

@@ -0,0 +1,106 @@
/*global $ */
function gettext(msgid) {
if (typeof django !== 'undefined' && typeof django.gettext !== 'undefined') {
return django.gettext(msgid);
}
return msgid;
}
function ngettext(singular, plural, count) {
if (typeof django !== 'undefined' && typeof django.ngettext !== 'undefined') {
return django.ngettext(singular, plural, count);
}
return plural;
}
$(function () {
"use strict";
$("input[data-toggle=radiocollapse]").change(function () {
$($(this).attr("data-parent")).find(".collapse.in").collapse('hide');
$($(this).attr("data-target")).collapse('show');
});
$(".js-only").removeClass("js-only");
$(".variations").hide();
$("a[data-toggle=variations]").click(function (e) {
$(this).parent().parent().parent().find(".variations").slideToggle();
e.preventDefault();
});
$(".collapsed").removeClass("collapsed").addClass("collapse");
$("#voucher-box").hide();
$("#voucher-toggle").show();
$("#voucher-toggle a").click(function () {
$("#voucher-box").slideDown();
$("#voucher-toggle").slideUp();
});
$("#ajaxerr").on("click", ".ajaxerr-close", ajaxErrDialog.hide);
// Copy answers
$(".js-copy-answers").click(function (e) {
e.preventDefault();
var idx = $(this).data('id');
copy_answers(idx);
});
});
function copy_answers(idx) {
var elements = $('*[data-idx="'+idx+'"] input, *[data-idx="'+idx+'"] select, *[data-idx="'+idx+'"] textarea');
var firstAnswers = $('*[data-idx="0"] input, *[data-idx="0"] select, *[data-idx="0"] textarea');
elements.each(function(index){
var input = $(this),
tagName = input.prop('tagName').toLowerCase(),
attributeType = input.attr('type');
switch (tagName) {
case "textarea":
input.val(firstAnswers.eq(index).val());
break;
case "select":
input.val(firstAnswers.eq(index).find(":selected").val()).change();
break;
case "input":
switch (attributeType) {
case "text":
case "number":
input.val(firstAnswers.eq(index).val());
break;
case "checkbox":
case "radio":
input.prop("checked", firstAnswers.eq(index).prop("checked"));
break;
default:
input.val(firstAnswers.eq(index).val());
}
break;
default:
input.val(firstAnswers.eq(index).val());
}
});
}
var waitingDialog = {
show: function (message) {
"use strict";
$("#loadingmodal").find("h1").html(message);
$("body").addClass("loading");
},
hide: function () {
"use strict";
$("body").removeClass("loading");
}
};
var ajaxErrDialog = {
show: function (c) {
"use strict";
$("#ajaxerr").html(c);
$("#ajaxerr .links").html("<a class='btn btn-default ajaxerr-close'>"
+ gettext("Close message") + "</a>");
$("body").addClass("ajaxerr");
},
hide: function () {
"use strict";
$("body").removeClass("ajaxerr");
}
};

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 11 KiB

View File

@@ -0,0 +1,78 @@
.cart-row {
/* Cart grid */
padding: 10px 0;
.count form {
display: inline;
}
.price, .count, .download-desktop {
text-align: right;
}
.price small,
.availability-box small {
display: block;
line-height: 1;
}
&.total {
border-top: 1px solid $table-border-color;
}
dl {
padding-left: 20px;
margin-bottom: 0;
dd {
padding-left: 20px;
}
}
margin-left: 0;
margin-right: 0;
&>div {
position: relative;
min-height: 1px;
padding-left: ceil(($grid-gutter-width / 2));
padding-right: floor(($grid-gutter-width / 2));
float: left;
}
.download-mobile {
display: none;
width: 100%;
clear: both;
}
.download-desktop {
display: block;
width: percentage((4 / $grid-columns));
}
.product {
width: percentage((4 / $grid-columns));
}
.count {
width: percentage((2 / $grid-columns));
}
.singleprice, .totalprice {
width: percentage((3 / $grid-columns));
}
&.has-downloads .product {
width: percentage((5 / $grid-columns));
}
}
@media(max-width: $screen-sm-max) {
.cart-row {
.download-mobile {
display: block;
}
.download-desktop {
display: none;
}
&.has-downloads .product, .product, .count, .singleprice, .totalprice {
width: 50%;
}
.singleprice {
clear: both;
}
}
}

View File

@@ -0,0 +1,117 @@
.product-row {
border-top: 1px solid $table-border-color;
&:last-child {
}
p {
margin-bottom: 0;
}
.input-item-count {
text-align: center;
}
.input-group-price {
margin-bottom: 3px;
}
.input-item-price {
text-align: right;
}
.availability-box {
text-align: center;
&.gone {
color: $alert-danger-text;
}
&.unavailable {
color: $alert-warning-text;
}
}
.productpicture {
float: left;
margin-right: 10px;
text-decoration: none;
display: block;
}
.radio-box {
text-align: center;
label {
display: block;
width: 100%;
line-height: 19px;
margin: 0;
}
}
}
.voucher-row {
margin-top: 10px;
}
#voucher-toggle {
display: none;
}
.item-with-variations .product-row.headline, .product-row.simple {
border-top: 2px solid $table-border-color;
}
.item-with-variations:last-child {
border-bottom: 2px solid $table-border-color;
}
.panel-body address:last-child {
margin-bottom: 0;
}
.product-row {
padding: 10px 0;
.count form {
display: inline;
}
.price, .count {
text-align: right;
}
.price small,
.availability-box small {
display: block;
line-height: 1;
}
&.total {
border-top: 1px solid $table-border-color;
}
}
.panel-contact dl {
margin-bottom: 0;
}
.panel-primary .panel-heading a {
color: white;
}
.checkout-button-row {
padding-top: 15px;
}
section.front-page {
margin-top: 30px;
}
.offline-banner {
background: $brand-danger;
color: white;
width: 100%;
padding: 5px;
text-align: center;
a {
text-decoration: underline;
color: white;
}
}
#questions_group .panel-title a {
line-height: 22px;
}
@media (max-width: $screen-sm-max) {
.page-header h1 small {
display: block;
}
.row-voucher > div:first-child {
margin-bottom: 15px;
}
}

View File

@@ -0,0 +1,16 @@
.panel-title .radio {
margin-left: 20px;
}
.form-control + .form-control-feedback {
/* Fix for https://github.com/FortAwesome/Font-Awesome/issues/4313 */
position: absolute;
top: 0;
right: 0;
z-index: 2; // Ensure icon is above input groups
display: block;
width: $input-height-base;
height: $input-height-base;
line-height: $input-height-base;
text-align: center;
pointer-events: none;
}

View File

@@ -0,0 +1,2 @@
$font-family-sans-serif: "Open Sans", "OpenSans", "Helvetica Neue", Helvetica, Arial, sans-serif !default;
$brand-primary: #8E44B3 !default;

View File

@@ -0,0 +1,27 @@
@import "../../bootstrap/scss/_bootstrap.scss";
@import "../../fontawesome/scss/font-awesome.scss";
@import "../../pretixbase/scss/colors.scss";
body {
background: #ececec;
text-align: center;
padding: 50px 0;
}
.big-rotating-icon {
margin-top: 50px;
-webkit-animation: fa-spin 8s infinite linear;
animation: fa-spin 8s infinite linear;
font-size: 200px;
color: $brand-primary;
}
.logo {
width: 330px;
margin: auto;
display: block;
margin-top: 10%;
height: auto;
max-width: 100%;
}

View File

@@ -0,0 +1,149 @@
@import "_variables.scss";
@import "../../pretixbase/scss/colors.scss";
@import "../../bootstrap/scss/_bootstrap.scss";
@import "../../fontawesome/scss/font-awesome.scss";
@import "_event.scss";
@import "_cart.scss";
@import "_forms.scss";
@import "../../pretixbase/scss/webfont.scss";
footer {
text-align: center;
padding: 10px 0;
font-size: 11px;
}
.page-header {
position: relative;
padding-bottom: 9px;
h1 {
margin: 0;
}
.loginbox {
padding-top: 15px;
}
.event-logo {
max-width: 100%;
height: auto;
}
}
.js-only {
display: none;
}
.locales {
display: inline;
a {
text-decoration: none;
}
a:hover {
border-bottom: 2px solid $gray-light;
}
a.active {
border-bottom: 2px solid $brand-primary;
}
img {
vertical-align: baseline;
}
}
.huge {
font-size: 40px;
}
a:hover .panel-primary > .panel-heading {
background-color: darken($btn-primary-bg, 10%);
border-color: darken($btn-primary-border, 12%);
}
.thank-you {
margin-bottom: 25px;
.fa {
font-size: 150px;
line-height: 170px;
display: block;
color: $brand-success;
}
h2 {
color: $brand-success;
}
}
body.loading .container {
-webkit-filter: blur(2px);
-moz-filter: blur(2px);
-ms-filter: blur(2px);
-o-filter: blur(2px);
filter: blur(2px);
}
#loadingmodal, #ajaxerr {
position: fixed;
top: 0;
left: 0;
width: 100vw;
height: 100vh;
background: rgba(255, 255, 255, .7);
opacity: 0;
text-align: center;
z-index: 900000;
visibility: hidden;
padding: 10px;
.big-icon {
margin-top: 50px;
font-size: 200px;
color: $brand-primary;
}
.big-rotating-icon {
-webkit-animation: fa-spin 8s infinite linear;
animation: fa-spin 8s infinite linear;
margin-top: 50px;
font-size: 200px;
color: $brand-primary;
}
}
#ajaxerr {
background: rgba(236, 236, 236, .9);
}
.loading #loadingmodal, .ajaxerr #ajaxerr {
opacity: 1;
visibility: visible;
transition: opacity .5s ease-in-out;
-moz-transition: opacity .5s ease-in-out;
-webkit-transition: opacity .5s ease-in-out;
}
@media (min-width: $screen-md-min) {
.thank-you {
min-height: 170px;
width: 70%;
margin: auto;
.fa {
float: left;
margin-right: 30px;
}
h2 {
padding-top: 35px;
}
p {
margin-left: 158px;
}
}
}
@media (max-width: $screen-sm-max) {
.thank-you {
text-align: center;
}
h2 {
margin-top: 0;
}
.checkout-button-row > div {
margin-bottom: 15px;
}
}

View File

@@ -0,0 +1,18 @@
@import "../../bootstrap/scss/_bootstrap.scss";
@import "../../fontawesome/scss/font-awesome.scss";
@import "../../pretixbase/scss/colors.scss";
body {
background: #ececec;
text-align: center;
padding: 50px 0;
}
.big-rotating-icon {
margin-top: 50px;
-webkit-animation: fa-spin 8s infinite linear;
animation: fa-spin 8s infinite linear;
font-size: 200px;
color: $brand-primary;
}