source: Klonkt/src/views/pages/admin.ejs@ 91c0a39

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

feat(i18n phase 2): admin dashboard + public calendar/downloads translated + language switcher in admin

  • Language switcher (select) also in the admin dashboard → choice for god/admin.
  • Translated: admin dashboard (title, tagline, all shortcuts, statistics, sections, table headers, post row), public calendar (shows) + downloads (incl. fix: loop var 't' shadowed the translate t() → label fetched upfront).
  • Dictionary extended (nl/en/de). Remaining admin sub-pages to follow.

Co-Authored-By: Claude <noreply@…>

  • Property mode set to 100644
File size: 10.3 KB
Line 
1<div class="container admin-page">
2 <% if (typeof langs !== 'undefined' && langs && langs.length > 1) { %>
3 <select class="footer-lang" style="float:right;margin-left:1rem" aria-label="<%= t('nav.language') %>"
4 onchange="location.href='/lang/'+this.value+'?r='+encodeURIComponent(location.pathname+location.search)">
5 <% langs.forEach(function(l){ %><option value="<%= l.code %>"<%= l.active ? ' selected' : '' %>><%= l.name %></option><% }); %>
6 </select>
7 <% } %>
8 <h1><%= t('admin.title') %></h1>
9 <% if (tenancy === 'hub') { %>
10 <p class="admin-tagline"><%= t('admin.tagline_hub') %></p>
11 <% } else { %>
12 <p class="admin-tagline"><%= t('admin.tagline_solo') %></p>
13 <% } %>
14
15 <nav class="admin-quick-links" aria-label="Beheer-snelkoppelingen">
16 <% if (tenancy === 'hub') { %>
17 <a href="/admin/sites" class="btn"><%= t('admin.b_sites') %></a>
18 <a href="/admin/users" class="btn"><%= t('admin.b_users') %></a>
19 <a href="/admin/audio" class="btn"><%= t('admin.b_audio') %></a>
20 <a href="/admin/playlists" class="btn"><%= t('admin.b_playlists') %></a>
21 <a href="/admin/comments" class="btn"><%= t('admin.b_comments') %></a>
22 <% if (primarySite) { %><a href="/admin/seo" class="btn"><%= t('admin.b_seo') %></a><% } %>
23 <a href="/admin/settings" class="btn"><%= t('admin.b_settings') %></a>
24 <% } else { %>
25 <a href="/posts/new" class="btn"><%= t('admin.b_newpost') %></a>
26 <a href="/admin/audio" class="btn"><%= t('admin.b_audio') %></a>
27 <a href="/admin/comments" class="btn"><%= t('admin.b_comments') %></a>
28 <% if (primarySite) { %>
29 <a href="/admin/sites/<%= primarySite.slug %>/edit" class="btn"><%= t('admin.b_look') %></a>
30 <% } else { %>
31 <a href="/admin/sites/new" class="btn"><%= t('admin.b_makesite') %></a>
32 <% } %>
33 <% if (tenancy === 'circle') { %>
34 <a href="/admin/circle" class="btn"><%= t('admin.b_circle') %></a>
35 <% } %>
36 <% if (primarySite) { %><a href="/admin/seo" class="btn"><%= t('admin.b_seo') %></a><% } %>
37 <a href="/admin/settings" class="btn"><%= t('admin.b_settings') %></a>
38 <% } %>
39 <% if (typeof premiumUnlocked === 'undefined' || premiumUnlocked) { %>
40 <a href="/admin/stats" class="btn"><%= t('admin.b_stats') %></a>
41 <a href="/admin/newsletter" class="btn"><%= t('admin.b_newsletter') %></a>
42 <% if (tenancy !== 'hub' && primarySite) { %><a href="/pers" class="btn" target="_blank"><%= t('admin.b_perskit') %></a><% } %>
43 <% if (tenancy !== 'hub' && primarySite) { %><a href="/downloads" class="btn" target="_blank"><%= t('admin.b_downloads') %></a><% } %>
44 <% if (tenancy !== 'hub' && primarySite) { %><a href="/links" class="btn" target="_blank"><%= t('admin.b_linkbio') %></a><% } %>
45 <a href="/admin/shows" class="btn"><%= t('admin.b_agenda') %></a>
46 <% } %>
47 <a href="/admin/settings/google" class="btn"><%= t('admin.b_google') %></a>
48 <a href="/admin/updates" class="btn"><%= t('admin.b_updates') %></a>
49 <a href="/admin/handleiding" class="btn"><%= t('admin.b_help') %></a>
50 </nav>
51
52 <div class="admin-stats">
53 <% if (tenancy === 'hub') { %>
54 <div class="stat-card"><div class="stat-num"><%= stats.users %></div><div class="stat-label"><%= t('admin.st_users') %></div></div>
55 <div class="stat-card"><div class="stat-num"><%= stats.sites %></div><div class="stat-label"><%= t('admin.st_sites') %></div></div>
56 <% } %>
57 <div class="stat-card"><div class="stat-num"><%= stats.posts %></div><div class="stat-label"><%= t('admin.st_posts') %></div></div>
58 <div class="stat-card"><div class="stat-num"><%= stats.published %></div><div class="stat-label"><%= t('admin.st_published') %></div></div>
59 </div>
60
61 <% if (typeof posts !== 'undefined' && posts && posts.length) { %>
62 <% var _drafts = posts.filter(function(p){ return p.isDraft; }).length; %>
63 <h2><%= t('admin.sec_posts') %><% if (_drafts) { %> <span class="pl-draftcount"><%= _drafts %> <%= t('admin.draft').toLowerCase() %><%= _drafts === 1 ? '' : 's' %></span><% } %></h2>
64 <ul class="post-admin-list">
65 <% posts.forEach(function(p) { %>
66 <li class="pal-row<%= p.isDraft ? ' is-draft' : '' %>">
67 <a class="pal-title" href="<%= p.editUrl %>">
68 <% if (p.isDraft) { %><span class="pal-badge"><%= t('admin.draft') %></span><% } %>
69 <span class="pal-name"><%= p.title || '(zonder titel)' %></span>
70 </a>
71 <span class="pal-actions">
72 <a class="pal-link" href="<%= p.editUrl %>"><%= t('admin.edit') %></a>
73 <% if (!p.isDraft) { %><a class="pal-link" href="<%= p.viewUrl %>"><%= t('admin.view') %></a><% } %>
74 </span>
75 </li>
76 <% }); %>
77 </ul>
78 <% } %>
79
80 <% if (sites && sites.length) { %>
81 <h2><%= t('admin.sec_sites') %></h2>
82 <table class="admin-table">
83 <thead>
84 <tr><th><%= t('admin.th_slug') %></th><th><%= t('admin.th_title') %></th><th><%= t('admin.th_owner') %></th><th><%= t('admin.th_created') %></th></tr>
85 </thead>
86 <tbody>
87 <% sites.forEach(function(s) { %>
88 <tr>
89 <td><code><%= s.slug %></code></td>
90 <td><%= s.title %></td>
91 <td><%= s.owner_username || '—' %></td>
92 <td><%= formatDate(s.created_at) %></td>
93 </tr>
94 <% }); %>
95 </tbody>
96 </table>
97 <% } %>
98
99 <% if (users && users.length) { %>
100 <h2><%= t('admin.sec_users') %></h2>
101 <table class="admin-table">
102 <thead>
103 <tr><th><%= t('admin.th_username') %></th><th><%= t('admin.th_email') %></th><th><%= t('admin.th_role') %></th><th><%= t('admin.th_joined') %></th></tr>
104 </thead>
105 <tbody>
106 <% users.forEach(function(u) { %>
107 <tr>
108 <td><%= u.username %></td>
109 <td><%= u.email %></td>
110 <td><span class="role-pill role-<%= u.role %>"><%= u.role %></span></td>
111 <td><%= formatDate(u.created_at) %></td>
112 </tr>
113 <% }); %>
114 </tbody>
115 </table>
116 <% } %>
117
118</div>
119
120<style>
121.admin-page { max-width: 1000px; margin: 3rem auto; padding: 0 1rem; }
122.admin-page h1 { font-family: var(--font-display, serif); font-size: 2rem; margin: 0 0 0.25rem; }
123.admin-page h2 { font-family: var(--font-display, serif); font-size: 1.4rem; margin: 2rem 0 0.75rem; }
124.admin-tagline { color: var(--ink-muted); margin: 0 0 2rem; }
125.admin-tagline em { font-style: normal; opacity: 0.7; }
126
127/* Posts/concepten-lijst */
128.pl-draftcount { font-family: var(--font-ui, system-ui); font-size: 0.8rem; font-weight: 700; color: var(--accent); background: color-mix(in srgb, var(--accent) 14%, transparent); padding: 0.1rem 0.55rem; border-radius: 99px; vertical-align: middle; }
129.post-admin-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.4rem; }
130.pal-row { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 0.7rem 0.9rem; border: 1px solid var(--rule); border-radius: 10px; background: var(--paper-2); transition: border-color 120ms; }
131.pal-row:hover { border-color: var(--accent); }
132.pal-row.is-draft { border-left: 3px solid var(--accent); }
133.pal-title { display: inline-flex; align-items: center; gap: 0.6rem; min-width: 0; color: var(--ink); text-decoration: none; font-weight: 600; }
134.pal-title:hover { color: var(--accent); }
135.pal-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
136.pal-badge { flex-shrink: 0; font-size: 0.68rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--accent); background: color-mix(in srgb, var(--accent) 14%, transparent); padding: 0.1rem 0.5rem; border-radius: 99px; }
137.pal-actions { display: flex; gap: 0.75rem; flex-shrink: 0; }
138.pal-link { color: var(--ink-muted); font-size: 0.85rem; text-decoration: none; white-space: nowrap; }
139.pal-link:hover { color: var(--accent); text-decoration: underline; }
140
141/* Quick-links grid — mobile-first.
142 auto-fit + minmax means: as many equal columns as fit, each at least 140px.
143 Mobile (~360-440px): 2 per row.
144 Tablet (~480-700px): 3 per row.
145 Desktop (≥ ~720px): all 5 in a single row. */
146.admin-quick-links {
147 display: grid;
148 grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
149 gap: 0.5rem;
150 margin: 0 0 1.5rem;
151 padding: 0;
152}
153.admin-quick-links .btn {
154 justify-content: center;
155 padding: 0.7rem 0.9rem;
156 font-weight: 600;
157 text-align: center;
158}
159.admin-quick-links .btn:hover {
160 background: color-mix(in srgb, var(--accent) 8%, var(--paper-2));
161 border-color: var(--accent);
162}
163
164.admin-stats {
165 display: grid;
166 grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
167 gap: 0.75rem;
168 margin-bottom: 1rem;
169}
170.stat-card {
171 background: var(--paper-2);
172 border: 1px solid var(--rule);
173 border-radius: 8px;
174 padding: 1rem 1.25rem;
175 text-align: center;
176}
177.stat-num {
178 font-size: 2rem;
179 font-weight: 700;
180 color: var(--accent);
181 line-height: 1;
182 font-family: var(--font-display, serif);
183}
184.stat-label {
185 color: var(--ink-muted);
186 font-size: 0.85rem;
187 text-transform: uppercase;
188 letter-spacing: 0.05em;
189 margin-top: 0.25rem;
190}
191
192.admin-table {
193 width: 100%;
194 border-collapse: collapse;
195 background: var(--paper-2);
196 border: 1px solid var(--rule);
197 border-radius: 8px;
198 overflow: hidden;
199}
200.admin-table th, .admin-table td {
201 padding: 0.6rem 0.9rem;
202 text-align: left;
203 border-bottom: 1px solid var(--rule);
204}
205.admin-table th {
206 background: var(--paper);
207 font-weight: 600;
208 font-size: 0.85rem;
209 text-transform: uppercase;
210 letter-spacing: 0.05em;
211 color: var(--ink-muted);
212}
213.admin-table tr:last-child td { border-bottom: 0; }
214.admin-table code { background: var(--paper); padding: 0.1rem 0.4rem; border-radius: 3px; font-size: 0.85rem; }
215
216.role-pill {
217 display: inline-block;
218 padding: 0.1rem 0.5rem;
219 border-radius: 10px;
220 font-size: 0.75rem;
221 text-transform: uppercase;
222 letter-spacing: 0.05em;
223 background: var(--paper);
224 color: var(--ink-muted);
225}
226.role-pill.role-god { background: var(--accent); color: white; }
227.role-pill.role-admin { background: var(--paper); color: var(--accent); border: 1px solid var(--accent); }
228
229.admin-todo {
230 margin: 2rem 0 0;
231 padding: 0.75rem 1rem;
232 background: var(--paper-2);
233 border-left: 3px solid var(--accent);
234 border-radius: 4px;
235 font-size: 0.9rem;
236 color: var(--ink-muted);
237}
238
239@media (max-width: 600px) {
240 .admin-table { font-size: 0.85rem; }
241 .admin-table th, .admin-table td { padding: 0.45rem 0.6rem; }
242}
243</style>
Note: See TracBrowser for help on using the repository browser.