Adding admin and report endpoints
This commit is contained in:
parent
af299a53c7
commit
6c128d0567
18 changed files with 335 additions and 6 deletions
28
app/templates/admin_base.html
Normal file
28
app/templates/admin_base.html
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>{{ site_name }}</title>
|
||||
<link rel="stylesheet" type="text/css" href="/static/style.css">
|
||||
<style>.done{opacity:.5}</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="header">
|
||||
<h1><a href="{{ url_for('admin.homepage') }}">{{ site_name }} Admin</a></h1>
|
||||
<div class="metanav">
|
||||
<!-- what does it go here? -->
|
||||
</div>
|
||||
</div>
|
||||
<div class="content">
|
||||
{% for message in get_flashed_messages() %}
|
||||
<div class="flash">{{ message }}</div>
|
||||
{% endfor %}
|
||||
{% block body %}{% endblock %}
|
||||
</div>
|
||||
<div class="footer">
|
||||
<p class="copyright">© 2019 Sakuragasaki46.
|
||||
<a href="/about/">About</a> - <a href="/terms/">Terms</a> -
|
||||
<a href="/privacy/">Privacy</a></p>
|
||||
</div>
|
||||
<script src="/static/lib.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
9
app/templates/admin_home.html
Normal file
9
app/templates/admin_home.html
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
{% extends "admin_base.html" %}
|
||||
|
||||
{% block body %}
|
||||
<ul>
|
||||
<li>
|
||||
<a href="{{ url_for('admin.reports') }}">Reports</a>
|
||||
</li>
|
||||
</ul>
|
||||
{% endblock %}
|
||||
27
app/templates/admin_report_detail.html
Normal file
27
app/templates/admin_report_detail.html
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
{% extends "admin_base.html" %}
|
||||
|
||||
{% block body %}
|
||||
<h2>Report detail #{{ report.id }}</h2>
|
||||
<p>Type: {{ [None, 'user', 'message'][report.media_type] }}</p>
|
||||
<p>Reason: <strong>{{ report_reasons[report.reason] }}</strong></p>
|
||||
<p>Status: <strong>{{ ['Unreviewed', 'Accepted', 'Declined'][report.status] }}</strong></p>
|
||||
|
||||
<h3>Detail</h3>
|
||||
{% if report.media is none %}
|
||||
<p><em>The media is unavailable.</em></p>
|
||||
{% elif report.media_type == 1 %}
|
||||
<p><em>Showing first 20 messages of the reported user.</em></p>
|
||||
<ul>
|
||||
{% for message in report.media.messages %}
|
||||
{% include "includes/reported_message.html" %}
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{% elif report.media_type == 2 %}
|
||||
{% set message = report.media %}
|
||||
{% include "includes/reported_message.html" %}
|
||||
{% endif %}
|
||||
<form method="POST">
|
||||
<input type="submit" name="take_down" value="Take down">
|
||||
<input type="submit" name="discard" value="Discard">
|
||||
</form>
|
||||
{% endblock %}
|
||||
16
app/templates/admin_reports.html
Normal file
16
app/templates/admin_reports.html
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
{% extends "admin_base.html" %}
|
||||
|
||||
{% block body %}
|
||||
<ul>
|
||||
{% for report in report_list %}
|
||||
<li {% if report.status > 0 %}class="done"{% endif %}>
|
||||
<p><strong>#{{ report.id }}</strong>
|
||||
(<a href="{{ url_for('admin.reports_detail', id=report.id) }}">detail</a>)</p>
|
||||
<p>Type: {{ [None, 'user', 'message'][report.media_type] }}</p>
|
||||
<p>Reason: <strong>{{ report_reasons[report.reason] }}</strong></p>
|
||||
<p>Status: <strong>{{ ['Unreviewed', 'Accepted', 'Declined'][report.status] }}</strong></p>
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{% include "includes/pagination.html" %}
|
||||
{% endblock %}
|
||||
|
|
@ -22,6 +22,6 @@
|
|||
<li><a href="/edit/{{ message.id }}">Edit or change privacy</a></li>
|
||||
<li><a href="/delete/{{ message.id }}">Delete permanently</a></li>
|
||||
{% else %}
|
||||
<!--li><a href="/report/{{ message.id }}">Report</a></li-->
|
||||
<li><a href="/report/message/{{ message.id }}" target="_blank">Report</a></li>
|
||||
{% endif %}
|
||||
</ul>
|
||||
|
|
|
|||
15
app/templates/includes/reported_message.html
Normal file
15
app/templates/includes/reported_message.html
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
<div>
|
||||
<p><strong>Message #{{ message.id }}</strong> (<a href="{# url_for('admin.message_info', id=message.id) #}">detail</a>)</p>
|
||||
<p>Author: <a href="{# url_for('admin.user_detail', id=message.user_id #}">{{ message.user.username }}</a></p>
|
||||
<p>Text:</p>
|
||||
<div style="border:1px solid gray;padding:12px">
|
||||
{{ message.text|enrich }}
|
||||
{% if message.uploads %}
|
||||
<div>
|
||||
<img src="/uploads/{{ message.uploads[0].filename() }}">
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
<p>Privacy: {{ ['public', 'unlisted', 'friends', 'only me'][message.privacy] }}</p>
|
||||
<p>Date: {{ message.pub_date.strftime('%B %-d, %Y %H:%M:%S') }}</p>
|
||||
</div>
|
||||
27
app/templates/report_base.html
Normal file
27
app/templates/report_base.html
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Report – Cori+</title>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<style>
|
||||
body{margin:0;font-family:sans-serif}
|
||||
.item{padding:12px;border-bottom:1px solid gray}
|
||||
.item h2{font-size:1em;margin:6px 0}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="content">
|
||||
{% block body %}{% endblock %}
|
||||
</div>
|
||||
<form id="reportForm" method="POST">
|
||||
<input id="reportFormValue" name="reason" type="hidden" value="">
|
||||
<input type="submit" style="display:none">
|
||||
</form>
|
||||
<script>
|
||||
function submitReport(value){
|
||||
reportFormValue.value = value;
|
||||
reportForm.submit();
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
11
app/templates/report_done.html
Normal file
11
app/templates/report_done.html
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
{% extends "report_base.html" %}
|
||||
|
||||
{% block body %}
|
||||
<div class="item">
|
||||
<h1>Done</h1>
|
||||
|
||||
<p>Your report has been sent.<br />
|
||||
We'll review the user or message, and, if against our Community
|
||||
Guidelines, we'll remove it.</p>
|
||||
</div>
|
||||
{% endblock %}
|
||||
11
app/templates/report_message.html
Normal file
11
app/templates/report_message.html
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
{% extends "report_base.html" %}
|
||||
|
||||
{% block body %}
|
||||
{% for reason in report_reasons %}
|
||||
<form method="POST">
|
||||
<div class="item" onclick="submitReport({{ reason[0] }})">
|
||||
<h2>{{ reason[1] }}</h2>
|
||||
</div>
|
||||
</form>
|
||||
{% endfor %}
|
||||
{% endblock %}
|
||||
11
app/templates/report_user.html
Normal file
11
app/templates/report_user.html
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
{% extends "report_base.html" %}
|
||||
|
||||
{% block body %}
|
||||
{% for reason in report_reasons %}
|
||||
<form method="POST">
|
||||
<div class="item" onclick="submitReport({{ reason[0] }})">
|
||||
<h2>{{ reason[1] }}</h2>
|
||||
</div>
|
||||
</form>
|
||||
{% endfor %}
|
||||
{% endblock %}
|
||||
Loading…
Add table
Add a link
Reference in a new issue