Add ability to create bans from reports

This is done in the admin view and opens a new iframed window. The ban
form is pretty barebones and doesn't have full functionality yet, but
that is coming.

Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
This commit is contained in:
2022-06-23 16:03:09 -07:00
parent 5763c33f39
commit 470a10d2a7
9 changed files with 260 additions and 26 deletions

View File

@@ -1,4 +1,5 @@
{% extends "admin/change_list.html" %}
{% load static %}
{% block extrastyle %}
{{ block.super }}
<style>
@@ -9,5 +10,53 @@
background-color: var(--message-error-bg);
color: var(--error-fg);
}
.wb-min {
display: none;
}
.wb-max {
display: none;
}
.wb-full {
display: none;
}
</style>
{% endblock extrastyle %}
{% endblock extrastyle %}
{% block extrahead %}
{{block.super}}
<script src="{% static 'board/jquery.js' %}"></script>
<script src="{% static 'board/winbox.bundle.js' %}"></script>
{% endblock extrahead %}
{% block footer %}
{{block.super}}
<script>
function openBanWindow(e) {
e.preventDefault();
let banUrl = e.target.getAttribute("data-ban-url");
if (window.banWindow) {
window.banWindow.close();
}
window.banWindow = new WinBox("New ban", {
url: banUrl,
x: "center",
y: "center",
root: document.body,
onclose: function(force) {
window.top.banWindow = null;
}
});
}
function onLoad(e) {
window.banWindow = null;
}
$(".ban_link").on("click", openBanWindow);
$(window).on("load", onLoad);
</script>
{% endblock %}