| [7bc636b] | 1 | <div class="container ax-page">
|
|---|
| 2 |
|
|---|
| [bbf9d1a] | 3 | <p><a href="/admin" class="btn">← <%= t('ausr.back') %></a></p>
|
|---|
| [7bc636b] | 4 | <header class="ax-header">
|
|---|
| 5 | <div>
|
|---|
| [bbf9d1a] | 6 | <h1><%= t('ausr.title') %></h1>
|
|---|
| 7 | <p class="ax-tagline"><%= t('ausr.tagline_a') %> <strong><%= t('ausr.role_kijker') %></strong> <%= t('ausr.tagline_b') %></p>
|
|---|
| [7bc636b] | 8 | </div>
|
|---|
| 9 | </header>
|
|---|
| 10 |
|
|---|
| 11 | <% if (success) { %><div class="ax-flash ax-flash-ok"><%= success %></div><% } %>
|
|---|
| 12 | <% if (error) { %><div class="ax-flash ax-flash-err"><%= error %></div><% } %>
|
|---|
| 13 |
|
|---|
| 14 | <% if (!users.length) { %>
|
|---|
| 15 | <div class="ax-card">
|
|---|
| 16 | <div class="ax-empty">
|
|---|
| 17 | <div class="ax-empty-icon">👤</div>
|
|---|
| [bbf9d1a] | 18 | <p><%= t('ausr.empty') %></p>
|
|---|
| [7bc636b] | 19 | </div>
|
|---|
| 20 | </div>
|
|---|
| 21 | <% } else { %>
|
|---|
| [bbf9d1a] | 22 | <%
|
|---|
| 23 | var _u_self = t('ausr.you');
|
|---|
| 24 | var _u_t_sites = t('ausr.t_sites');
|
|---|
| 25 | var _u_t_posts = t('ausr.t_posts');
|
|---|
| 26 | var _u_t_joined = t('ausr.t_joined');
|
|---|
| 27 | var _u_l_sites = t('ausr.l_sites');
|
|---|
| 28 | var _u_l_posts = t('ausr.l_posts');
|
|---|
| 29 | var _u_l_joined = t('ausr.l_joined');
|
|---|
| 30 | var _u_newklonkt = t('ausr.new_klonkt');
|
|---|
| 31 | var _u_rol = t('ausr.role_label');
|
|---|
| 32 | var _u_r_kijker = t('ausr.role_kijker');
|
|---|
| 33 | var _u_r_member = t('ausr.role_member');
|
|---|
| 34 | var _u_r_admin = t('ausr.role_admin');
|
|---|
| 35 | var _u_r_god = t('ausr.role_god');
|
|---|
| 36 | var _u_del = t('ausr.delete');
|
|---|
| 37 | %>
|
|---|
| [7bc636b] | 38 | <ul class="ax-list">
|
|---|
| 39 | <% users.forEach(function(u) { %>
|
|---|
| 40 | <li class="ax-user<%= u.id === user.id ? ' is-self' : '' %>">
|
|---|
| 41 |
|
|---|
| 42 | <div class="ax-user-id">
|
|---|
| 43 | <% if (u.avatar_url) { %>
|
|---|
| 44 | <img class="ax-avatar" src="<%= u.avatar_url %>" alt="">
|
|---|
| 45 | <% } else { %>
|
|---|
| 46 | <span class="ax-avatar ax-avatar-empty"><%= u.username.charAt(0).toUpperCase() %></span>
|
|---|
| 47 | <% } %>
|
|---|
| 48 | <div class="ax-user-meta">
|
|---|
| 49 | <div class="ax-user-name">
|
|---|
| 50 | <a href="/users/<%= encodeURIComponent(u.username) %>"><%= u.username %></a>
|
|---|
| [bbf9d1a] | 51 | <% if (u.id === user.id) { %><span class="ax-pill"><%= _u_self %></span><% } %>
|
|---|
| [7bc636b] | 52 | </div>
|
|---|
| 53 | <div class="ax-user-email"><%= u.email %></div>
|
|---|
| 54 | </div>
|
|---|
| 55 | </div>
|
|---|
| 56 |
|
|---|
| 57 | <div class="ax-user-stats">
|
|---|
| [bbf9d1a] | 58 | <span class="ax-stat" title="<%= _u_t_sites %>">
|
|---|
| [7bc636b] | 59 | <span class="ax-stat-num"><%= u.site_count %></span>
|
|---|
| [bbf9d1a] | 60 | <span class="ax-stat-label"><%= _u_l_sites %></span>
|
|---|
| [7bc636b] | 61 | </span>
|
|---|
| [bbf9d1a] | 62 | <span class="ax-stat" title="<%= _u_t_posts %>">
|
|---|
| [7bc636b] | 63 | <span class="ax-stat-num"><%= u.post_count %></span>
|
|---|
| [bbf9d1a] | 64 | <span class="ax-stat-label"><%= _u_l_posts %></span>
|
|---|
| [7bc636b] | 65 | </span>
|
|---|
| [bbf9d1a] | 66 | <span class="ax-stat" title="<%= _u_t_joined %>">
|
|---|
| [7bc636b] | 67 | <span class="ax-stat-num ax-stat-date"><%= formatDate(u.created_at) %></span>
|
|---|
| [bbf9d1a] | 68 | <span class="ax-stat-label"><%= _u_l_joined %></span>
|
|---|
| [7bc636b] | 69 | </span>
|
|---|
| 70 | </div>
|
|---|
| 71 |
|
|---|
| 72 | <div class="ax-user-controls">
|
|---|
| [834bcc3] | 73 | <%# Hub: give this user their own self-managed Klonkt — opens the
|
|---|
| 74 | new-site form with this user already pre-selected as owner. %>
|
|---|
| [86793f9] | 75 | <% if (typeof tenancy !== 'undefined' && tenancy === 'hub' && canMutate) { %>
|
|---|
| 76 | <a href="/admin/sites/new?owner=<%= u.id %>" class="ax-icon-btn"
|
|---|
| [bbf9d1a] | 77 | aria-label="<%= t('ausr.new_klonkt_for', { name: u.username }) %>" title="<%= _u_newklonkt %>">+🌐</a>
|
|---|
| [86793f9] | 78 | <% } %>
|
|---|
| [7bc636b] | 79 | <form method="post" action="/admin/users/<%= u.id %>/role" class="ax-role-form">
|
|---|
| 80 | <label class="ax-role">
|
|---|
| [bbf9d1a] | 81 | <span><%= _u_rol %></span>
|
|---|
| [8afbdd6] | 82 | <select name="role" onchange="this.form.submit()" <% if (u.id === user.id || !canMutate) { %>disabled<% } %>>
|
|---|
| [bbf9d1a] | 83 | <option value="kijker" <%= u.role === 'kijker' ? 'selected' : '' %>><%= _u_r_kijker %></option>
|
|---|
| 84 | <option value="member" <%= u.role === 'member' ? 'selected' : '' %>><%= _u_r_member %></option>
|
|---|
| 85 | <option value="admin" <%= u.role === 'admin' ? 'selected' : '' %>><%= _u_r_admin %></option>
|
|---|
| 86 | <option value="god" <%= u.role === 'god' ? 'selected' : '' %>><%= _u_r_god %></option>
|
|---|
| [7bc636b] | 87 | </select>
|
|---|
| 88 | </label>
|
|---|
| 89 | </form>
|
|---|
| 90 |
|
|---|
| [8afbdd6] | 91 | <% if (u.id !== user.id && canMutate) { %>
|
|---|
| [0c2228a] | 92 | <% var _warn = (u.post_count + u.site_count > 0)
|
|---|
| [bbf9d1a] | 93 | ? (t('ausr.del_warn', { n: u.post_count }) + ' ')
|
|---|
| [0c2228a] | 94 | : ''; %>
|
|---|
| [7bc636b] | 95 | <form method="post" action="/admin/users/<%= u.id %>/delete" class="ax-delete-form"
|
|---|
| [bbf9d1a] | 96 | onsubmit="return confirm('<%= t('ausr.del_confirm', { name: u.username }) %> <%= _warn %><%= t('ausr.del_undo') %>')">
|
|---|
| 97 | <button type="submit" class="ax-icon-btn ax-icon-btn-danger" aria-label="<%= _u_del %>" title="<%= _u_del %>">🗑</button>
|
|---|
| [7bc636b] | 98 | </form>
|
|---|
| [05a6ca0] | 99 | <% } else { %>
|
|---|
| [834bcc3] | 100 | <%# Empty placeholder so the role column aligns on every row. %>
|
|---|
| [05a6ca0] | 101 | <span class="ax-icon-btn-spacer" aria-hidden="true"></span>
|
|---|
| [7bc636b] | 102 | <% } %>
|
|---|
| 103 | </div>
|
|---|
| 104 |
|
|---|
| 105 | </li>
|
|---|
| 106 | <% }); %>
|
|---|
| 107 | </ul>
|
|---|
| 108 | <% } %>
|
|---|
| 109 |
|
|---|
| 110 | </div>
|
|---|
| 111 |
|
|---|
| 112 | <style>
|
|---|
| 113 | .ax-page { max-width: 880px; margin: 1.5rem auto 4rem; padding: 0 1rem; }
|
|---|
| 114 | .ax-header { display: flex; align-items: flex-start; gap: 0.75rem; margin-bottom: 1.5rem; }
|
|---|
| 115 | .ax-header h1 { font-family: var(--font-display, serif); font-size: 1.75rem; margin: 0 0 0.25rem; }
|
|---|
| 116 | .ax-tagline { color: var(--ink-muted, var(--ink-soft)); margin: 0; font-size: 0.9rem; }
|
|---|
| 117 | .ax-back {
|
|---|
| 118 | display: inline-flex; align-items: center; justify-content: center;
|
|---|
| 119 | width: 40px; height: 40px;
|
|---|
| 120 | border: 1px solid var(--rule); border-radius: 8px;
|
|---|
| 121 | background: var(--paper); color: var(--ink); text-decoration: none;
|
|---|
| 122 | font-size: 1.1rem; flex-shrink: 0; transition: border-color 120ms;
|
|---|
| 123 | }
|
|---|
| 124 | .ax-back:hover { border-color: var(--accent); }
|
|---|
| 125 |
|
|---|
| 126 | .ax-flash { padding: 0.75rem 1rem; border-radius: 8px; margin-bottom: 1rem; font-size: 0.9rem; }
|
|---|
| 127 | .ax-flash-ok { background: rgba(40,160,90,.15); color: #2a9d5e; border: 1px solid rgba(40,160,90,.3); }
|
|---|
| 128 | .ax-flash-err { background: rgba(200,60,60,.15); color: #c33; border: 1px solid rgba(200,60,60,.3); }
|
|---|
| 129 |
|
|---|
| 130 | .ax-card {
|
|---|
| 131 | background: var(--paper); border: 1px solid var(--rule);
|
|---|
| 132 | border-radius: 12px; padding: 1.25rem;
|
|---|
| 133 | }
|
|---|
| 134 | .ax-empty { text-align: center; padding: 2rem 1rem; color: var(--ink-muted); }
|
|---|
| 135 | .ax-empty-icon { font-size: 2.5rem; margin-bottom: 0.5rem; opacity: 0.5; }
|
|---|
| 136 | .ax-empty p { margin: 0; }
|
|---|
| 137 |
|
|---|
| 138 | /* ─── User cards ───────────────────────────────────────────────── */
|
|---|
| 139 | .ax-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 0.6rem; }
|
|---|
| 140 | .ax-user {
|
|---|
| 141 | display: grid;
|
|---|
| 142 | grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr) auto;
|
|---|
| 143 | gap: 1rem;
|
|---|
| 144 | align-items: center;
|
|---|
| 145 | padding: 0.85rem 1rem;
|
|---|
| 146 | background: var(--paper);
|
|---|
| 147 | border: 1px solid var(--rule);
|
|---|
| 148 | border-radius: 12px;
|
|---|
| 149 | transition: border-color 120ms;
|
|---|
| 150 | }
|
|---|
| 151 | .ax-user:hover { border-color: var(--accent); }
|
|---|
| 152 | .ax-user.is-self {
|
|---|
| 153 | background: color-mix(in srgb, var(--accent) 7%, var(--paper));
|
|---|
| 154 | border-color: color-mix(in srgb, var(--accent) 25%, var(--rule));
|
|---|
| 155 | }
|
|---|
| 156 |
|
|---|
| 157 | .ax-user-id { display: flex; align-items: center; gap: 0.75rem; min-width: 0; }
|
|---|
| 158 | .ax-avatar {
|
|---|
| 159 | width: 44px; height: 44px;
|
|---|
| 160 | border-radius: 50%;
|
|---|
| 161 | object-fit: cover;
|
|---|
| 162 | background: var(--paper-2);
|
|---|
| 163 | color: var(--accent);
|
|---|
| 164 | display: inline-flex; align-items: center; justify-content: center;
|
|---|
| 165 | font-family: var(--font-display, serif);
|
|---|
| 166 | font-weight: 700; font-size: 1.1rem;
|
|---|
| 167 | flex-shrink: 0;
|
|---|
| 168 | }
|
|---|
| 169 | .ax-avatar-empty { /* span variant uses same styling */ }
|
|---|
| 170 | .ax-user-meta { min-width: 0; display: flex; flex-direction: column; gap: 0.15rem; }
|
|---|
| 171 | .ax-user-name {
|
|---|
| 172 | font-weight: 600; font-size: 0.95rem;
|
|---|
| 173 | display: flex; align-items: baseline; gap: 0.4rem; flex-wrap: wrap;
|
|---|
| 174 | }
|
|---|
| 175 | .ax-user-name a { color: var(--ink); text-decoration: none; }
|
|---|
| 176 | .ax-user-name a:hover { color: var(--accent); }
|
|---|
| 177 | .ax-user-email {
|
|---|
| 178 | font-size: 0.82rem;
|
|---|
| 179 | color: var(--ink-muted, var(--ink-soft));
|
|---|
| 180 | overflow: hidden;
|
|---|
| 181 | text-overflow: ellipsis;
|
|---|
| 182 | white-space: nowrap;
|
|---|
| 183 | }
|
|---|
| 184 | .ax-pill {
|
|---|
| 185 | font-size: 0.7rem; font-weight: 500;
|
|---|
| 186 | color: var(--ink-soft);
|
|---|
| 187 | background: var(--paper-2);
|
|---|
| 188 | padding: 0.15em 0.55em; border-radius: 999px;
|
|---|
| 189 | }
|
|---|
| 190 |
|
|---|
| 191 | /* ─── Stats (3 mini-columns) ──────────────────────────────────── */
|
|---|
| 192 | .ax-user-stats {
|
|---|
| 193 | display: flex; gap: 1.25rem;
|
|---|
| 194 | align-items: center;
|
|---|
| 195 | }
|
|---|
| 196 | .ax-stat {
|
|---|
| 197 | display: flex; flex-direction: column;
|
|---|
| 198 | font-size: 0.8rem;
|
|---|
| 199 | text-align: center;
|
|---|
| 200 | min-width: 0;
|
|---|
| 201 | }
|
|---|
| 202 | .ax-stat-num {
|
|---|
| 203 | font-family: var(--font-display, serif);
|
|---|
| 204 | font-weight: 600; font-size: 1.05rem;
|
|---|
| 205 | color: var(--ink);
|
|---|
| 206 | font-variant-numeric: tabular-nums;
|
|---|
| 207 | }
|
|---|
| 208 | .ax-stat-date {
|
|---|
| 209 | font-family: var(--font-ui, system-ui);
|
|---|
| 210 | font-size: 0.75rem;
|
|---|
| 211 | font-weight: 500;
|
|---|
| 212 | white-space: nowrap;
|
|---|
| 213 | }
|
|---|
| 214 | .ax-stat-label {
|
|---|
| 215 | color: var(--ink-muted, var(--ink-soft));
|
|---|
| 216 | text-transform: uppercase;
|
|---|
| 217 | letter-spacing: 0.04em;
|
|---|
| 218 | font-size: 0.7rem;
|
|---|
| 219 | }
|
|---|
| 220 |
|
|---|
| 221 | /* ─── Role select + delete ────────────────────────────────────── */
|
|---|
| 222 | .ax-user-controls {
|
|---|
| [5e95aac] | 223 | display: flex; gap: 0.5rem; align-items: flex-end;
|
|---|
| [7bc636b] | 224 | flex-shrink: 0;
|
|---|
| 225 | }
|
|---|
| 226 | .ax-role-form { margin: 0; }
|
|---|
| 227 | .ax-role {
|
|---|
| 228 | display: flex; flex-direction: column; gap: 0.2rem;
|
|---|
| 229 | font-size: 0.7rem;
|
|---|
| 230 | }
|
|---|
| 231 | .ax-role > span {
|
|---|
| 232 | color: var(--ink-muted);
|
|---|
| 233 | text-transform: uppercase;
|
|---|
| 234 | letter-spacing: 0.04em;
|
|---|
| 235 | font-weight: 600;
|
|---|
| 236 | font-size: 0.7rem;
|
|---|
| 237 | }
|
|---|
| 238 | .ax-role select {
|
|---|
| [5e95aac] | 239 | width: 112px;
|
|---|
| 240 | height: 40px;
|
|---|
| 241 | box-sizing: border-box;
|
|---|
| [7bc636b] | 242 | padding: 0.4rem 1.75rem 0.4rem 0.6rem;
|
|---|
| 243 | border: 1px solid var(--rule);
|
|---|
| 244 | border-radius: 6px;
|
|---|
| 245 | background: var(--paper-2);
|
|---|
| 246 | color: var(--ink);
|
|---|
| 247 | font-family: var(--font-ui, system-ui), sans-serif;
|
|---|
| 248 | font-size: 0.85rem;
|
|---|
| 249 | -webkit-appearance: none; appearance: none;
|
|---|
| 250 | cursor: pointer;
|
|---|
| 251 | background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23999' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'/></svg>");
|
|---|
| 252 | background-repeat: no-repeat;
|
|---|
| 253 | background-position: right 0.5rem center;
|
|---|
| 254 | }
|
|---|
| 255 | .ax-role select:disabled { cursor: not-allowed; opacity: 0.5; }
|
|---|
| [a64f642] | 256 | .ax-ro { align-items: center; }
|
|---|
| 257 | .ax-ro input { width: 18px; height: 18px; cursor: pointer; margin-top: 0.15rem; accent-color: var(--accent); }
|
|---|
| 258 | .ax-ro input:disabled { cursor: not-allowed; opacity: 0.5; }
|
|---|
| [7bc636b] | 259 | .ax-delete-form { margin: 0; }
|
|---|
| 260 | .ax-icon-btn {
|
|---|
| 261 | display: inline-flex; align-items: center; justify-content: center;
|
|---|
| 262 | width: 40px; height: 40px;
|
|---|
| 263 | border: 1px solid var(--rule); border-radius: 8px;
|
|---|
| 264 | background: var(--paper-2); color: var(--ink);
|
|---|
| 265 | cursor: pointer; font-size: 1rem;
|
|---|
| 266 | transition: background 120ms, border-color 120ms, color 120ms;
|
|---|
| 267 | }
|
|---|
| 268 | .ax-icon-btn:hover { border-color: var(--accent); }
|
|---|
| 269 | .ax-icon-btn-danger:hover { color: #dc2626; border-color: #dc2626; }
|
|---|
| [05a6ca0] | 270 | .ax-icon-btn-spacer { display: inline-block; width: 40px; height: 40px; flex-shrink: 0; }
|
|---|
| [7bc636b] | 271 |
|
|---|
| 272 | /* ─── Mobile: stack everything vertically ─────────────────────── */
|
|---|
| 273 | @media (max-width: 720px) {
|
|---|
| 274 | .ax-user {
|
|---|
| 275 | grid-template-columns: 1fr;
|
|---|
| 276 | grid-template-areas: "id" "stats" "controls";
|
|---|
| 277 | gap: 0.75rem;
|
|---|
| 278 | }
|
|---|
| 279 | .ax-user-id { grid-area: id; }
|
|---|
| 280 | .ax-user-stats { grid-area: stats; justify-content: flex-start; gap: 1.5rem; padding-top: 0.5rem; border-top: 1px solid var(--rule); }
|
|---|
| 281 | .ax-user-controls { grid-area: controls; justify-content: space-between; align-items: flex-end; }
|
|---|
| 282 | .ax-role { flex: 1; max-width: 200px; }
|
|---|
| 283 | }
|
|---|
| 284 | </style>
|
|---|