SpreadSheets commited on
Commit
3ab695a
·
1 Parent(s): 30dc624

feat: add user management template with display and admin toggle functionality

Browse files
Files changed (1) hide show
  1. app/templates/admin/users.html +59 -0
app/templates/admin/users.html ADDED
@@ -0,0 +1,59 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {% extends "base.html" %}
2
+
3
+ {% block content %}
4
+ <div class="max-w-7xl mx-auto px-4 sm:px-6">
5
+ <div class="mb-8">
6
+ <a href="{{ url_for('admin.dashboard') }}" class="inline-flex items-center gap-2 font-mono text-sm text-gray-400 hover:text-purple-400 transition mb-6">
7
+ <svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
8
+ <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15 19l-7-7 7-7"/>
9
+ </svg>
10
+ Back to Dashboard
11
+ </a>
12
+
13
+ <h1 class="font-display text-4xl sm:text-5xl font-bold tracking-tight mb-4">
14
+ <span class="bg-gradient-to-r from-purple-400 to-pink-500 bg-clip-text text-transparent">
15
+ Manage Users
16
+ </span>
17
+ </h1>
18
+ </div>
19
+
20
+ <div class="glass rounded-2xl overflow-hidden">
21
+ <div class="overflow-x-auto">
22
+ <table class="w-full">
23
+ <thead class="bg-white/5 border-b border-white/10">
24
+ <tr>
25
+ <th class="px-6 py-4 text-left font-mono text-sm text-gray-400 whitespace-nowrap">ID</th>
26
+ <th class="px-6 py-4 text-left font-mono text-sm text-gray-400 whitespace-nowrap">Name</th>
27
+ <th class="px-6 py-4 text-left font-mono text-sm text-gray-400 whitespace-nowrap">Email</th>
28
+ <th class="px-6 py-4 text-left font-mono text-sm text-gray-400 whitespace-nowrap">Admin</th>
29
+ <th class="px-6 py-4 text-right font-mono text-sm text-gray-400 whitespace-nowrap">Actions</th>
30
+ </tr>
31
+ </thead>
32
+ <tbody>
33
+ {% for user in users %}
34
+ <tr class="border-b border-white/5 hover:bg-white/5 transition">
35
+ <td class="px-6 py-4 font-mono text-sm whitespace-nowrap">{{ user.id }}</td>
36
+ <td class="px-6 py-4 font-mono whitespace-nowrap">{{ user.name }}</td>
37
+ <td class="px-6 py-4 font-mono text-sm text-gray-400 whitespace-nowrap">{{ user.email }}</td>
38
+ <td class="px-6 py-4 whitespace-nowrap">
39
+ {% if user.is_admin %}
40
+ <span class="px-3 py-1 bg-purple-500/20 border border-purple-500/50 rounded-lg font-mono text-xs">Admin</span>
41
+ {% else %}
42
+ <span class="px-3 py-1 bg-gray-500/20 border border-gray-500/50 rounded-lg font-mono text-xs">User</span>
43
+ {% endif %}
44
+ </td>
45
+ <td class="px-6 py-4 text-right whitespace-nowrap">
46
+ <form method="POST" action="{{ url_for('admin.toggle_admin', id=user.id) }}" class="inline">
47
+ <button type="submit" class="px-4 py-2 {% if user.is_admin %}bg-red-500/20 border-red-500/50{% else %}bg-green-500/20 border-green-500/50{% endif %} border rounded-lg font-mono text-sm hover:opacity-80 transition">
48
+ {{ 'Revoke Admin' if user.is_admin else 'Grant Admin' }}
49
+ </button>
50
+ </form>
51
+ </td>
52
+ </tr>
53
+ {% endfor %}
54
+ </tbody>
55
+ </table>
56
+ </div>
57
+ </div>
58
+ </div>
59
+ {% endblock %}