source: Klonkt/src/views/partials/post-tile.ejs@ d4c3c4e

main
Last change on this file since d4c3c4e 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.3 KB
Line 
1<%
2// Square Instagram-style tile for the .feed-grid view (v9 pattern).
3// - With cover → background-image, dark gradient overlay reveals title on hover/touch
4// - No cover → .grid-tile-gradient with the title centered (random hue per tile)
5const _tileHue = ((post.id || post.slug || '0').charCodeAt(0) * 7) % 360;
6const _isPinned = !!post.pinned;
7const _hasCover = !!post.cover_image_url;
8const _typeLabel = (post.type && post.type !== 'post') ? post.type : '';
9%>
10<a class="grid-tile<%= _hasCover ? '' : ' grid-tile-gradient' %><%= _isPinned ? ' is-pinned' : '' %>"
11 href="/<%= post.slug %>"
12 <% if (_hasCover) { %>style="background-image: url('<%= post.cover_image_url %>'); --tile-hue: <%= _tileHue %>;"<% } else { %>style="--tile-hue: <%= _tileHue %>;"<% } %>
13 hx-get="/<%= post.slug %>?partial=1"
14 hx-target="#pcms-main"
15 hx-swap="innerHTML"
16 hx-push-url="/<%= post.slug %>"
17 hx-indicator="#pcms-loading">
18
19 <% if (_typeLabel) { %>
20 <span class="grid-tile-type"><%= _typeLabel %></span>
21 <% } %>
22 <% if (_isPinned) { %>
23 <span class="grid-tile-pin">Pinned</span>
24 <% } %>
25
26 <% if (_hasCover) { %>
27 <div class="grid-tile-overlay">
28 <strong><%= post.title || '(untitled)' %></strong>
29 </div>
30 <% } else { %>
31 <span class="grid-tile-title"><%= post.title || '(untitled)' %></span>
32 <% } %>
33</a>
Note: See TracBrowser for help on using the repository browser.