Refactor code for improved readability and consistency across templates and frontend logic
Co-authored-by: Copilot <copilot@github.com>
This commit is contained in:
@@ -1,5 +1,4 @@
|
||||
{% extends "base.html" %}
|
||||
{% block title %}Admin — AI Allucanget{% endblock %}
|
||||
{% extends "base.html" %} {% block title %}Admin — AI Allucanget{% endblock %}
|
||||
{% block content %}
|
||||
<div class="card">
|
||||
<h1>Admin Dashboard</h1>
|
||||
@@ -41,25 +40,38 @@
|
||||
<td>
|
||||
<div class="table-actions">
|
||||
<!-- Role toggle -->
|
||||
<form method="post" action="{{ url_for('admin_set_role', user_id=u.id) }}">
|
||||
<input type="hidden" name="role"
|
||||
value="{{ 'user' if u.role == 'admin' else 'admin' }}">
|
||||
<form
|
||||
method="post"
|
||||
action="{{ url_for('admin_set_role', user_id=u.id) }}"
|
||||
>
|
||||
<input
|
||||
type="hidden"
|
||||
name="role"
|
||||
value="{{ 'user' if u.role == 'admin' else 'admin' }}"
|
||||
/>
|
||||
<button type="submit" class="btn btn-sm">
|
||||
Make {{ 'user' if u.role == 'admin' else 'admin' }}
|
||||
</button>
|
||||
</form>
|
||||
<!-- Delete -->
|
||||
{% if u.id != session.get('user_id') %}
|
||||
<form method="post" action="{{ url_for('admin_delete_user', user_id=u.id) }}"
|
||||
onsubmit="return confirm('Delete {{ u.email }}?')">
|
||||
<button type="submit" class="btn btn-sm btn-danger">Delete</button>
|
||||
<form
|
||||
method="post"
|
||||
action="{{ url_for('admin_delete_user', user_id=u.id) }}"
|
||||
onsubmit="return confirm('Delete {{ u.email }}?')"
|
||||
>
|
||||
<button type="submit" class="btn btn-sm btn-danger">
|
||||
Delete
|
||||
</button>
|
||||
</form>
|
||||
{% endif %}
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
{% else %}
|
||||
<tr><td colspan="3" class="text-muted">No users found.</td></tr>
|
||||
<tr>
|
||||
<td colspan="3" class="text-muted">No users found.</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
Reference in New Issue
Block a user