forked from CGM_Public/pretix_original
Asynctask JS: On errors, only replace inner part of page
This commit is contained in:
@@ -71,6 +71,7 @@ function async_task_check_error(jqXHR, textStatus, errorThrown) {
|
|||||||
jqXHR.responseText.indexOf("</body")
|
jqXHR.responseText.indexOf("</body")
|
||||||
));
|
));
|
||||||
form_handlers($("body"));
|
form_handlers($("body"));
|
||||||
|
setup_collapsible_details($("body"));
|
||||||
} else if (c.length > 0) {
|
} else if (c.length > 0) {
|
||||||
// This is some kind of 500/404/403 page, show it in an overlay
|
// This is some kind of 500/404/403 page, show it in an overlay
|
||||||
$("body").data('ajaxing', false);
|
$("body").data('ajaxing', false);
|
||||||
@@ -146,11 +147,20 @@ function async_task_error(jqXHR, textStatus, errorThrown) {
|
|||||||
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();
|
waitingDialog.hide();
|
||||||
$("body").html(jqXHR.responseText.substring(
|
|
||||||
jqXHR.responseText.indexOf("<body"),
|
if (respdom.filter('#page-wrapper') && $('#page-wrapper').length) {
|
||||||
jqXHR.responseText.indexOf("</body")
|
$("#page-wrapper").html(respdom.find("#page-wrapper").html());
|
||||||
));
|
form_handlers($("#page-wrapper"));
|
||||||
form_handlers($("body"));
|
setup_collapsible_details($("#page-wrapper"));
|
||||||
|
} else {
|
||||||
|
$("body").html(jqXHR.responseText.substring(
|
||||||
|
jqXHR.responseText.indexOf("<body"),
|
||||||
|
jqXHR.responseText.indexOf("</body")
|
||||||
|
));
|
||||||
|
form_handlers($("body"));
|
||||||
|
setup_collapsible_details($("body"));
|
||||||
|
}
|
||||||
|
|
||||||
} else if (c.length > 0) {
|
} else if (c.length > 0) {
|
||||||
waitingDialog.hide();
|
waitingDialog.hide();
|
||||||
ajaxErrDialog.show(c.first().html());
|
ajaxErrDialog.show(c.first().html());
|
||||||
|
|||||||
@@ -1,11 +1,8 @@
|
|||||||
/*global $ */
|
/*global $ */
|
||||||
|
|
||||||
$(function () {
|
setup_collapsible_details = function (el) {
|
||||||
"use strict";
|
|
||||||
|
|
||||||
var isOpera = Object.prototype.toString.call(window.opera) == '[object Opera]';
|
var isOpera = Object.prototype.toString.call(window.opera) == '[object Opera]';
|
||||||
|
el.find("details summary, details summary a[data-toggle=variations]").click(function (e) {
|
||||||
$("details summary, details summary a[data-toggle=variations]").click(function (e) {
|
|
||||||
if (this.tagName !== "A" && $(e.target).closest("a").length > 0) {
|
if (this.tagName !== "A" && $(e.target).closest("a").length > 0) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -55,4 +52,10 @@ $(function () {
|
|||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
$(function () {
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
setup_collapsible_details($("body"));
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user