Files
ButterGarden/templates/users.html
2025-01-18 21:38:08 -08:00

99 lines
2.3 KiB
HTML

{% extends "base.html" %}
{% block content %}
<div class="container">
<h1>User Management</h1>
<div class="action-bar">
<a href="{{ url_for('add_user') }}" class="btn">Add New User</a>
</div>
<div class="users-list">
<table>
<thead>
<tr>
<th>Username</th>
<th>Permissions</th>
<th>Actions</th>
</tr>
</thead>
<tbody>
{% for user in users %}
<tr>
<td>{{ user.username }}</td>
<td>
{% if user.is_admin %}
Admin
{% elif user.can_add_recipes %}
Recipe Manager
{% else %}
Viewer
{% endif %}
</td>
<td class="actions">
{% if not user.is_admin %}
<a href="{{ url_for('edit_user', id=user.id) }}" class="btn btn-small">Edit</a>
<form action="{{ url_for('delete_user', id=user.id) }}" method="POST" class="inline-form">
<button type="submit" class="btn btn-small btn-danger" onclick="return confirm('Are you sure you want to delete this user?')">Delete</button>
</form>
{% endif %}
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
<style>
.users-list {
margin-top: 2rem;
}
table {
width: 100%;
border-collapse: collapse;
background: var(--background-color);
border-radius: 8px;
overflow: hidden;
box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}
th, td {
padding: 1rem;
text-align: left;
}
th, tr {
border-bottom: 1px solid var(--border-color);
}
th {
background: var(--primary-color);
color: white;
}
.actions {
display: flex;
gap: 0.5rem;
}
.inline-form {
display: inline;
}
.btn-small {
padding: 0.25rem 0.5rem;
font-size: 0.875rem;
}
.btn-danger {
background: var(--error-color);
color: white;
}
.btn-danger:hover {
background: var(--error-color-dark);
}
</style>
{% endblock %}