Improved modapp quite a bit including pagination.
This commit is contained in:
@@ -7,6 +7,7 @@
|
||||
<link rel="stylesheet" href="/static/css/styles.css">
|
||||
</head>
|
||||
<body bgcolor="#ffffff" text="#000000" link="#c08000" vlink="#c08000" alink="#c08000">
|
||||
|
||||
<!-- Navigation -->
|
||||
<center>
|
||||
<table cellpadding="2" cellspacing="0" width="80%" border="0">
|
||||
@@ -27,7 +28,6 @@
|
||||
<a href="/random">Random</a> /
|
||||
<a href="/submit">Submit</a> /
|
||||
<a href="/browse">Browse</a> /
|
||||
<a href="/top">Top 100</a> /
|
||||
<a href="/modapp">Modapp</a>
|
||||
</td>
|
||||
</tr>
|
||||
@@ -36,73 +36,72 @@
|
||||
|
||||
<!-- Main Content: All Quotes for Moderation -->
|
||||
<center>
|
||||
<table cellpadding="2" cellspacing="0" width="80%">
|
||||
<h2>All Quotes for Moderation</h2>
|
||||
|
||||
<!-- Filter Options -->
|
||||
<form method="GET" action="/modapp">
|
||||
<label for="filter">Filter by:</label>
|
||||
<select name="filter" id="filter">
|
||||
<option value="pending" {% if filter_status == 'pending' %}selected{% endif %}>Pending</option>
|
||||
<option value="approved" {% if filter_status == 'approved' %}selected{% endif %}>Approved</option>
|
||||
<option value="rejected" {% if filter_status == 'rejected' %}selected{% endif %}>Rejected</option>
|
||||
</select>
|
||||
<input type="submit" value="Apply Filter">
|
||||
</form>
|
||||
|
||||
{% if quotes.items %}
|
||||
<!-- Table for Quotes -->
|
||||
<table border="1" cellpadding="5" cellspacing="0" width="100%">
|
||||
<tr>
|
||||
<td class="bodytext">
|
||||
<h2>All Quotes for Moderation</h2>
|
||||
|
||||
<!-- Check if there are any quotes -->
|
||||
{% if all_quotes %}
|
||||
<form method="POST" action="/modapp/bulk_action">
|
||||
<table border="1" cellpadding="5" cellspacing="0" width="100%">
|
||||
<tr>
|
||||
<th>Select</th>
|
||||
<th>Quote ID</th>
|
||||
<th>Quote</th>
|
||||
<th>Status</th>
|
||||
<th>Submitted At</th>
|
||||
<th>IP Address</th>
|
||||
<th>User Agent</th>
|
||||
<th>Actions</th>
|
||||
</tr>
|
||||
<!-- Loop through each quote -->
|
||||
{% for quote in all_quotes %}
|
||||
<tr style="background-color:
|
||||
{% if quote.status == 1 %} #d4edda {% elif quote.status == 2 %} #f8d7da {% else %} #fff {% endif %}">
|
||||
<td><input type="checkbox" name="quote_ids[]" value="{{ quote.id }}"></td>
|
||||
<td>#{{ quote.id }}</td>
|
||||
<td>{{ quote.text }}</td>
|
||||
<td>
|
||||
{% if quote.status == 0 %}
|
||||
Pending
|
||||
{% elif quote.status == 1 %}
|
||||
Approved
|
||||
{% else %}
|
||||
Rejected
|
||||
{% endif %}
|
||||
</td>
|
||||
<td>
|
||||
{% if quote.submitted_at %}
|
||||
{{ quote.submitted_at.strftime('%Y-%m-%d %H:%M:%S') }}
|
||||
{% else %}
|
||||
N/A
|
||||
{% endif %}
|
||||
</td>
|
||||
<td>{{ quote.ip_address }}</td>
|
||||
<td>{{ quote.user_agent }}</td>
|
||||
<td>
|
||||
<a href="/approve/{{ quote.id }}">Approve</a> |
|
||||
<a href="/reject/{{ quote.id }}">Reject</a> |
|
||||
<a href="/delete/{{ quote.id }}">Delete</a>
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</table>
|
||||
|
||||
<!-- Bulk Action Dropdown and Submit -->
|
||||
<select name="action">
|
||||
<option value="approve">Approve Selected</option>
|
||||
<option value="reject">Reject Selected</option>
|
||||
<option value="delete">Delete Selected</option>
|
||||
</select>
|
||||
<input type="submit" value="Apply">
|
||||
</form>
|
||||
<th>Quote ID</th>
|
||||
<th>Quote</th>
|
||||
<th>Status</th>
|
||||
<th>Submitted At</th>
|
||||
<th>IP Address</th>
|
||||
<th>User Agent</th>
|
||||
<th>Actions</th>
|
||||
</tr>
|
||||
<!-- Loop through quotes -->
|
||||
{% for quote in quotes.items %}
|
||||
<tr style="background-color:
|
||||
{% if quote.status == 1 %} #d4edda {% elif quote.status == 2 %} #f8d7da {% else %} #fff {% endif %}">
|
||||
<td>#{{ quote.id }}</td>
|
||||
<td>{{ quote.text }}</td>
|
||||
<td>
|
||||
{% if quote.status == 0 %}
|
||||
Pending
|
||||
{% elif quote.status == 1 %}
|
||||
Approved
|
||||
{% else %}
|
||||
<p>No quotes available for moderation at the moment.</p>
|
||||
Rejected
|
||||
{% endif %}
|
||||
</td>
|
||||
<td>{{ quote.submitted_at.strftime('%Y-%m-%d %H:%M:%S') if quote.submitted_at else 'N/A' }}</td>
|
||||
<td>{{ quote.ip_address }}</td>
|
||||
<td>{{ quote.user_agent }}</td>
|
||||
<td>
|
||||
<a href="/approve/{{ quote.id }}">Approve</a> |
|
||||
<a href="/reject/{{ quote.id }}">Reject</a> |
|
||||
<a href="/delete/{{ quote.id }}">Delete</a>
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</table>
|
||||
|
||||
<!-- Pagination Links -->
|
||||
<div id="pagination">
|
||||
{% if quotes.has_prev %}
|
||||
<a href="{{ url_for('modapp', page=quotes.prev_num, filter=filter_status) }}">« Previous</a>
|
||||
{% endif %}
|
||||
<span>Page {{ quotes.page }} of {{ quotes.pages }}</span>
|
||||
{% if quotes.has_next %}
|
||||
<a href="{{ url_for('modapp', page=quotes.next_num, filter=filter_status) }}">Next »</a>
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
{% else %}
|
||||
<p>No quotes available for moderation.</p>
|
||||
{% endif %}
|
||||
</center>
|
||||
|
||||
<!-- Footer -->
|
||||
@@ -118,15 +117,12 @@
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="footertext" align="left"> </td>
|
||||
<td class="footertext" align="right">{{ total_quotes }} quotes approved</td>
|
||||
<td class="footertext" align="right">
|
||||
{{ approved_count }} quotes approved; {{ pending_count }} quotes pending; {{ rejected_count }} quotes rejected
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</center>
|
||||
|
||||
<!-- Dark Mode Toggle -->
|
||||
<center>
|
||||
<button id="theme-toggle">Toggle Dark Mode</button>
|
||||
</center>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user