mirror of
https://github.com/pretix/pretix.git
synced 2026-05-18 17:24:03 +00:00
change loading modal to pretix.dialog
This commit is contained in:
@@ -117,7 +117,6 @@ function async_task_callback(data, jqXHR, status) {
|
|||||||
$("body").data('ajaxing', false);
|
$("body").data('ajaxing', false);
|
||||||
if (data.redirect) {
|
if (data.redirect) {
|
||||||
if (async_task_is_download && data.success) {
|
if (async_task_is_download && data.success) {
|
||||||
waitingDialog.hide();
|
|
||||||
if (location.href.indexOf("async_id") !== -1) {
|
if (location.href.indexOf("async_id") !== -1) {
|
||||||
history.replaceState({}, "pretix", async_task_old_url);
|
history.replaceState({}, "pretix", async_task_old_url);
|
||||||
}
|
}
|
||||||
@@ -131,22 +130,21 @@ function async_task_callback(data, jqXHR, status) {
|
|||||||
|
|
||||||
if (async_task_is_long) {
|
if (async_task_is_long) {
|
||||||
if (data.started) {
|
if (data.started) {
|
||||||
$("#loadingmodal p.status").text(gettext(
|
window.pretix.dialog.open({
|
||||||
'Your request is currently being processed. Depending on the size of your event, this might take up to ' +
|
label: gettext("Your request is currently being processed."),
|
||||||
'a few minutes.'
|
message: gettext("Depending on the size of the event, this might take up to a few minutes."),
|
||||||
));
|
});
|
||||||
} else {
|
} else {
|
||||||
$("#loadingmodal p.status").text(gettext(
|
window.pretix.dialog.open({
|
||||||
'Your request has been queued on the server and will soon be ' +
|
label: gettext("Your request has been queued on the server."),
|
||||||
'processed.'
|
message: gettext("It will soon be processed."),
|
||||||
));
|
});
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$("#loadingmodal p.status").text(gettext(
|
window.pretix.dialog.open({
|
||||||
'Your request arrived on the server but we still wait for it to be ' +
|
label: gettext("Your request arrived on the server but we still wait for it to be processed."),
|
||||||
'processed. If this takes longer than two minutes, please contact us or go ' +
|
message: gettext("If this takes longer than two minutes, please contact us or go back in your browser and try again."),
|
||||||
'back in your browser and try again.'
|
});
|
||||||
));
|
|
||||||
}
|
}
|
||||||
if (location.href.indexOf("async_id") === -1) {
|
if (location.href.indexOf("async_id") === -1) {
|
||||||
history.pushState({}, "Waiting", async_task_check_url.replace(/ajax=1/, ''));
|
history.pushState({}, "Waiting", async_task_check_url.replace(/ajax=1/, ''));
|
||||||
@@ -157,14 +155,18 @@ function async_task_error(jqXHR, textStatus, errorThrown) {
|
|||||||
"use strict";
|
"use strict";
|
||||||
$("body").data('ajaxing', false);
|
$("body").data('ajaxing', false);
|
||||||
if (textStatus === "timeout") {
|
if (textStatus === "timeout") {
|
||||||
alert(gettext("The request took too long. Please try again."));
|
window.pretix.dialog.open({
|
||||||
waitingDialog.hide();
|
label: gettext("The request took too long …"),
|
||||||
|
message: gettext("Please try again."),
|
||||||
|
confirm: true,
|
||||||
|
});
|
||||||
} else if (jqXHR.responseText.indexOf('<html') > 0) {
|
} else if (jqXHR.responseText.indexOf('<html') > 0) {
|
||||||
var respdom = $(jqXHR.responseText);
|
var respdom = $(jqXHR.responseText);
|
||||||
var c = respdom.filter('.container');
|
var c = respdom.filter('.container');
|
||||||
if (respdom.filter('form') && (respdom.filter('.has-error') || respdom.filter('.alert-danger'))) {
|
if (respdom.filter('form') && (respdom.filter('.has-error') || respdom.filter('.alert-danger'))) {
|
||||||
// This is a failed form validation, let's just use it
|
// This is a failed form validation, let's just use it
|
||||||
waitingDialog.hide();
|
window.pretix.dialog.close();
|
||||||
|
// TODO: we need to give feedback regarding the error; either focus an element with error or better output another dialog?
|
||||||
|
|
||||||
if (respdom.filter('#page-wrapper') && $('#page-wrapper').length) {
|
if (respdom.filter('#page-wrapper') && $('#page-wrapper').length) {
|
||||||
$("#page-wrapper").html(respdom.find("#page-wrapper").html());
|
$("#page-wrapper").html(respdom.find("#page-wrapper").html());
|
||||||
@@ -186,20 +188,32 @@ function async_task_error(jqXHR, textStatus, errorThrown) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
} else if (c.length > 0) {
|
} else if (c.length > 0) {
|
||||||
waitingDialog.hide();
|
window.pretix.dialog.open({
|
||||||
ajaxErrDialog.show(c.first().html());
|
label: gettext('An error occurred.'),
|
||||||
|
message: c.first().text(),
|
||||||
|
confirm: true,
|
||||||
|
});
|
||||||
|
//ajaxErrDialog.show(c.first().html());
|
||||||
} else {
|
} else {
|
||||||
waitingDialog.hide();
|
window.pretix.dialog.open({
|
||||||
alert(gettext('An error of type {code} occurred.').replace(/\{code\}/, jqXHR.status));
|
label: gettext('An error of type {code} occurred.').replace(/\{code\}/, jqXHR.status),
|
||||||
|
message: gettext("Please try again."),
|
||||||
|
confirm: true,
|
||||||
|
});
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (jqXHR.status >= 400 && jqXHR.status < 500) {
|
if (jqXHR.status >= 400 && jqXHR.status < 500) {
|
||||||
waitingDialog.hide();
|
window.pretix.dialog.open({
|
||||||
alert(gettext('An error of type {code} occurred.').replace(/\{code\}/, jqXHR.status));
|
label: gettext('An error of type {code} occurred.').replace(/\{code\}/, jqXHR.status),
|
||||||
|
message: gettext("Please try again."),
|
||||||
|
confirm: true,
|
||||||
|
});
|
||||||
} else {
|
} else {
|
||||||
waitingDialog.hide();
|
window.pretix.dialog.open({
|
||||||
alert(gettext('We currently cannot reach the server. Please try again. ' +
|
label: gettext('We currently cannot reach the server.'),
|
||||||
'Error code: {code}').replace(/\{code\}/, jqXHR.status));
|
message: gettext("Please try again. Error code: {code}").replace(/\{code\}/, jqXHR.status),
|
||||||
|
confirm: true,
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -235,11 +249,6 @@ $(function () {
|
|||||||
icon: 'cog',
|
icon: 'cog',
|
||||||
});
|
});
|
||||||
|
|
||||||
window.setTimeout(function() {
|
|
||||||
window.pretix.dialog.close();
|
|
||||||
}, 2000);
|
|
||||||
return false;
|
|
||||||
|
|
||||||
var action = this.action;
|
var action = this.action;
|
||||||
var formData = new FormData(this);
|
var formData = new FormData(this);
|
||||||
formData.append('ajax', '1');
|
formData.append('ajax', '1');
|
||||||
|
|||||||
Reference in New Issue
Block a user