mirror of
https://github.com/pacnpal/thrillwiki_django_no_react.git
synced 2025-12-20 09:51:09 -05:00
here we go
This commit is contained in:
127
templates/moderation/edit_submissions.html
Normal file
127
templates/moderation/edit_submissions.html
Normal file
@@ -0,0 +1,127 @@
|
||||
{% extends 'base/base.html' %}
|
||||
{% load static %}
|
||||
|
||||
{% block title %}Moderation - ThrillWiki{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<div class="container px-4 mx-auto">
|
||||
<div class="p-6 bg-white rounded-lg shadow dark:bg-gray-800">
|
||||
<h1 class="mb-6 text-3xl font-bold text-gray-900 dark:text-white">Moderation Queue</h1>
|
||||
|
||||
<!-- Tabs -->
|
||||
<div class="mb-6 border-b border-gray-200 dark:border-gray-700">
|
||||
<ul class="flex flex-wrap -mb-px" role="tablist">
|
||||
<li class="mr-2">
|
||||
<button class="tab-button {% if active_tab == 'new' %}active{% endif %}"
|
||||
data-tab="new"
|
||||
hx-get="{% url 'moderation:edit_submissions' %}?tab=new"
|
||||
hx-target="#submissions-content"
|
||||
hx-push-url="true">
|
||||
New
|
||||
{% if new_count %}<span class="ml-2 badge">{{ new_count }}</span>{% endif %}
|
||||
</button>
|
||||
</li>
|
||||
<li class="mr-2">
|
||||
<button class="tab-button {% if active_tab == 'approved' %}active{% endif %}"
|
||||
data-tab="approved"
|
||||
hx-get="{% url 'moderation:edit_submissions' %}?tab=approved"
|
||||
hx-target="#submissions-content"
|
||||
hx-push-url="true">
|
||||
Approved
|
||||
</button>
|
||||
</li>
|
||||
<li class="mr-2">
|
||||
<button class="tab-button {% if active_tab == 'rejected' %}active{% endif %}"
|
||||
data-tab="rejected"
|
||||
hx-get="{% url 'moderation:edit_submissions' %}?tab=rejected"
|
||||
hx-target="#submissions-content"
|
||||
hx-push-url="true">
|
||||
Rejected
|
||||
</button>
|
||||
</li>
|
||||
{% if user.role == 'ADMIN' or user.role == 'SUPERUSER' %}
|
||||
<li>
|
||||
<button class="tab-button {% if active_tab == 'escalated' %}active{% endif %}"
|
||||
data-tab="escalated"
|
||||
hx-get="{% url 'moderation:edit_submissions' %}?tab=escalated"
|
||||
hx-target="#submissions-content"
|
||||
hx-push-url="true">
|
||||
Escalated
|
||||
{% if escalated_count %}<span class="ml-2 badge">{{ escalated_count }}</span>{% endif %}
|
||||
</button>
|
||||
</li>
|
||||
{% endif %}
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<!-- Tab Content -->
|
||||
<div id="submissions-content">
|
||||
{% include 'moderation/partials/submission_list.html' %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
||||
{% block extra_css %}
|
||||
<style>
|
||||
.tab-button {
|
||||
@apply inline-flex items-center px-4 py-2 text-sm font-medium border-b-2 border-transparent rounded-t-lg hover:text-gray-600 hover:border-gray-300 dark:hover:text-gray-300;
|
||||
}
|
||||
|
||||
.tab-button.active {
|
||||
@apply text-blue-600 border-blue-600 dark:text-blue-500 dark:border-blue-500;
|
||||
}
|
||||
|
||||
.badge {
|
||||
@apply px-2 py-1 text-xs font-semibold text-white bg-blue-500 rounded-full;
|
||||
}
|
||||
|
||||
.submission-card {
|
||||
@apply p-4 mb-4 bg-white border rounded-lg shadow dark:bg-gray-700 dark:border-gray-600;
|
||||
}
|
||||
|
||||
.submission-header {
|
||||
@apply flex items-center justify-between mb-2;
|
||||
}
|
||||
|
||||
.submission-title {
|
||||
@apply text-lg font-semibold text-gray-900 dark:text-white;
|
||||
}
|
||||
|
||||
.submission-meta {
|
||||
@apply text-sm text-gray-500 dark:text-gray-400;
|
||||
}
|
||||
|
||||
.submission-changes {
|
||||
@apply mt-4 space-y-2;
|
||||
}
|
||||
|
||||
.change-item {
|
||||
@apply flex items-start;
|
||||
}
|
||||
|
||||
.change-label {
|
||||
@apply w-32 font-medium text-gray-700 dark:text-gray-300;
|
||||
}
|
||||
|
||||
.change-value {
|
||||
@apply flex-1 text-gray-900 dark:text-white;
|
||||
}
|
||||
|
||||
.action-buttons {
|
||||
@apply flex gap-2 mt-4;
|
||||
}
|
||||
|
||||
.btn-approve {
|
||||
@apply px-4 py-2 text-white bg-green-500 rounded-lg hover:bg-green-600;
|
||||
}
|
||||
|
||||
.btn-reject {
|
||||
@apply px-4 py-2 text-white bg-red-500 rounded-lg hover:bg-red-600;
|
||||
}
|
||||
|
||||
.btn-escalate {
|
||||
@apply px-4 py-2 text-white bg-yellow-500 rounded-lg hover:bg-yellow-600;
|
||||
}
|
||||
</style>
|
||||
{% endblock %}
|
||||
88
templates/moderation/partials/submission_list.html
Normal file
88
templates/moderation/partials/submission_list.html
Normal file
@@ -0,0 +1,88 @@
|
||||
{% for submission in submissions %}
|
||||
<div class="submission-card">
|
||||
<div class="submission-header">
|
||||
<div>
|
||||
<h3 class="submission-title">
|
||||
{{ submission.get_content_type_display }} -
|
||||
{% if submission.submission_type == 'CREATE' %}New{% else %}Edit{% endif %}
|
||||
</h3>
|
||||
<div class="submission-meta">
|
||||
Submitted by {{ submission.user.username }} on {{ submission.created_at|date:"M d, Y H:i" }}
|
||||
</div>
|
||||
</div>
|
||||
{% if submission.status == 'APPROVED' %}
|
||||
<span class="px-2 py-1 text-sm text-white bg-green-500 rounded-full">Approved</span>
|
||||
{% elif submission.status == 'REJECTED' %}
|
||||
<span class="px-2 py-1 text-sm text-white bg-red-500 rounded-full">Rejected</span>
|
||||
{% elif submission.status == 'ESCALATED' %}
|
||||
<span class="px-2 py-1 text-sm text-white bg-yellow-500 rounded-full">Escalated</span>
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
{% if submission.reason %}
|
||||
<div class="p-3 mt-2 rounded bg-gray-50 dark:bg-gray-600">
|
||||
<div class="text-sm font-medium text-gray-700 dark:text-gray-300">Reason:</div>
|
||||
<div class="text-gray-600 dark:text-gray-400">{{ submission.reason }}</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
{% if submission.source %}
|
||||
<div class="p-3 mt-2 rounded bg-gray-50 dark:bg-gray-600">
|
||||
<div class="text-sm font-medium text-gray-700 dark:text-gray-300">Source:</div>
|
||||
<div class="text-gray-600 dark:text-gray-400">
|
||||
<a href="{{ submission.source }}" target="_blank" class="text-blue-500 hover:underline">
|
||||
{{ submission.source }}
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
<div class="submission-changes">
|
||||
{% for field, value in submission.changes.items %}
|
||||
<div class="change-item">
|
||||
<div class="change-label">{{ field|title }}:</div>
|
||||
<div class="change-value">{{ value }}</div>
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
|
||||
{% if submission.status == 'NEW' %}
|
||||
<div class="action-buttons">
|
||||
<button class="btn-approve"
|
||||
hx-post="{% url 'moderation:approve_submission' submission.id %}"
|
||||
hx-target="#submissions-content">
|
||||
<i class="mr-2 fas fa-check"></i>Approve
|
||||
</button>
|
||||
<button class="btn-reject"
|
||||
hx-post="{% url 'moderation:reject_submission' submission.id %}"
|
||||
hx-target="#submissions-content">
|
||||
<i class="mr-2 fas fa-times"></i>Reject
|
||||
</button>
|
||||
{% if user.role == 'MODERATOR' %}
|
||||
<button class="btn-escalate"
|
||||
hx-post="{% url 'moderation:escalate_submission' submission.id %}"
|
||||
hx-target="#submissions-content">
|
||||
<i class="mr-2 fas fa-arrow-up"></i>Escalate
|
||||
</button>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% elif submission.status == 'ESCALATED' and user.role in 'ADMIN,SUPERUSER' %}
|
||||
<div class="action-buttons">
|
||||
<button class="btn-approve"
|
||||
hx-post="{% url 'moderation:approve_submission' submission.id %}"
|
||||
hx-target="#submissions-content">
|
||||
<i class="mr-2 fas fa-check"></i>Approve
|
||||
</button>
|
||||
<button class="btn-reject"
|
||||
hx-post="{% url 'moderation:reject_submission' submission.id %}"
|
||||
hx-target="#submissions-content">
|
||||
<i class="mr-2 fas fa-times"></i>Reject
|
||||
</button>
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% empty %}
|
||||
<div class="p-8 text-center text-gray-500 dark:text-gray-400">
|
||||
No submissions found in this category.
|
||||
</div>
|
||||
{% endfor %}
|
||||
Reference in New Issue
Block a user