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