| 1 | <%# View switcher partial — Tijdlijn / Grid + grid-cols picker.
|
|---|
| 2 | Mounted in shell.ejs once, visible on every non-admin page. Click
|
|---|
| 3 | handlers are wired in shell.ejs via event-delegation on document so
|
|---|
| 4 | HTMX-swapped content keeps working without rebinding. %>
|
|---|
| 5 | <%
|
|---|
| 6 | var _bc = (typeof bodyClass === 'string') ? bodyClass : '';
|
|---|
| 7 | var _onShows = _bc.indexOf('on-shows') >= 0;
|
|---|
| 8 | // Pagina's zonder actieve feed-weergave → niets in de pill is 'actief' (Solo/Cirkel
|
|---|
| 9 | // + Tijdlijn/Grid grijs). Alleen Agenda krijgt z'n eigen is-active op de agenda.
|
|---|
| 10 | var _neutral = ['on-shows','on-downloads','on-post','on-epk','on-linkbio','on-newsletter','on-archive','on-read']
|
|---|
| 11 | .some(function(c){ return _bc.indexOf(c) >= 0; });
|
|---|
| 12 | var _onRead = _bc.indexOf('on-read') >= 0;
|
|---|
| 13 | var _sbR = (typeof siteUrlBase !== 'undefined' && siteUrlBase) ? siteUrlBase : '';
|
|---|
| 14 | %>
|
|---|
| 15 | <div class="view-switcher-wrap">
|
|---|
| 16 | <div class="container">
|
|---|
| 17 | <% if (typeof premiumUnlocked !== 'undefined' && premiumUnlocked && typeof agendaEnabled !== 'undefined' && agendaEnabled) {
|
|---|
| 18 | var _sbA = (typeof siteUrlBase !== 'undefined' && siteUrlBase) ? siteUrlBase : '';
|
|---|
| 19 | %>
|
|---|
| 20 | <div class="agenda-pill">
|
|---|
| 21 | <a class="vs-agenda<%= _onShows ? ' is-active' : '' %>" href="<%= _sbA %>/shows" aria-label="Agenda — evenementen">
|
|---|
| 22 | <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect x="3" y="4" width="18" height="18" rx="2"/><line x1="16" y1="2" x2="16" y2="6"/><line x1="8" y1="2" x2="8" y2="6"/><line x1="3" y1="10" x2="21" y2="10"/></svg>
|
|---|
| 23 | <span><%= t('switch.agenda') %></span>
|
|---|
| 24 | </a>
|
|---|
| 25 | </div>
|
|---|
| 26 | <% } %>
|
|---|
| 27 | <% if (typeof hasCirkel !== 'undefined' && hasCirkel) {
|
|---|
| 28 | var _onCirkel = (typeof bodyClass === 'string' && bodyClass.indexOf('on-cirkel') >= 0);
|
|---|
| 29 | var _sb = (typeof siteUrlBase !== 'undefined' && siteUrlBase) ? siteUrlBase : '';
|
|---|
| 30 | %>
|
|---|
| 31 | <div class="feed-scope" role="tablist" aria-label="Solo of cirkel">
|
|---|
| 32 | <a class="feed-scope-btn<%= (!_neutral && !_onCirkel) ? ' is-active' : '' %>" href="<%= _sb %>/"
|
|---|
| 33 | role="tab" aria-selected="<%= (!_neutral && !_onCirkel) ? 'true' : 'false' %>"><%= t('switch.solo') %></a>
|
|---|
| 34 | <a class="feed-scope-btn<%= (!_neutral && _onCirkel) ? ' is-active' : '' %>" href="<%= _sb %>/cirkel"
|
|---|
| 35 | role="tab" aria-selected="<%= (!_neutral && _onCirkel) ? 'true' : 'false' %>"><%= t('switch.circle') %></a>
|
|---|
| 36 | </div>
|
|---|
| 37 | <% } %>
|
|---|
| 38 | <div class="view-switcher" role="tablist" aria-label="Weergave">
|
|---|
| 39 | <button type="button" class="view-switch-btn" data-view="timeline" role="tab"
|
|---|
| 40 | aria-selected="<%= (!_neutral && !(typeof site !== 'undefined' && site && site.feed_view_default === 'grid')) ? 'true' : 'false' %>">
|
|---|
| 41 | <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><line x1="8" y1="6" x2="21" y2="6"/><line x1="8" y1="12" x2="21" y2="12"/><line x1="8" y1="18" x2="21" y2="18"/><line x1="3" y1="6" x2="3.01" y2="6"/><line x1="3" y1="12" x2="3.01" y2="12"/><line x1="3" y1="18" x2="3.01" y2="18"/></svg>
|
|---|
| 42 | <span><%= t('switch.timeline') %></span>
|
|---|
| 43 | </button>
|
|---|
| 44 | <button type="button" class="view-switch-btn" data-view="grid" role="tab"
|
|---|
| 45 | aria-selected="<%= (!_neutral && (typeof site !== 'undefined' && site && site.feed_view_default === 'grid')) ? 'true' : 'false' %>">
|
|---|
| 46 | <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect x="3" y="3" width="7" height="7"/><rect x="14" y="3" width="7" height="7"/><rect x="14" y="14" width="7" height="7"/><rect x="3" y="14" width="7" height="7"/></svg>
|
|---|
| 47 | <span><%= t('switch.grid') %></span>
|
|---|
| 48 | </button>
|
|---|
| 49 | <%# Lezen is GEEN in-place omschakeling maar een andere route (/read), dus
|
|---|
| 50 | een <a> en niet een <button>. En bewust NIET de klasse view-switch-btn:
|
|---|
| 51 | de gedelegeerde klik in shell.ejs pakt alles met die klasse op, zet
|
|---|
| 52 | body[data-feed-view] erop en springt op niet-feedpagina's terug naar
|
|---|
| 53 | home -- dat zou deze link opeten. Andere klasse, zelfde uiterlijk.
|
|---|
| 54 | aria-selected staat hier vast: syncAria() raakt alleen .view-switch-btn
|
|---|
| 55 | aan, dus de actieve staat op /read blijft staan na een htmx-navigatie. %>
|
|---|
| 56 | <a class="view-switch-link" href="<%= _sbR %>/read" role="tab"
|
|---|
| 57 | aria-selected="<%= _onRead ? 'true' : 'false' %>">
|
|---|
| 58 | <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M2 3h6a4 4 0 0 1 4 4v14a3 3 0 0 0-3-3H2z"/><path d="M22 3h-6a4 4 0 0 0-4 4v14a3 3 0 0 1 3-3h7z"/></svg>
|
|---|
| 59 | <span><%= t('switch.reader') %></span>
|
|---|
| 60 | </a>
|
|---|
| 61 | </div>
|
|---|
| 62 | <% if (!_neutral) { %>
|
|---|
| 63 | <div class="grid-cols-picker" aria-label="Aantal kolommen">
|
|---|
| 64 | <button type="button" class="grid-cols-btn" data-cols="2" title="2 kolommen">2</button>
|
|---|
| 65 | <button type="button" class="grid-cols-btn" data-cols="3" title="3 kolommen">3</button>
|
|---|
| 66 | <button type="button" class="grid-cols-btn" data-cols="4" title="4 kolommen">4</button>
|
|---|
| 67 | </div>
|
|---|
| 68 | <% } %>
|
|---|
| 69 | </div>
|
|---|
| 70 | </div>
|
|---|