source: Klonkt/src/views/pages/admin-epk.ejs@ 4dcefa1

main
Last change on this file since 4dcefa1 was 6c574b4, checked in by roboburr <roboburr@…>, 3 months ago

fix(epk): clear custom checkbox instead of unclear native one

Native checkbox rendered poorly in dark mode. Now a custom box: empty with
a border, and an accent box with a white ✓ when checked (+ row tint). Native
input hidden but functional.

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

  • Property mode set to 100644
File size: 5.6 KB
RevLine 
[9d9f3c1]1<div class="container admin-page">
2 <h1>Perskit bewerken</h1>
3 <p><a href="/admin" class="btn">&larr; Beheer</a> <a href="/pers" class="btn" target="_blank" rel="noopener">📰 Bekijk perskit</a></p>
4
5 <% if (success) { %><div class="alert alert-success"><%= success %></div><% } %>
6
7 <section class="set-card">
8 <h2>Tekst</h2>
9 <p class="set-help">
10 De perskit (<code>/pers</code>) toont je sitenaam + foto, deze bio en contact,
11 plus automatisch je meest beluisterde nummers en recente posts. Laat de bio
12 leeg om de site-tagline te gebruiken; laat contact leeg om niets te tonen
13 (je login-mail wordt nooit automatisch getoond).
14 </p>
15
16 <form method="post" action="/admin/epk" class="set-form">
17 <label class="set-field">
18 <span>Pers-bio</span>
19 <textarea name="epk_bio" rows="5" maxlength="1000"
20 placeholder="Korte beschrijving van jou/het project voor pers &amp; boekers."><%= epkBio %></textarea>
21 </label>
22 <label class="set-field">
23 <span>Pers-contact</span>
24 <input type="text" name="epk_contact" maxlength="300"
25 placeholder="bv. pers@jouwdomein.nl of een boekingslink"
26 value="<%= epkContact %>">
27 </label>
[e6ad948]28
29 <div class="set-field">
30 <span>Nummers op de perskit <small>(kies er max <%= maxEpkTracks %>; laat leeg voor automatisch de top <%= maxEpkTracks %> meest beluisterd)</small></span>
31 <% if (!allTracks.length) { %>
32 <p class="set-help" style="margin:0">Nog geen nummers — voeg eerst audio toe in Beheer → Audio.</p>
33 <% } else { %>
34 <div class="epk-track-pick" data-max="<%= maxEpkTracks %>">
35 <% allTracks.forEach(function(t){ %>
36 <label class="epk-pick-item">
37 <input type="checkbox" name="epk_tracks" value="<%= t.id %>" <%= chosenTracks.indexOf(t.id) >= 0 ? 'checked' : '' %>>
[6c574b4]38 <span class="epk-box" aria-hidden="true">✓</span>
[e6ad948]39 <span class="epk-pick-title"><%= t.title || '(zonder titel)' %></span>
40 <% if (t.artist) { %><span class="epk-pick-artist"><%= t.artist %></span><% } %>
41 </label>
42 <% }); %>
43 </div>
44 <% } %>
45 </div>
46
[9d9f3c1]47 <button type="submit" class="btn btn-primary">Opslaan</button>
48 </form>
49 </section>
50</div>
[57b1843]51
52<style>
53 .admin-page .set-card { background: var(--paper-2); border: 1px solid var(--rule); border-radius: 12px; padding: 1.25rem; margin-top: 1rem; }
54 .admin-page .set-card h2 { font-family: var(--font-display, serif); font-size: 1.25rem; margin: 0 0 0.5rem; }
55 .admin-page .set-help { font-size: 0.85rem; color: var(--ink-soft, var(--ink-muted)); line-height: 1.5; margin: 0 0 1rem; max-width: 60ch; }
56 .admin-page .set-form { display: flex; flex-direction: column; gap: 1rem; max-width: 520px; }
57 .admin-page .set-field { display: flex; flex-direction: column; gap: 0.3rem; }
58 .admin-page .set-field > span { font-size: 0.8rem; font-weight: 600; color: var(--ink-soft, var(--ink-muted)); }
59 .admin-page .set-field input,
60 .admin-page .set-field textarea {
61 width: 100%; box-sizing: border-box;
62 padding: 0.6rem 0.75rem;
63 border: 1px solid var(--rule); border-radius: 6px;
64 background: var(--paper); color: var(--ink);
65 font-family: var(--font-ui, system-ui), sans-serif; font-size: 0.95rem;
66 -webkit-appearance: none; appearance: none;
67 }
68 .admin-page .set-field textarea { resize: vertical; line-height: 1.5; }
69 .admin-page .set-field input:focus,
70 .admin-page .set-field textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: var(--accent); }
71 .admin-page .set-form .btn { align-self: flex-start; }
[e6ad948]72 .admin-page .epk-track-pick { display: flex; flex-direction: column; gap: 2px; max-height: 300px; overflow-y: auto; border: 1px solid var(--rule); border-radius: 8px; padding: 4px; }
[d252ce8]73 .admin-page .epk-pick-item { display: flex; align-items: center; gap: 0.6rem; padding: 0.5rem 0.6rem; border-radius: 6px; cursor: pointer; border: 1px solid transparent; }
[e6ad948]74 .admin-page .epk-pick-item:hover { background: var(--paper); }
[6c574b4]75 /* Native checkbox verbergen; we tekenen een eigen, duidelijk vakje (.epk-box). */
76 .admin-page .epk-pick-item input { position: absolute; opacity: 0; width: 0; height: 0; pointer-events: none; }
77 .admin-page .epk-box {
78 flex: 0 0 auto; width: 20px; height: 20px;
79 border: 2px solid var(--rule); border-radius: 5px;
80 display: grid; place-items: center;
81 color: transparent; font-size: 13px; font-weight: 900; line-height: 1;
82 }
83 .admin-page .epk-pick-item:has(input:checked) .epk-box { background: var(--accent); border-color: var(--accent); color: #fff; }
84 /* Aangevinkte rij ook getint. */
[d252ce8]85 .admin-page .epk-pick-item:has(input:checked) {
[6c574b4]86 background: color-mix(in srgb, var(--accent) 14%, transparent);
[d252ce8]87 border-color: color-mix(in srgb, var(--accent) 45%, transparent);
88 }
[6c574b4]89 .admin-page .epk-pick-item:has(input:disabled) { opacity: .45; cursor: not-allowed; }
[e6ad948]90 .admin-page .epk-pick-title { font-weight: 600; }
91 .admin-page .epk-pick-artist { color: var(--ink-muted, var(--ink-soft)); font-size: 0.85rem; }
92 .admin-page .epk-pick-item input:disabled ~ .epk-pick-title { opacity: 0.45; }
[57b1843]93</style>
[e6ad948]94<script>
95(function () {
96 var box = document.querySelector('.epk-track-pick');
97 if (!box) return;
98 var max = parseInt(box.dataset.max, 10) || 5;
99 function sync() {
100 var checks = box.querySelectorAll('input[type=checkbox]');
101 var n = box.querySelectorAll('input[type=checkbox]:checked').length;
102 checks.forEach(function (c) { c.disabled = (!c.checked && n >= max); });
103 }
104 box.addEventListener('change', sync);
105 sync();
106})();
107</script>
Note: See TracBrowser for help on using the repository browser.