aboutsummaryrefslogtreecommitdiff
path: root/app/templates
diff options
context:
space:
mode:
authorrubenwardy <rw@rubenwardy.com>2020-07-11 03:52:56 +0100
committerrubenwardy <rw@rubenwardy.com>2020-07-11 03:53:03 +0100
commitdfbcbbbb476cbbd467cabb1e36ea56ee84c99b43 (patch)
tree39255ac145664f3679788e774ae6cc750f41daa0 /app/templates
parent08f6bd8befa266d40f56b143193c8c1ca5fb2716 (diff)
downloadcheatdb-dfbcbbbb476cbbd467cabb1e36ea56ee84c99b43.tar.xz
Add ability to edit comments
Diffstat (limited to 'app/templates')
-rw-r--r--app/templates/macros/threads.html14
-rw-r--r--app/templates/threads/edit_reply.html17
2 files changed, 30 insertions, 1 deletions
diff --git a/app/templates/macros/threads.html b/app/templates/macros/threads.html
index e94cded..21283d7 100644
--- a/app/templates/macros/threads.html
+++ b/app/templates/macros/threads.html
@@ -22,8 +22,20 @@
</div>
<div class="card-body">
+ {% if current_user == thread.author and thread.review and thread.replies[0] == r %}
+ <a class="float-right btn btn-primary btn-sm ml-2"
+ href="{{ thread.review.package.getReviewURL() }}">
+ <i class="fas fa-edit"></i>
+ </a>
+ {% elif r.checkPerm(current_user, "EDIT_REPLY") %}
+ <a class="float-right btn btn-primary btn-sm ml-2"
+ href="{{ url_for('threads.edit_reply', id=thread.id, reply=r.id) }}">
+ <i class="fas fa-edit"></i>
+ </a>
+ {% endif %}
+
{% if r.checkPerm(current_user, "DELETE_REPLY") %}
- <a class="float-right btn btn-secondary btn-sm"
+ <a class="float-right btn btn-secondary btn-sm ml-2"
href="{{ url_for('threads.delete_reply', id=thread.id, reply=r.id) }}">
<i class="fas fa-trash"></i>
</a>
diff --git a/app/templates/threads/edit_reply.html b/app/templates/threads/edit_reply.html
new file mode 100644
index 0000000..9e92375
--- /dev/null
+++ b/app/templates/threads/edit_reply.html
@@ -0,0 +1,17 @@
+{% extends "base.html" %}
+
+{% block title %}
+ {{ _("Edit reply") }} - {{ thread.title }}
+{% endblock %}
+
+{% block content %}
+ <h1>{{ _("Edit reply") }}</h1>
+
+ {% from "macros/forms.html" import render_field, render_submit_field %}
+ <form method="POST" action="" enctype="multipart/form-data">
+ {{ form.hidden_tag() }}
+
+ {{ render_field(form.comment, label="", class_="m-0", fieldclass="form-control markdown") }} <br />
+ {{ render_submit_field(form.submit) }}
+ </form>
+{% endblock %}