Skip to main content

max / makenotwork

3.7 KB · 91 lines History Blame Raw
1 {%- import "partials/_ui.html" as ui -%}
2 {% if users.is_empty() %}
3 {% call ui::empty_state("", "No users found.") %}
4 {% else %}
5 <div class="scroll-x">
6 <table class="compact-table minw-800" aria-label="Users">
7 <thead>
8 <tr>
9 <th>Username</th>
10 <th>Email</th>
11 <th>Joined</th>
12 <th>Status</th>
13 <th>Trust</th>
14 <th>Actions</th>
15 </tr>
16 </thead>
17 <tbody>
18 {% for user in users %}
19 <tr>
20 <td>
21 {{ user.username }}
22 {% if let Some(dn) = user.display_name %}
23 <span class="text-xs dimmed">({{ dn }})</span>
24 {% endif %}
25 </td>
26 <td class="text-sm">{{ user.email }}</td>
27 <td class="text-sm nowrap">{{ user.created_at }}</td>
28 <td>
29 {% if user.is_suspended %}
30 <span class="badge suspended">Suspended</span>
31 {% if user.has_pending_appeal %}
32 <span class="text-xs dimmed">(appeal pending)</span>
33 {% endif %}
34 {% else %}
35 <span class="badge badge-active">Active</span>
36 {% endif %}
37 </td>
38 <td>
39 {% if user.upload_trusted %}
40 <span class="badge badge-trusted">Trusted</span>
41 <button class="btn-secondary small admin-entries-trust-btn"
42 hx-post="/api/admin/users/{{ user.id }}/untrust"
43 hx-target="#users-table"
44 hx-swap="innerHTML">Untrust</button>
45 {% else %}
46 <button class="btn-secondary small"
47 hx-post="/api/admin/users/{{ user.id }}/trust"
48 hx-target="#users-table"
49 hx-swap="innerHTML">Trust</button>
50 {% endif %}
51 </td>
52 <td class="nowrap">
53 {% if user.is_suspended %}
54 <button class="btn-secondary small"
55 hx-post="/api/admin/users/{{ user.id }}/unsuspend"
56 hx-target="#users-table"
57 hx-swap="innerHTML"
58 hx-confirm="Unsuspend this user?">Unsuspend</button>
59 {% else %}
60 <form class="suspend-form"
61 hx-post="/api/admin/users/{{ user.id }}/suspend"
62 hx-target="#users-table"
63 hx-swap="innerHTML"
64 hx-confirm="Suspend this user?">
65 <input type="text" name="reason" placeholder="Reason..." required>
66 <button type="submit" class="btn-danger small">Suspend</button>
67 </form>
68 {% endif %}
69 </td>
70 </tr>
71 {% endfor %}
72 </tbody>
73 </table>
74 </div>
75 {% if total_pages > 1 %}
76 <div class="admin-entries-pagination">
77 {% if current_page > 1 %}
78 <button class="btn-secondary small"
79 hx-get="/admin/users/entries?page={{ current_page - 1 }}{% if !current_filter.is_empty() %}&amp;status={{ current_filter }}{% endif %}"
80 hx-target="#users-table" hx-swap="innerHTML">Previous</button>
81 {% endif %}
82 <span class="meta">Page {{ current_page }} of {{ total_pages }}</span>
83 {% if current_page < total_pages %}
84 <button class="btn-secondary small"
85 hx-get="/admin/users/entries?page={{ current_page + 1 }}{% if !current_filter.is_empty() %}&amp;status={{ current_filter }}{% endif %}"
86 hx-target="#users-table" hx-swap="innerHTML">Next</button>
87 {% endif %}
88 </div>
89 {% endif %}
90 {% endif %}
91