UI: Add 'ID' detail to info display on submission page #48

Merged
Márton Lente merged 6 commits from martonlente/extensions-website:ui-detail-info-display into main 2024-03-11 12:46:05 +01:00
5 changed files with 81 additions and 59 deletions
Showing only changes of commit 56f186e228 - Show all commits

View File

@ -17,10 +17,17 @@ import extensions.views.mixins
log = logging.getLogger(__name__)
class ReportList(ListView):
class ReportList(
LoginRequiredMixin,
UserPassesTestMixin,
ListView,
):
model = AbuseReport
paginate_by = 100
def test_func(self) -> bool:
return self.request.user.is_moderator
def get_queryset(self):
return AbuseReport.objects.all().order_by('-date_created')
@ -116,6 +123,6 @@ class ReportView(LoginRequiredMixin, DetailView):
def get_object(self, *args, **kwargs):
obj = super().get_object(*args, **kwargs)
if obj.reporter.pk != self.request.user.pk and not self.request.user.is_staff:
if obj.reporter.pk != self.request.user.pk and not self.request.user.is_moderator:
raise Http404()
return obj

View File

@ -145,6 +145,8 @@
<i class="i-coffee"></i> Admin
</a>
</li>
{% endif %}
{% if user.is_moderator %}
<li>
<a href="{% url 'abuse:report-list' %}" class="dropdown-item">
<i class="i-shield"></i> {% trans "Abuse Reports" %}

View File

@ -1,33 +1,40 @@
{% extends "common/base.html" %}
{% block content %}
<div class="p-5">
<h4 class="mb-4">
{% if status == 400 %}
Bad Request
{% elif status == 401 %}
Unauthorized
{% elif status == 403 %}
Forbidden
{% elif status == 404 %}
Page Not Found
{% elif status == 405 %}
Method Not Allowed
{#% elif status >= 500 %#}
{% else %}
Houston, we have a problem
{% endif %}
</h4>
<div class="alert">
{% if status == 400 %}
{% elif status == 401 %}
{% elif status == 403 %}
{% elif status == 404 %}
The page you requested does not exist
{% elif status == 405 %}
{% elif status >= 500 %}
{% else %}
{% endif %}
<div class="row">
<div class="col-md-6 mx-auto text-center">
<div class="box">
<h3>
{{ status }}
{% if status == 400 %}
Bad Request
{% elif status == 401 %}
Unauthorized
{% elif status == 403 %}
Forbidden
{% elif status == 404 %}
Page Not Found
{% elif status == 405 %}
Method Not Allowed
{% elif status >= 500 %}
Server Error
{% else %}
Houston, we have a problem.
{% endif %}
</h3>
<p class="m-0">
{% if status == 400 %}
{% elif status == 401 %}
You are not authorized to visit this page.
{% elif status == 403 %}
Access denied.
{% elif status == 404 %}
The page you requested does not exist.
{% elif status == 405 %}
{% elif status >= 500 %}
{% endif %}
</p>
</div>
</div>
</div>
{% endblock content %}

View File

@ -0,0 +1,31 @@
{% load filters %}
<tr>
<td class="ext-review-list-type">{{ extension.get_type_display }}</td>
<td>
<a href="{{ extension.get_review_url }}">
{{ extension.name }}
</a>
</td>
<td>
{% if extension.authors.count %}
{% include "extensions/components/authors.html" %}
{% endif %}
</td>
<td title="{{ extension.date_created }}">{{ extension.date_created|naturaltime_compact }}</td>
<td class="d-flex">
<a href="{{ extension.get_review_url }}#activity">
<span>{{ extension.review_activity.all|length }}</span>
</a>
{% if extension.review_activity.all %}
<a href="{{ extension.get_review_url }}#activity-{{ extension.review_activity.all.last.id }}" class="ml-3">
<span>{{ extension.review_activity.all.last.date_created|naturaltime_compact }}</span>
</a>
{% endif %}
</td>
<td>
<a href="{{ extension.get_review_url }}" class="text-decoration-none">
{% include "common/components/status.html" with object=extension class="d-block" %}
</a>
</td>
</tr>

View File

@ -35,36 +35,11 @@
</thead>
<tbody>
{% for extension in object_list %}
<tr>
<td class="ext-review-list-type">{{ extension.get_type_display }}</td>
<td>
<a href="{{ extension.get_review_url }}">
{{ extension.name }}
</a>
</td>
<td>
{% if extension.authors.count %}
{% include "extensions/components/authors.html" %}
{% endif %}
</td>
<td title="{{ extension.date_created }}">{{ extension.date_created|naturaltime_compact }}</td>
<td class="d-flex">
<a href="{{ extension.get_review_url }}#activity">
<span>{{ extension.review_activity.all|length }}</span>
</a>
{% if extension.review_activity.all %}
<a href="{{ extension.get_review_url }}#activity-{{ extension.review_activity.all.last.id }}" class="ml-3">
<span>{{ extension.review_activity.all.last.date_created|naturaltime_compact }}</span>
</a>
{% endif %}
</td>
<td>
<a href="{{ extension.get_review_url }}" class="text-decoration-none">
{% include "common/components/status.html" with object=extension class="d-block" %}
</a>
</td>
</tr>
{% if extension.get_status_display|lower != 'incomplete' %}
{% include 'reviewers/components/review_list_item.html' %}
{% elif user.is_moderator %}
{% include 'reviewers/components/review_list_item.html' %}
{% endif %}
{% endfor %}
</tbody>
</table>