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

main
Last change on this file since 8ea3d0d was 43dbf9c, checked in by roboburr <roboburr@…>, 3 months ago

Circles: /cirkel uses the home view (timeline + grid + switcher)

  • post-card/post-tile external-aware: post.external_url -> external link (target=_blank, no htmx) instead of local /slug. Additive; normal posts unchanged. post-card shows 'via <source>' when external.
  • circle.js maps remote_posts to the local post shape + bodyClass on-cirkel.
  • circle-feed.ejs: feed-timeline (.post-list) + feed-grid (.grid-tiles), same classes as home -> the view-switcher works. shell: on-cirkel = feed-page.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@…>

  • Property mode set to 100644
File size: 1.6 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 : '';
9const _base = (typeof siteUrlBase !== 'undefined' && siteUrlBase) ? siteUrlBase : '';
10const _external = post.external_url || null;
11const _href = _external || (_base + '/' + post.slug);
12const _ext = !!_external;
13%>
14<a class="grid-tile<%= _hasCover ? '' : ' grid-tile-gradient' %><%= _isPinned ? ' is-pinned' : '' %>"
15 href="<%= _href %>"
16 <% if (_hasCover) { %>style="background-image: url('<%= post.cover_image_url %>'); --tile-hue: <%= _tileHue %>;"<% } else { %>style="--tile-hue: <%= _tileHue %>;"<% } %>
17 <% if (_ext) { %>target="_blank" rel="noopener"<% } else { %>hx-get="<%= _href %>?partial=1" hx-target="#pcms-main" hx-swap="innerHTML" hx-push-url="<%= _href %>" 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.