Add preliminary report system

The report system is pretty low-tech. However the scaffolding is there
for a lot of new stuff. What we currently have:

* Users can create reports
* Staff can view reports
* Admins can create report templates

There's a post drop-down menu available on all posts now, too. This is
where "report post" menu item lives and other things like that can be
added too.

Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
This commit is contained in:
2022-06-14 14:56:50 -07:00
parent ec011dc047
commit b838663d50
9 changed files with 208 additions and 16 deletions

View File

@@ -1,6 +1,6 @@
{% load post_body %}
{% load l10n %}
<div id="p{{post.id}}">
<div id="p{{post.id}}" data-report-url="{% url 'board:report_form' board.url post.id %}">
{# Image #}
{% if post.thumbnail %}
{# Image info #}
@@ -19,7 +19,6 @@
{% endif %}
{# Post ID, username, time #}
<div class="post_content">
<a href="#p{{post.id}}">#.</a>
<span class="post_id">{{post.id}}</span>
{% if post.subject %}
@@ -32,8 +31,10 @@
{% if reply_link %}
[<a href="{{post.get_absolute_url}}">{% localize on %}Reply{% endlocalize %}</a>]
{% endif %}
<a href="#" class="post_menu_button" data-id="post_menu_button"></a>
{# "X replies elided" dialog for OPs on the board #}
<div class="post_content">
{% if replies_elided > 0 %}
<br/>
<span class="replies_elided">

View File

@@ -0,0 +1,16 @@
{% extends "board/base.html" %}
{% load l10n %}
{# Title #}
{% block title %}{% localize on %}Reporting post {{post.id}}{% endlocalize %}{% endblock %}
{# Body #}
{% block content %}
<div class="row">
<form method="post">
{% csrf_token %}
<table>
{{ form.as_table }}
<tr><td>&nbsp;</td><td><input type="submit" value="Submit"></td></tr>
</table>
</form>
</div>
{% endblock %}

View File

@@ -0,0 +1,29 @@
{% extends "board/base.html" %}
{% load l10n %}
{# Title #}
{% block title %}{% localize on %}Report success{% endlocalize %}{% endblock %}
{# Body #}
{% block content %}
<div class="row" id="message">
{% localize on %}Post reported. This window will close in 1 second.{% endlocalize %}
</div>
<script>
function isIframe() {
try {
return window.self !== window.top;
} catch (_) {
return true;
}
}
setTimeout(function() {
if(isIframe()) {
window.top.reportWindow.close();
} else {
window.close();
}
}, 5000);
</script>
{% endblock %}