Basic reports admin templates

This commit is contained in:
Mouse Reeve 2021-03-09 12:35:07 -08:00
parent ff624e33fa
commit 999bff4bba
4 changed files with 57 additions and 8 deletions

View file

@ -1,2 +1,43 @@
{% extends 'settings/admin_layout.html' %}
{% load i18n %}
{% block title %}{% blocktrans with report_id=report.id %}Report #{{ report_id }}{% endblocktrans %}{% endblock %}
{% block header %}{% blocktrans with report_id=report.id %}Report #{{ report_id }}{% endblocktrans %}{% endblock %}
{% block panel %}
<div class="block">
<a href="{% url 'settings-reports' %}">{% trans "Back to reports" %}</a>
</div>
<div class="block">
{% include 'settings/report_preview.html' with report=report %}
</div>
<div class="block content">
<h3>{% trans "Actions" %}</h3>
<div class="field is-grouped">
<button class="button">Direct message</button>
<button class="button">Suspend</button>
</div>
{% for comment in report.reportcomment_set.all %}
<div class="block">
{{ comment }}
</div>
{% endfor %}
<form>
<label for="report_comment" class="label">Comment on report</label>
<textarea name="comment" id="report_comment" class="textarea"></textarea>
<button class="button">{% trans "Comment" %}</button>
</forM=m>
</div>
<div class="block content">
<h3>{% trans "Reported statuses" %}</h3>
<ul>
{% for status in report.statuses.all %}
<li>{{ status.id }}</li>
{% endfor %}
</ul>
</div>
{% endblock %}

View file

@ -1,19 +1,26 @@
{% extends 'components/card.html' %}
{% load i18n %}
{% load humanize %}
{% block card-header %}
<h2 class="card-header-title has-background-white-ter is-block">
<a href="{% url 'settings-report' report.id %}">report title</a>
<a href="{% url 'settings-report' report.id %}">{{ report.user.username }}</a>
</h2>
{% endblock %}
{% block card-content %}
<div class="block">
about this report
{% if report.notes %}{{ report.notes }}{% else %}<em>{% trans "No notes provided" %}</em>{% endif %}
</div>
{% endblock %}
{% block card-footer %}
<div class="card-footer-item">
footer
<p>{% blocktrans with username=report.reporter.display_name path=report.reporter.local_path %}Reported by <a href="{{ path }}">{{ username }}</a>{% endblocktrans %}</p>
</div>
<div class="card-footer-item">
{{ report.created_date | naturaltime }}
</div>
<div class="card-footer-item">
<button class="button">{% trans "Mark as resolved" %}</button>
</div>
{% endblock %}

View file

@ -1,16 +1,17 @@
{% extends 'settings/admin_layout.html' %}
{% load i18n %}
{% block title %}{% trans "Reports" %}{% endblock %}
{% block header %}{% trans "Reports" %}{% endblock %}
{% block panel %}
<div class="tabs">
<ul>
<li class="{% if filter == 'open' %}is-active{% endif %}"{% if filter == 'open' %} aria-current="page"{% endif %}>
<a href="{% url 'settings-reports' %}?status=open">{% trans "Open" %}</a>
<li class="{% if not resolved %}is-active{% endif %}"{% if not resolved == 'open' %} aria-current="page"{% endif %}>
<a href="{% url 'settings-reports' %}?resolved=false">{% trans "Open" %}</a>
</li>
<li class="{% if filter == 'resolved' %}is-active{% endif %}"{% if filter == 'resolved' %} aria-current="page"{% endif %}>
<a href="{% url 'settings-reports' %}?status=closed">{% trans "Resolved" %}</a>
<li class="{% if resolved %}is-active{% endif %}"{% if resolved %} aria-current="page"{% endif %}>
<a href="{% url 'settings-reports' %}?resolved=true">{% trans "Resolved" %}</a>
</li>
</ul>
</div>

View file

@ -24,7 +24,7 @@ class Reports(View):
def get(self, request):
""" view current reports """
resolved = request.GET.get("resolved", False)
resolved = request.GET.get("resolved") == "true"
data = {
"resolved": resolved,
"reports": models.Report.objects.filter(resolved=resolved),