- Added helper functions for approving, rejecting, and deleting quotes (approve_quote, reject_quote, delete_quote) - Implemented validation for quote selection and action type - Added user feedback (flash messages) for successful or invalid actions - Ensured no action is performed if no quotes are selected in bulk operations
114 lines
4.8 KiB
HTML
114 lines
4.8 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<title>ircquotes: Admin Panel</title>
|
|
<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">
|
|
<tr>
|
|
<td bgcolor="#c08000" align="left">
|
|
<font size="+1"><b><i>ircquotes</i></b></font>
|
|
</td>
|
|
<td bgcolor="#c08000" align="right">
|
|
<font face="arial" size="+1"><b>Admin Panel</b></font>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
<table cellpadding="2" cellspacing="0" width="80%" border="0">
|
|
<tr>
|
|
<td class="footertext" align="left" bgcolor="#f0f0f0"></td>
|
|
<td align="right" bgcolor="#f0f0f0" class="toplinks" colspan="2">
|
|
<a href="/">Home</a> /
|
|
<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>
|
|
</table>
|
|
</center>
|
|
|
|
<!-- Main Content: All Quotes for Moderation -->
|
|
<center>
|
|
<table cellpadding="2" cellspacing="0" width="80%">
|
|
<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>
|
|
<tr>
|
|
<th>Select</th>
|
|
<th>Quote ID</th>
|
|
<th>Quote</th>
|
|
<th>Status</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>
|
|
<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>
|
|
{% else %}
|
|
<p>No quotes available for moderation at the moment.</p>
|
|
{% endif %}
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
</center>
|
|
|
|
<!-- Footer -->
|
|
<center>
|
|
<table border="0" cellpadding="2" cellspacing="0" width="80%" bgcolor="#c08000">
|
|
<tr>
|
|
<td bgcolor="#f0f0f0" class="toplinks" colspan="2">
|
|
<a href="/">Home</a> /
|
|
<a href="/random">Random</a> /
|
|
<a href="/submit">Submit</a> /
|
|
<a href="/browse">Browse</a> /
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="footertext" align="left"> </td>
|
|
<td class="footertext" align="right">{{ total_quotes }} quotes approved</td>
|
|
</tr>
|
|
</table>
|
|
</center>
|
|
</body>
|
|
</html>
|