Move openBanWindow to its own separate file

It is now shared between the admin view and the inline view.

Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
This commit is contained in:
2022-06-23 22:58:31 -07:00
parent 4c5d8cee2a
commit 024f0c1290
5 changed files with 26 additions and 21 deletions

View File

@@ -32,13 +32,15 @@
{{block.super}}
<script src="{% static 'board/jquery.js' %}"></script>
<script src="{% static 'board/winbox.bundle.js' %}"></script>
<script src="{% static 'board/ban_window.js' %}"></script>
{% endblock extrahead %}
{% block footer %}
{{block.super}}
<script>
function openBanWindow(e) {
/*
function openBanWindow(e, banUrl) {
e.preventDefault();
let banUrl = e.target.getAttribute("data-ban-url");
if (window.banWindow) {
@@ -55,12 +57,13 @@ function openBanWindow(e) {
}
});
}
*/
function onLoad(e) {
window.banWindow = null;
}
$(".ban_link").on("click", openBanWindow);
$(".ban_link").on("click", (e) => { openBanWindow(e, $(e.target).attr("data-ban-url")); });
$(window).on("load", onLoad);
</script>
{% endblock %}