mirror of
https://github.com/pacnpal/thrillwiki_django_no_react.git
synced 2025-12-20 06:31:09 -05:00
good stuff
This commit is contained in:
159
templates/moderation/admin/base.html
Normal file
159
templates/moderation/admin/base.html
Normal file
@@ -0,0 +1,159 @@
|
||||
{% extends "base/base.html" %}
|
||||
{% load static %}
|
||||
|
||||
{% block title %}ThrillWiki Moderation{% endblock %}
|
||||
|
||||
{% block extra_css %}
|
||||
<link rel="stylesheet" href="{% static 'css/inline-edit.css' %}">
|
||||
<style>
|
||||
.moderation-nav {
|
||||
@apply bg-white dark:bg-gray-800 border-b border-gray-200 dark:border-gray-700 shadow-sm;
|
||||
}
|
||||
|
||||
.moderation-nav-container {
|
||||
@apply container px-4 mx-auto;
|
||||
}
|
||||
|
||||
.moderation-nav ul {
|
||||
@apply flex items-center h-16 space-x-6;
|
||||
}
|
||||
|
||||
.moderation-nav li a {
|
||||
@apply flex items-center px-3 py-2 text-gray-700 dark:text-gray-300 rounded-lg hover:bg-gray-100 dark:hover:bg-gray-700 transition-colors;
|
||||
}
|
||||
|
||||
.moderation-nav li a.active {
|
||||
@apply bg-blue-50 text-blue-700 dark:bg-blue-900/50 dark:text-blue-300;
|
||||
}
|
||||
|
||||
.moderation-nav li a i {
|
||||
@apply mr-2;
|
||||
}
|
||||
|
||||
.moderation-content {
|
||||
@apply container px-4 py-6 mx-auto;
|
||||
}
|
||||
|
||||
.submission-list {
|
||||
@apply space-y-6;
|
||||
}
|
||||
|
||||
.submission-card {
|
||||
@apply bg-white dark:bg-gray-800 rounded-lg shadow-lg border border-gray-200/50 dark:border-gray-700/50;
|
||||
}
|
||||
|
||||
.submission-header {
|
||||
@apply flex justify-between items-start;
|
||||
}
|
||||
|
||||
.submission-meta {
|
||||
@apply text-sm text-gray-600 dark:text-gray-400;
|
||||
}
|
||||
|
||||
.submission-changes {
|
||||
@apply mt-4 space-y-2;
|
||||
}
|
||||
|
||||
.change-item {
|
||||
@apply flex items-start space-x-2 p-2 rounded bg-gray-50 dark:bg-gray-700/50;
|
||||
}
|
||||
|
||||
.change-field {
|
||||
@apply font-medium text-gray-900 dark:text-gray-100;
|
||||
}
|
||||
|
||||
.change-value {
|
||||
@apply text-gray-700 dark:text-gray-300;
|
||||
}
|
||||
|
||||
.action-buttons {
|
||||
@apply flex justify-end space-x-4 mt-4;
|
||||
}
|
||||
|
||||
.btn-approve {
|
||||
@apply px-4 py-2 text-white bg-green-600 rounded-lg hover:bg-green-700 dark:bg-green-500 dark:hover:bg-green-600;
|
||||
}
|
||||
|
||||
.btn-reject {
|
||||
@apply px-4 py-2 text-white bg-red-600 rounded-lg hover:bg-red-700 dark:bg-red-500 dark:hover:bg-red-600;
|
||||
}
|
||||
|
||||
.review-notes {
|
||||
@apply mt-4;
|
||||
}
|
||||
|
||||
.review-notes textarea {
|
||||
@apply w-full border-gray-300 rounded-lg form-textarea dark:border-gray-600 dark:bg-gray-700 dark:text-white;
|
||||
}
|
||||
|
||||
.filters {
|
||||
@apply p-4 bg-white dark:bg-gray-800 rounded-lg shadow-lg border border-gray-200/50 dark:border-gray-700/50;
|
||||
}
|
||||
|
||||
.form-select {
|
||||
@apply border-gray-300 rounded-lg dark:border-gray-600 dark:bg-gray-700 dark:text-white;
|
||||
}
|
||||
|
||||
.status-badge {
|
||||
@apply px-2 py-1 text-sm rounded-full;
|
||||
}
|
||||
|
||||
.status-pending {
|
||||
@apply bg-yellow-100 text-yellow-800 dark:bg-yellow-900 dark:text-yellow-200;
|
||||
}
|
||||
|
||||
.status-approved, .status-auto_approved {
|
||||
@apply bg-green-100 text-green-800 dark:bg-green-900 dark:text-green-200;
|
||||
}
|
||||
|
||||
.status-rejected {
|
||||
@apply bg-red-100 text-red-800 dark:bg-red-900 dark:text-red-200;
|
||||
}
|
||||
</style>
|
||||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<div class="moderation-nav">
|
||||
<div class="moderation-nav-container">
|
||||
<ul>
|
||||
<li>
|
||||
<a href="{% url 'moderation:admin:index' %}" class="{% if request.resolver_match.url_name == 'index' %}active{% endif %}">
|
||||
<i class="fas fa-tachometer-alt"></i>
|
||||
Dashboard
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="{% url 'moderation:edit_submissions' %}"
|
||||
class="{% if request.resolver_match.url_name == 'edit_submissions' %}active{% endif %}">
|
||||
<i class="fas fa-edit"></i>
|
||||
Edit Submissions
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="{% url 'moderation:photo_submissions' %}"
|
||||
class="{% if request.resolver_match.url_name == 'photo_submissions' %}active{% endif %}">
|
||||
<i class="fas fa-image"></i>
|
||||
Photo Submissions
|
||||
</a>
|
||||
</li>
|
||||
{% if user.role == 'ADMIN' or user.role == 'SUPERUSER' %}
|
||||
<li>
|
||||
<a href="{% url 'admin:index' %}"
|
||||
class="{% if request.resolver_match.url_name == 'admin' %}active{% endif %}">
|
||||
<i class="fas fa-shield-alt"></i>
|
||||
Admin Panel
|
||||
</a>
|
||||
</li>
|
||||
{% endif %}
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="moderation-content">
|
||||
{% block moderation_content %}{% endblock %}
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
||||
{% block extra_js %}
|
||||
<script src="{% static 'js/inline-edit.js' %}"></script>
|
||||
{% endblock %}
|
||||
142
templates/moderation/admin/edit_submission_list.html
Normal file
142
templates/moderation/admin/edit_submission_list.html
Normal file
@@ -0,0 +1,142 @@
|
||||
{% extends "moderation/admin/base.html" %}
|
||||
{% load static %}
|
||||
|
||||
{% block moderation_content %}
|
||||
<div class="submission-list">
|
||||
<h1 class="mb-6 text-2xl font-bold">Content Submissions</h1>
|
||||
|
||||
<div class="mb-6 filters">
|
||||
<form method="get" class="flex flex-wrap gap-4">
|
||||
<select name="status" class="form-select">
|
||||
<option value="">All Statuses</option>
|
||||
<option value="PENDING" {% if request.GET.status == 'PENDING' %}selected{% endif %}>Pending</option>
|
||||
<option value="APPROVED" {% if request.GET.status == 'APPROVED' %}selected{% endif %}>Approved</option>
|
||||
<option value="REJECTED" {% if request.GET.status == 'REJECTED' %}selected{% endif %}>Rejected</option>
|
||||
<option value="AUTO_APPROVED" {% if request.GET.status == 'AUTO_APPROVED' %}selected{% endif %}>Auto Approved</option>
|
||||
</select>
|
||||
<select name="type" class="form-select">
|
||||
<option value="">All Types</option>
|
||||
<option value="EDIT" {% if request.GET.type == 'EDIT' %}selected{% endif %}>Edits</option>
|
||||
<option value="CREATE" {% if request.GET.type == 'CREATE' %}selected{% endif %}>New Additions</option>
|
||||
</select>
|
||||
<button type="submit" class="px-4 py-2 text-white bg-blue-600 rounded-lg hover:bg-blue-700 dark:bg-blue-500 dark:hover:bg-blue-600">
|
||||
<i class="mr-2 fas fa-filter"></i>Filter
|
||||
</button>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
{% for submission in submissions %}
|
||||
<div class="p-6 mb-6 bg-white rounded-lg shadow dark:bg-gray-800">
|
||||
<div class="flex items-start justify-between mb-4">
|
||||
<div>
|
||||
<h3 class="text-lg font-semibold">
|
||||
{% if submission.submission_type == 'CREATE' %}
|
||||
New {{ submission.content_type.name }}
|
||||
{% else %}
|
||||
Edit to {{ submission.content_type.name }}: {{ submission.content_object }}
|
||||
{% endif %}
|
||||
</h3>
|
||||
<div class="mt-1 text-sm text-gray-600 dark:text-gray-400">
|
||||
Submitted by {{ submission.user.username }} on {{ submission.submitted_at|date:"M d, Y H:i" }}
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex items-center space-x-2">
|
||||
<div class="px-2 py-1 text-sm rounded-full {% if submission.submission_type == 'CREATE' %}bg-green-100 text-green-800 dark:bg-green-900 dark:text-green-200{% else %}bg-blue-100 text-blue-800 dark:bg-blue-900 dark:text-blue-200{% endif %}">
|
||||
{{ submission.get_submission_type_display }}
|
||||
</div>
|
||||
<div class="px-2 py-1 text-sm rounded-full {% if submission.status == 'PENDING' %}bg-yellow-100 text-yellow-800 dark:bg-yellow-900 dark:text-yellow-200
|
||||
{% elif submission.status == 'APPROVED' or submission.status == 'AUTO_APPROVED' %}bg-green-100 text-green-800 dark:bg-green-900 dark:text-green-200
|
||||
{% else %}bg-red-100 text-red-800 dark:bg-red-900 dark:text-red-200{% endif %}">
|
||||
{{ submission.get_status_display }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="p-4 mb-4 rounded-lg bg-gray-50 dark:bg-gray-700/50">
|
||||
<div class="mb-2">
|
||||
<strong>Reason:</strong> {{ submission.reason }}
|
||||
</div>
|
||||
{% if submission.source %}
|
||||
<div>
|
||||
<strong>Source:</strong> {{ submission.source }}
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
<div class="p-4 mb-4 rounded-lg bg-gray-50 dark:bg-gray-700/50">
|
||||
<h4 class="mb-2 font-medium">
|
||||
{% if submission.submission_type == 'CREATE' %}
|
||||
Details:
|
||||
{% else %}
|
||||
Changes:
|
||||
{% endif %}
|
||||
</h4>
|
||||
{% for field, value in submission.changes.items %}
|
||||
<div class="mb-2">
|
||||
<span class="font-medium">{{ field }}:</span>
|
||||
<span>{{ value }}</span>
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
|
||||
{% if submission.status == 'PENDING' %}
|
||||
<form method="post" class="mt-4">
|
||||
{% csrf_token %}
|
||||
<input type="hidden" name="submission_id" value="{{ submission.id }}">
|
||||
<div class="mb-4">
|
||||
<label class="block mb-2 font-medium">Review Notes:</label>
|
||||
<textarea name="review_notes" rows="3"
|
||||
class="w-full border-gray-300 rounded-lg form-textarea dark:border-gray-600 dark:bg-gray-700 dark:text-white"
|
||||
placeholder="{% if submission.submission_type == 'CREATE' %}Explain why you're approving/rejecting this new addition{% else %}Explain why you're approving/rejecting these changes{% endif %}"></textarea>
|
||||
</div>
|
||||
<div class="flex justify-end space-x-4">
|
||||
<button type="submit" name="action" value="reject"
|
||||
class="px-4 py-2 text-white bg-red-600 rounded-lg hover:bg-red-700 dark:bg-red-500 dark:hover:bg-red-600">
|
||||
<i class="mr-2 fas fa-times"></i>Reject
|
||||
</button>
|
||||
<button type="submit" name="action" value="approve"
|
||||
class="px-4 py-2 text-white bg-green-600 rounded-lg hover:bg-green-700 dark:bg-green-500 dark:hover:bg-green-600">
|
||||
<i class="mr-2 fas fa-check"></i>Approve
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
{% else %}
|
||||
<div class="p-4 rounded-lg bg-gray-50 dark:bg-gray-700/50">
|
||||
<div class="mb-2">
|
||||
<strong>Reviewed by:</strong> {{ submission.reviewed_by.username }} on {{ submission.reviewed_at|date:"M d, Y H:i" }}
|
||||
</div>
|
||||
{% if submission.review_notes %}
|
||||
<div>
|
||||
<strong>Review Notes:</strong> {{ submission.review_notes }}
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% empty %}
|
||||
<div class="p-8 text-center text-gray-500 dark:text-gray-400">
|
||||
No submissions found.
|
||||
</div>
|
||||
{% endfor %}
|
||||
|
||||
{% if is_paginated %}
|
||||
<div class="flex justify-center mt-6">
|
||||
<div class="inline-flex rounded-md shadow-sm">
|
||||
{% if page_obj.has_previous %}
|
||||
<a href="?page=1{{ request.GET.urlencode }}" class="px-3 py-2 text-gray-700 bg-white border border-gray-300 rounded-l-lg hover:bg-gray-50 dark:bg-gray-800 dark:border-gray-600 dark:text-gray-300 dark:hover:bg-gray-700">« First</a>
|
||||
<a href="?page={{ page_obj.previous_page_number }}{{ request.GET.urlencode }}" class="px-3 py-2 text-gray-700 bg-white border-t border-b border-gray-300 hover:bg-gray-50 dark:bg-gray-800 dark:border-gray-600 dark:text-gray-300 dark:hover:bg-gray-700">Previous</a>
|
||||
{% endif %}
|
||||
|
||||
<span class="px-3 py-2 text-gray-700 bg-white border border-gray-300 dark:bg-gray-800 dark:border-gray-600 dark:text-gray-300">
|
||||
Page {{ page_obj.number }} of {{ page_obj.paginator.num_pages }}
|
||||
</span>
|
||||
|
||||
{% if page_obj.has_next %}
|
||||
<a href="?page={{ page_obj.next_page_number }}{{ request.GET.urlencode }}" class="px-3 py-2 text-gray-700 bg-white border-t border-b border-gray-300 hover:bg-gray-50 dark:bg-gray-800 dark:border-gray-600 dark:text-gray-300 dark:hover:bg-gray-700">Next</a>
|
||||
<a href="?page={{ page_obj.paginator.num_pages }}{{ request.GET.urlencode }}" class="px-3 py-2 text-gray-700 bg-white border border-gray-300 rounded-r-lg hover:bg-gray-50 dark:bg-gray-800 dark:border-gray-600 dark:text-gray-300 dark:hover:bg-gray-700">Last »</a>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endblock %}
|
||||
104
templates/moderation/admin/photo_submission_list.html
Normal file
104
templates/moderation/admin/photo_submission_list.html
Normal file
@@ -0,0 +1,104 @@
|
||||
{% extends "moderation/admin/base.html" %}
|
||||
{% load static %}
|
||||
|
||||
{% block moderation_content %}
|
||||
<div class="submission-list">
|
||||
<h1 class="mb-6 text-2xl font-bold">Photo Submissions</h1>
|
||||
|
||||
<div class="mb-6 filters">
|
||||
<form method="get" class="flex space-x-4">
|
||||
<select name="status" class="form-select">
|
||||
<option value="">All Statuses</option>
|
||||
<option value="PENDING" {% if request.GET.status == 'PENDING' %}selected{% endif %}>Pending</option>
|
||||
<option value="APPROVED" {% if request.GET.status == 'APPROVED' %}selected{% endif %}>Approved</option>
|
||||
<option value="REJECTED" {% if request.GET.status == 'REJECTED' %}selected{% endif %}>Rejected</option>
|
||||
<option value="AUTO_APPROVED" {% if request.GET.status == 'AUTO_APPROVED' %}selected{% endif %}>Auto Approved</option>
|
||||
</select>
|
||||
<button type="submit" class="btn btn-primary">Filter</button>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
{% for submission in submissions %}
|
||||
<div class="submission-card">
|
||||
<div class="submission-header">
|
||||
<div>
|
||||
<h3 class="text-lg font-semibold">
|
||||
Photo for {{ submission.content_type.name }}: {{ submission.content_object }}
|
||||
</h3>
|
||||
<div class="submission-meta">
|
||||
Submitted by {{ submission.user.username }} on {{ submission.submitted_at|date:"M d, Y H:i" }}
|
||||
</div>
|
||||
</div>
|
||||
<div class="status-badge status-{{ submission.status|lower }}">
|
||||
{{ submission.get_status_display }}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="submission-details">
|
||||
<div class="mb-4 photo-preview">
|
||||
<img src="{{ submission.photo.url }}" alt="Submitted photo" class="max-w-lg rounded">
|
||||
</div>
|
||||
{% if submission.caption %}
|
||||
<div class="mb-2">
|
||||
<strong>Caption:</strong> {{ submission.caption }}
|
||||
</div>
|
||||
{% endif %}
|
||||
{% if submission.date_taken %}
|
||||
<div class="mb-2">
|
||||
<strong>Date Taken:</strong> {{ submission.date_taken|date:"M d, Y" }}
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
{% if submission.status == 'PENDING' %}
|
||||
<form method="post" class="mt-4">
|
||||
{% csrf_token %}
|
||||
<input type="hidden" name="submission_id" value="{{ submission.id }}">
|
||||
<div class="review-notes">
|
||||
<label class="block mb-2">Review Notes:</label>
|
||||
<textarea name="review_notes" rows="3" class="w-full"></textarea>
|
||||
</div>
|
||||
<div class="action-buttons">
|
||||
<button type="submit" name="action" value="approve" class="btn-approve">
|
||||
Approve
|
||||
</button>
|
||||
<button type="submit" name="action" value="reject" class="btn-reject">
|
||||
Reject
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
{% else %}
|
||||
<div class="mt-4">
|
||||
<strong>Reviewed by:</strong> {{ submission.reviewed_by.username }}
|
||||
<br>
|
||||
<strong>Review Notes:</strong> {{ submission.review_notes }}
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% empty %}
|
||||
<div class="py-8 text-center text-gray-500">
|
||||
No submissions found.
|
||||
</div>
|
||||
{% endfor %}
|
||||
|
||||
{% if is_paginated %}
|
||||
<div class="mt-6 pagination">
|
||||
<span class="step-links">
|
||||
{% if page_obj.has_previous %}
|
||||
<a href="?page=1">« first</a>
|
||||
<a href="?page={{ page_obj.previous_page_number }}">previous</a>
|
||||
{% endif %}
|
||||
|
||||
<span class="current">
|
||||
Page {{ page_obj.number }} of {{ page_obj.paginator.num_pages }}
|
||||
</span>
|
||||
|
||||
{% if page_obj.has_next %}
|
||||
<a href="?page={{ page_obj.next_page_number }}">next</a>
|
||||
<a href="?page={{ page_obj.paginator.num_pages }}">last »</a>
|
||||
{% endif %}
|
||||
</span>
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endblock %}
|
||||
Reference in New Issue
Block a user