load errors.js as standard and make it coop with async_task_replace_page

This commit is contained in:
Lukas Bockstaller
2026-06-15 11:41:28 +02:00
parent 5a6870fce1
commit 6d405a608f
4 changed files with 18 additions and 5 deletions
-1
View File
@@ -20,6 +20,5 @@
<div class="container">
{% block content %}{% endblock %}
</div>
<script src="{% static "pretixbase/js/errors.js" %}"></script>
</body>
</html>
@@ -22,4 +22,5 @@
<script type="text/javascript" src="{% static "pretixpresale/js/ui/iframe.js" %}"></script>
<script type="text/javascript" src="{% static "pretixbase/js/addressform.js" %}"></script>
<script type="text/javascript" src="{% static "pretixbase/js/deanonymize_email.js" %}"></script>
<script type="text/javascript" src="{% static "pretixbase/js/errors.js" %}"></script>
{% endcompress %}
@@ -107,6 +107,7 @@ function async_task_replace_page(target, new_html) {
setup_collapsible_details($(target));
window.setTimeout(function () { $(window).scrollTop(0) }, 200)
$(document).trigger("pretix:bind-forms");
$(document).trigger("pretix:async_task_replace_page");
}
function async_task_check_error(jqXHR, textStatus, errorThrown) {
+16 -4
View File
@@ -1,5 +1,17 @@
document.getElementById('goback').onclick =
function() {window.history.back()};
const registerErrorLinkHandlers = (reloadAll = false) => {
const backwards = document.getElementById('goback');
if (backwards) {
backwards.onclick = reloadAll
? () => window.location.reload(true)
: () => window.history.back();
}
document.getElementById('reload').onclick =
function() {window.location.reload(true)};
const reload = document.getElementById('reload');
if (reload) {
reload.onclick = () => window.location.reload(true);
}
};
registerErrorLinkHandlers();
$(document).on("pretix:async_task_replace_page", () => registerErrorLinkHandlers(true));