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__) log = logging.getLogger(__name__)
class ReportList(ListView): class ReportList(
LoginRequiredMixin,
UserPassesTestMixin,
ListView,
):
model = AbuseReport model = AbuseReport
paginate_by = 100 paginate_by = 100
def test_func(self) -> bool:
return self.request.user.is_moderator
def get_queryset(self): def get_queryset(self):
return AbuseReport.objects.all().order_by('-date_created') return AbuseReport.objects.all().order_by('-date_created')
@ -116,6 +123,6 @@ class ReportView(LoginRequiredMixin, DetailView):
def get_object(self, *args, **kwargs): def get_object(self, *args, **kwargs):
obj = super().get_object(*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() raise Http404()
return obj return obj

View File

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

View File

@ -1,33 +1,40 @@
{% extends "common/base.html" %} {% extends "common/base.html" %}
{% block content %} {% block content %}
<div class="p-5"> <div class="row">
<h4 class="mb-4"> <div class="col-md-6 mx-auto text-center">
{% if status == 400 %} <div class="box">
Bad Request <h3>
{% elif status == 401 %} {{ status }}
Unauthorized {% if status == 400 %}
{% elif status == 403 %} Bad Request
Forbidden {% elif status == 401 %}
{% elif status == 404 %} Unauthorized
Page Not Found {% elif status == 403 %}
{% elif status == 405 %} Forbidden
Method Not Allowed {% elif status == 404 %}
{#% elif status >= 500 %#} Page Not Found
{% else %} {% elif status == 405 %}
Houston, we have a problem Method Not Allowed
{% endif %} {% elif status >= 500 %}
</h4> Server Error
<div class="alert"> {% else %}
{% if status == 400 %} Houston, we have a problem.
{% elif status == 401 %} {% endif %}
{% elif status == 403 %} </h3>
{% elif status == 404 %} <p class="m-0">
The page you requested does not exist {% if status == 400 %}
{% elif status == 405 %} {% elif status == 401 %}
{% elif status >= 500 %} You are not authorized to visit this page.
{% else %} {% elif status == 403 %}
{% endif %} Access denied.
{% elif status == 404 %}
The page you requested does not exist.
{% elif status == 405 %}
{% elif status >= 500 %}
{% endif %}
</p>
</div> </div>
</div> </div>
</div>
{% endblock content %} {% 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> </thead>
<tbody> <tbody>
{% for extension in object_list %} {% for extension in object_list %}
<tr> {% if extension.get_status_display|lower != 'incomplete' %}
<td class="ext-review-list-type">{{ extension.get_type_display }}</td> {% include 'reviewers/components/review_list_item.html' %}
<td> {% elif user.is_moderator %}
<a href="{{ extension.get_review_url }}"> {% include 'reviewers/components/review_list_item.html' %}
{{ extension.name }} {% endif %}
</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>
{% endfor %} {% endfor %}
</tbody> </tbody>
</table> </table>