source: Klonkt/src/views/pages/home.ejs@ 21522ae

main
Last change on this file since 21522ae was 7bc636b, checked in by Robin <robin@…>, 4 months ago

Initial commit — PrutFolio v1 source (pulled from Hetzner /srv/prutfolio)

  • Property mode set to 100644
File size: 1.8 KB
RevLine 
[7bc636b]1<%
2// Homepage — feed of posts.
3//
4// Renders BOTH a timeline view (.post-list, default) AND a grid view
5// (.feed-grid, square Instagram-style tiles). CSS toggles between the
6// two based on body[data-feed-view="timeline"|"grid"]. This mirrors the
7// v9 pattern in lib/template-content.php so the same view-switcher works.
8//
9// Pinned posts sort first inside the timeline list; they are not given a
10// separate "Pinned" header (v9 just lets order speak for itself + a ★ chip).
11
12const allPosts = [...pinnedPosts, ...posts];
13%>
14
15<%# View switcher used to be rendered here; moved to shell.ejs (above
16 #pcms-main) so it survives HTMX swaps and is visible on every
17 non-admin page. %>
18
19<!-- ========== TIMELINE ========== -->
20<div class="container feed-timeline">
21
22 <% if (allPosts.length === 0) { %>
23 <div class="empty">
24 <h1>Hier is het nog stil.</h1>
25 <p>Nog geen posts. Spannend.</p>
26 <% if (user && permissions.canCreatePost(user, site)) { %>
27 <p style="margin-top:2rem">
28 <a class="btn" href="/posts/new"
29 hx-get="/posts/new?partial=1" hx-target="#pcms-main" hx-swap="innerHTML"
30 hx-push-url="/posts/new" hx-indicator="#pcms-loading">
31 Schrijf je eerste post →
32 </a>
33 </p>
34 <% } %>
35 </div>
36 <% } else { %>
37 <ul class="post-list feed-timeline-list">
38 <% allPosts.forEach(function(post) { %>
39 <%- include('../partials/post-card', { post: post }) %>
40 <% }); %>
41 </ul>
42 <% } %>
43
44</div>
45
46<!-- ========== GRID (only visible when body[data-feed-view="grid"]) ========== -->
47<% if (allPosts.length > 0) { %>
48<section class="feed-grid container" aria-label="Grid-weergave">
49 <div class="grid-tiles">
50 <% allPosts.forEach(function(post) { %>
51 <%- include('../partials/post-tile', { post: post }) %>
52 <% }); %>
53 </div>
54</section>
55<% } %>
Note: See TracBrowser for help on using the repository browser.