source: Klonkt/src/views/pages/admin-sites.ejs@ b12e20d

main
Last change on this file since b12e20d was f735304, checked in by roboburr <roboburr@…>, 3 months ago

Hub: /sites/:slug → 301 to canonical /user/:slug (single URL scheme)

resolveSite permanently redirects the legacy /sites/ form to /user/ (preserves
path + querystring; hub mode only; does not affect /admin/sites). The only
internal /sites/ link (admin-sites list) now points directly to /user/.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@…>

  • Property mode set to 100644
File size: 9.7 KB
Line 
1<div class="container ax-page">
2
3 <p><a href="/admin" class="btn">&larr; Beheer</a></p>
4 <header class="ax-header">
5 <div>
6 <h1>Sites</h1>
7 <p class="ax-tagline">Beheer alle sites op deze installatie.</p>
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 <div class="ax-actions-bar">
15 <a href="/admin/sites/new" class="ax-btn ax-btn-primary">+ Nieuwe site</a>
16 </div>
17
18 <% if (!sites.length) { %>
19 <div class="ax-card">
20 <div class="ax-empty">
21 <div class="ax-empty-icon">🌐</div>
22 <p>Nog geen sites.</p>
23 <p class="ax-empty-sub">Maak er een via de knop hierboven.</p>
24 </div>
25 </div>
26 <% } else { %>
27 <ul class="ax-list">
28 <% sites.forEach(function(s) { %>
29 <li class="ax-site">
30
31 <div class="ax-site-id">
32 <%# Sites have no avatar in the data model — fall back to the first
33 letter of their title, same pattern as users without avatar_url. %>
34 <span class="ax-avatar ax-avatar-empty"><%= (s.title || s.slug || '?').charAt(0).toUpperCase() %></span>
35 <div class="ax-site-meta">
36 <div class="ax-site-name">
37 <a href="/user/<%= s.slug %>"><%= s.title %></a>
38 <% if (s.is_primary) { %>
39 <span class="ax-pill ax-pill-primary" title="Hoofd-/labelsite van deze installatie">★ primair</span>
40 <% } %>
41 <% if (s.is_public) { %>
42 <span class="ax-pill ax-pill-ok" title="Publiek zichtbaar">✓ public</span>
43 <% } else { %>
44 <span class="ax-pill" title="Niet publiek">🔒 private</span>
45 <% } %>
46 <% if (!s.robots_index) { %>
47 <span class="ax-pill" title="Niet geïndexeerd door zoekmachines">🚫🤖 noindex</span>
48 <% } %>
49 </div>
50 <div class="ax-site-slug">
51 <code>/<%= s.slug %></code>
52 <% if (s.owner_username) { %>
53 <span class="ax-track-sep">·</span>
54 <span>door <%= s.owner_username %></span>
55 <% } %>
56 </div>
57 </div>
58 </div>
59
60 <div class="ax-site-stats">
61 <span class="ax-stat" title="Aantal posts">
62 <span class="ax-stat-num"><%= s.post_count %></span>
63 <span class="ax-stat-label">posts</span>
64 </span>
65 <span class="ax-stat" title="Aangemaakt op">
66 <span class="ax-stat-num ax-stat-date"><%= formatDate(s.created_at) %></span>
67 <span class="ax-stat-label">created</span>
68 </span>
69 </div>
70
71 <div class="ax-site-controls">
72 <% if (!s.is_primary && (typeof canMutate === 'undefined' || canMutate)) { %>
73 <form method="post" action="/admin/sites/<%= s.slug %>/make-primary" style="margin:0;display:inline"
74 onsubmit="return confirm('Deze site instellen als de primaire/hoofd-site?')">
75 <button type="submit" class="ax-icon-btn" aria-label="Maak primair" title="Maak primaire/hoofd-site">★</button>
76 </form>
77 <% } %>
78 <a href="/admin/sites/<%= s.slug %>/edit" class="ax-icon-btn" aria-label="Bewerken" title="Bewerken">✎</a>
79 <form method="post" action="/admin/sites/<%= s.slug %>/delete" class="ax-delete-form"
80 onsubmit="return confirm('Site verwijderen? Lukt alleen als er geen posts zijn.')">
81 <button type="submit" class="ax-icon-btn ax-icon-btn-danger" aria-label="Verwijderen" title="Verwijderen">🗑</button>
82 </form>
83 </div>
84
85 </li>
86 <% }); %>
87 </ul>
88 <% } %>
89
90</div>
91
92<style>
93.ax-page { max-width: 880px; margin: 1.5rem auto 4rem; padding: 0 1rem; }
94.ax-header { display: flex; align-items: flex-start; gap: 0.75rem; margin-bottom: 1.5rem; }
95.ax-header h1 { font-family: var(--font-display, serif); font-size: 1.75rem; margin: 0 0 0.25rem; }
96.ax-tagline { color: var(--ink-muted, var(--ink-soft)); margin: 0; font-size: 0.9rem; }
97.ax-back {
98 display: inline-flex; align-items: center; justify-content: center;
99 width: 40px; height: 40px;
100 border: 1px solid var(--rule); border-radius: 8px;
101 background: var(--paper); color: var(--ink); text-decoration: none;
102 font-size: 1.1rem; flex-shrink: 0; transition: border-color 120ms;
103}
104.ax-back:hover { border-color: var(--accent); }
105
106.ax-flash { padding: 0.75rem 1rem; border-radius: 8px; margin-bottom: 1rem; font-size: 0.9rem; }
107.ax-flash-ok { background: rgba(40,160,90,.15); color: #2a9d5e; border: 1px solid rgba(40,160,90,.3); }
108.ax-flash-err { background: rgba(200,60,60,.15); color: #c33; border: 1px solid rgba(200,60,60,.3); }
109
110.ax-actions-bar { display: flex; margin-bottom: 1rem; }
111
112.ax-card {
113 background: var(--paper); border: 1px solid var(--rule);
114 border-radius: 12px; padding: 1.25rem;
115}
116.ax-empty { text-align: center; padding: 2rem 1rem; color: var(--ink-muted); }
117.ax-empty-icon { font-size: 2.5rem; margin-bottom: 0.5rem; opacity: 0.5; }
118.ax-empty p { margin: 0; }
119.ax-empty-sub { font-size: 0.85rem; margin-top: 0.5rem !important; }
120
121.ax-btn {
122 display: inline-flex; align-items: center; justify-content: center; gap: 0.4rem;
123 padding: 0.6rem 1.1rem;
124 border: 1px solid var(--rule); background: var(--paper-2);
125 color: var(--ink);
126 font-family: var(--font-ui, system-ui), sans-serif;
127 font-size: 0.95rem; font-weight: 500;
128 text-decoration: none; border-radius: 8px; cursor: pointer;
129 min-height: 44px;
130 transition: background 120ms, border-color 120ms;
131 -webkit-tap-highlight-color: transparent;
132}
133.ax-btn:hover { border-color: var(--accent); }
134.ax-btn-primary { background: var(--accent); color: white; border-color: var(--accent); }
135.ax-btn-primary:hover { opacity: 0.92; }
136
137.ax-icon-btn {
138 display: inline-flex; align-items: center; justify-content: center;
139 width: 40px; height: 40px;
140 border: 1px solid var(--rule); border-radius: 8px;
141 background: var(--paper-2); color: var(--ink);
142 cursor: pointer; font-size: 1rem;
143 text-decoration: none;
144 transition: background 120ms, border-color 120ms, color 120ms;
145}
146.ax-icon-btn:hover { border-color: var(--accent); }
147.ax-icon-btn-danger:hover { color: #dc2626; border-color: #dc2626; }
148
149/* ─── Site cards (same structure as admin-users) ──────────────── */
150.ax-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 0.6rem; }
151.ax-site {
152 display: grid;
153 grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr) auto;
154 gap: 1rem;
155 align-items: center;
156 padding: 0.85rem 1rem;
157 background: var(--paper);
158 border: 1px solid var(--rule);
159 border-radius: 12px;
160 transition: border-color 120ms;
161}
162.ax-site:hover { border-color: var(--accent); }
163
164.ax-site-id { display: flex; align-items: center; gap: 0.75rem; min-width: 0; }
165.ax-avatar {
166 width: 44px; height: 44px;
167 border-radius: 10px; /* squarer than user avatars — sites read better as rounded squares */
168 object-fit: cover;
169 background: var(--paper-2);
170 color: var(--accent);
171 display: inline-flex; align-items: center; justify-content: center;
172 font-family: var(--font-display, serif);
173 font-weight: 700; font-size: 1.1rem;
174 flex-shrink: 0;
175}
176.ax-site-meta { min-width: 0; display: flex; flex-direction: column; gap: 0.2rem; }
177.ax-site-name {
178 font-weight: 600; font-size: 0.95rem;
179 display: flex; align-items: baseline; gap: 0.4rem; flex-wrap: wrap;
180}
181.ax-site-name a { color: var(--ink); text-decoration: none; }
182.ax-site-name a:hover { color: var(--accent); }
183.ax-site-slug {
184 font-size: 0.8rem;
185 color: var(--ink-muted, var(--ink-soft));
186 display: flex; align-items: center; gap: 0.3rem; flex-wrap: wrap;
187}
188.ax-site-slug code {
189 font-family: var(--font-mono, ui-monospace, monospace);
190 background: var(--paper-2);
191 padding: 0.1em 0.4em; border-radius: 4px;
192 font-size: 0.95em;
193 color: var(--ink-soft);
194}
195.ax-track-sep { opacity: 0.5; }
196
197.ax-pill {
198 font-family: var(--font-ui);
199 font-size: 0.7rem; font-weight: 500;
200 color: var(--ink-soft);
201 background: var(--paper-2);
202 padding: 0.15em 0.55em; border-radius: 999px;
203 letter-spacing: 0;
204}
205.ax-pill-ok {
206 color: #2a9d5e;
207 background: rgba(40,160,90,0.12);
208}
209.ax-pill-primary {
210 color: var(--accent);
211 background: color-mix(in srgb, var(--accent) 14%, transparent);
212 font-weight: 600;
213}
214
215/* ─── Stats (2 mini-columns for sites) ────────────────────────── */
216.ax-site-stats {
217 display: flex; gap: 1.5rem;
218 align-items: center;
219}
220.ax-stat {
221 display: flex; flex-direction: column;
222 font-size: 0.8rem;
223 text-align: center;
224 min-width: 0;
225}
226.ax-stat-num {
227 font-family: var(--font-display, serif);
228 font-weight: 600; font-size: 1.05rem;
229 color: var(--ink);
230 font-variant-numeric: tabular-nums;
231}
232.ax-stat-date {
233 font-family: var(--font-ui, system-ui);
234 font-size: 0.75rem;
235 font-weight: 500;
236 white-space: nowrap;
237}
238.ax-stat-label {
239 color: var(--ink-muted, var(--ink-soft));
240 text-transform: uppercase;
241 letter-spacing: 0.04em;
242 font-size: 0.7rem;
243}
244
245.ax-site-controls {
246 display: flex; gap: 0.5rem; align-items: center;
247 flex-shrink: 0;
248}
249.ax-delete-form { margin: 0; display: inline; }
250
251/* ─── Mobile: stack everything vertically (same pattern as users) */
252@media (max-width: 720px) {
253 .ax-site {
254 grid-template-columns: 1fr;
255 grid-template-areas: "id" "stats" "controls";
256 gap: 0.75rem;
257 }
258 .ax-site-id { grid-area: id; }
259 .ax-site-stats { grid-area: stats; justify-content: flex-start; gap: 1.5rem; padding-top: 0.5rem; border-top: 1px solid var(--rule); }
260 .ax-site-controls { grid-area: controls; justify-content: flex-end; }
261}
262</style>
Note: See TracBrowser for help on using the repository browser.