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

main
Last change on this file since d0f4c10 was 1f0c85b, checked in by roboburr <roboburr@…>, 3 months ago

ui(grid): show source site on hover on circle feed tiles

Grid tiles now show "from <site>" (post.source_name) in the hover overlay
(and on gradient tiles below the title), so in the circle feed it is clear
which site a post comes from. style.css?v=14.

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

  • Property mode set to 100644
File size: 1.8 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 _src = post.source_name || ''; // bron-site (cirkel-feed: van welke site komt deze post)
10const _base = (typeof siteUrlBase !== 'undefined' && siteUrlBase) ? siteUrlBase : '';
11const _external = post.external_url || null;
12const _href = _external || (_base + '/' + post.slug);
13const _ext = !!_external;
14%>
15<a class="grid-tile<%= _hasCover ? '' : ' grid-tile-gradient' %><%= _isPinned ? ' is-pinned' : '' %>"
16 href="<%= _href %>"
17 <% if (_hasCover) { %>style="background-image: url('<%= post.cover_image_url %>'); --tile-hue: <%= _tileHue %>;"<% } else { %>style="--tile-hue: <%= _tileHue %>;"<% } %>
18 <% 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"<% } %>>
19
20 <% if (_typeLabel) { %>
21 <span class="grid-tile-type"><%= _typeLabel %></span>
22 <% } %>
23 <% if (_isPinned) { %>
24 <span class="grid-tile-pin">Pinned</span>
25 <% } %>
26
27 <% if (_hasCover) { %>
28 <div class="grid-tile-overlay">
29 <strong><%= post.title || '(untitled)' %></strong>
30 <% if (_src) { %><span class="grid-tile-overlay-src">van <%= _src %></span><% } %>
31 </div>
32 <% } else { %>
33 <span class="grid-tile-title"><%= post.title || '(untitled)' %></span>
34 <% if (_src) { %><span class="grid-tile-gradient-src">van <%= _src %></span><% } %>
35 <% } %>
36</a>
Note: See TracBrowser for help on using the repository browser.