aboutsummaryrefslogtreecommitdiff
path: root/app/templates
diff options
context:
space:
mode:
authorrubenwardy <rw@rubenwardy.com>2020-07-11 03:29:33 +0100
committerrubenwardy <rw@rubenwardy.com>2020-07-11 03:29:38 +0100
commit31b8a7931bdb95b296e236c11705206507b035d8 (patch)
treedafcdca8f5dea95a326c08125f7d035be812ddd9 /app/templates
parenta4dd4f04293b6ad6dab5d3dc0a4c52a3290b4394 (diff)
downloadcheatdb-31b8a7931bdb95b296e236c11705206507b035d8.tar.xz
Add ability for moderators to delete comments
Diffstat (limited to 'app/templates')
-rw-r--r--app/templates/admin/audit.html14
-rw-r--r--app/templates/admin/audit_view.html19
-rw-r--r--app/templates/macros/threads.html7
-rw-r--r--app/templates/threads/delete_reply.html22
4 files changed, 60 insertions, 2 deletions
diff --git a/app/templates/admin/audit.html b/app/templates/admin/audit.html
index 4255b72..1ac793b 100644
--- a/app/templates/admin/audit.html
+++ b/app/templates/admin/audit.html
@@ -9,7 +9,13 @@ Audit Log
<div class="list-group mt-3">
{% for entry in log %}
- <a class="list-group-item list-group-item-action" href="{{ entry.url }}">
+ <a class="list-group-item list-group-item-action"
+ {% if entry.description %}
+ href="{{ url_for('admin.audit_view', id=entry.id) }}">
+ {% else %}
+ href="{{ entry.url }}">
+ {% endif %}
+
<div class="row {% if entry.severity == entry.severity.NORMAL %}text-muted{% endif %}">
<div class="col-sm-auto text-center" style="width: 50px;">
{% if entry.severity == entry.severity.MODERATION %}
@@ -30,6 +36,10 @@ Audit Log
<div class="col-sm">
{{ entry.title}}
+
+ {% if entry.description %}
+ <i class="fas fa-paperclip ml-3"></i>
+ {% endif %}
</div>
{% if entry.package %}
@@ -54,5 +64,5 @@ Audit Log
{% else %}
<p class="list-group-item"><i>No audit log entires.</i></p>
{% endfor %}
- </ul>
+ </div>
{% endblock %}
diff --git a/app/templates/admin/audit_view.html b/app/templates/admin/audit_view.html
new file mode 100644
index 0000000..72e0f27
--- /dev/null
+++ b/app/templates/admin/audit_view.html
@@ -0,0 +1,19 @@
+{% extends "base.html" %}
+
+{% block title %}
+{{ entry.title }}
+{% endblock %}
+
+{% block content %}
+ {% if entry.url %}
+ <a class="float-right btn btn-primary" href="{{ entry.url }}">View</a>
+ {% endif %}
+
+ <h1>{{ entry.title }}</h1>
+ <p class="text-muted mb-4">
+ {{ _("Caused by %(author)s.", author=entry.causer.display_name) }}
+ </p>
+
+ <pre><code>{{ entry.description }}</code></pre>
+
+{% endblock %}
diff --git a/app/templates/macros/threads.html b/app/templates/macros/threads.html
index f9f298a..32acbc4 100644
--- a/app/templates/macros/threads.html
+++ b/app/templates/macros/threads.html
@@ -22,6 +22,13 @@
</div>
<div class="card-body">
+ {% if r != thread.replies[0] and thread.checkPerm(current_user, "DELETE_REPLY") %}
+ <a class="float-right btn btn-secondary btn-sm"
+ href="{{ url_for('threads.delete_reply', id=thread.id, reply=r.id) }}">
+ <i class="fas fa-trash"></i>
+ </a>
+ {% endif %}
+
{{ r.comment | markdown }}
</div>
</div>
diff --git a/app/templates/threads/delete_reply.html b/app/templates/threads/delete_reply.html
new file mode 100644
index 0000000..6c145df
--- /dev/null
+++ b/app/templates/threads/delete_reply.html
@@ -0,0 +1,22 @@
+{% extends "base.html" %}
+
+{% block title %}
+ Delete reply in {{ thread.title }}
+{% endblock %}
+
+{% block content %}
+ <form method="POST" action="" class="card box_grey">
+ <input type="hidden" name="csrf_token" value="{{ csrf_token() }}" />
+
+ <h3 class="card-header">Delete reply by {{ reply.author.display_name }}</h3>
+ <div class="card-body">
+ {{ reply.comment | markdown }}
+ </div>
+ <div class="card-body">
+ <p>Deleting is permanent</p>
+
+ <a class="btn btn-secondary mr-3" href="{{ thread.getViewURL() }}">Cancel</a>
+ <input type="submit" value="Delete" class="btn btn-danger" />
+ </div>
+ </form>
+{% endblock %}