Skip to main content

max / makenotwork

4.9 KB · 113 lines History Blame Raw
1 {%- import "partials/_ui.html" as ui -%}
2 {% if users.is_empty() %}
3 {% call ui::empty_state("", "No users found.") %}{% endcall %}
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>Custom page</th>
15 <th>Actions</th>
16 </tr>
17 </thead>
18 <tbody>
19 {% for user in users %}
20 <tr>
21 <td>
22 {{ user.username }}
23 {% if let Some(dn) = user.display_name %}
24 <span class="text-xs dimmed">({{ dn }})</span>
25 {% endif %}
26 </td>
27 <td class="text-sm">{{ user.email }}</td>
28 <td class="text-sm nowrap">{{ user.created_at }}</td>
29 <td>
30 {% if user.is_suspended %}
31 <span class="badge suspended">Suspended</span>
32 {% if user.has_pending_appeal %}
33 <span class="text-xs dimmed">(appeal pending)</span>
34 {% endif %}
35 {% else %}
36 <span class="badge badge-active">Active</span>
37 {% endif %}
38 </td>
39 <td>
40 {% if user.upload_trusted %}
41 <span class="badge badge-trusted">Trusted</span>
42 <button class="btn-secondary small admin-entries-trust-btn"
43 hx-post="/api/admin/users/{{ user.id }}/untrust"
44 hx-target="#users-table"
45 hx-swap="innerHTML">Untrust</button>
46 {% else %}
47 <button class="btn-secondary small"
48 hx-post="/api/admin/users/{{ user.id }}/trust"
49 hx-target="#users-table"
50 hx-swap="innerHTML">Trust</button>
51 {% endif %}
52 </td>
53 <td class="nowrap">
54 {% if user.custom_pages_locked %}
55 <span class="badge suspended">Locked</span>
56 <button class="btn-secondary small"
57 hx-post="/api/admin/users/{{ user.id }}/unlock-pages"
58 hx-target="#users-table"
59 hx-swap="innerHTML"
60 hx-confirm="Unlock this creator's custom pages?">Unlock</button>
61 {% else %}
62 {% if user.has_custom_page %}
63 <span class="badge badge-active">Has page</span>
64 {% else %}
65 <span class="text-xs dimmed">none</span>
66 {% endif %}
67 <button class="btn-danger small"
68 hx-post="/api/admin/users/{{ user.id }}/lock-pages"
69 hx-target="#users-table"
70 hx-swap="innerHTML"
71 hx-confirm="Lock this creator's custom pages? Their pages will show the platform default.">Lock</button>
72 {% endif %}
73 </td>
74 <td class="nowrap">
75 {% if user.is_suspended %}
76 <button class="btn-secondary small"
77 hx-post="/api/admin/users/{{ user.id }}/unsuspend"
78 hx-target="#users-table"
79 hx-swap="innerHTML"
80 hx-confirm="Unsuspend this user?">Unsuspend</button>
81 {% else %}
82 <form class="suspend-form"
83 hx-post="/api/admin/users/{{ user.id }}/suspend"
84 hx-target="#users-table"
85 hx-swap="innerHTML"
86 hx-confirm="Suspend this user?">
87 <input type="text" name="reason" placeholder="Reason..." required>
88 <button type="submit" class="btn-danger small">Suspend</button>
89 </form>
90 {% endif %}
91 </td>
92 </tr>
93 {% endfor %}
94 </tbody>
95 </table>
96 </div>
97 {% if total_pages > 1 %}
98 <div class="admin-entries-pagination">
99 {% if current_page > 1 %}
100 <button class="btn-secondary small"
101 hx-get="/admin/users/entries?page={{ current_page - 1 }}{% if !current_filter.is_empty() %}&amp;status={{ current_filter }}{% endif %}"
102 hx-target="#users-table" hx-swap="innerHTML">Previous</button>
103 {% endif %}
104 <span class="meta">Page {{ current_page }} of {{ total_pages }}</span>
105 {% if current_page < total_pages %}
106 <button class="btn-secondary small"
107 hx-get="/admin/users/entries?page={{ current_page + 1 }}{% if !current_filter.is_empty() %}&amp;status={{ current_filter }}{% endif %}"
108 hx-target="#users-table" hx-swap="innerHTML">Next</button>
109 {% endif %}
110 </div>
111 {% endif %}
112 {% endif %}
113