source: Klonkt/src/views/partials/like-button.ejs@ 40cf2ef

main
Last change on this file since 40cf2ef was 834bcc3, checked in by Robin Genis <roboburr@…>, 3 months ago

i18n: translate Dutch code comments to English across src/

Comments in routes/services/views/config/middleware/assets translated to
English for the public repo. A few dev-facing throw/console message strings
were Englished too. No user-facing UI strings or i18n dictionary values changed
(src/services/i18n.js untouched). Logic unchanged.

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

  • Property mode set to 100644
File size: 1.3 KB
Line 
1<%# Like/favourite button for a post. Logged in → htmx toggle (POST /posts/:id/like,
2 swaps outerHTML back with this partial). Not logged in → link to login.
3 Expects: post (with .id), likedByMe, likeCount, loggedIn, loginNext. %>
4<%
5 var _liked = (typeof likedByMe !== 'undefined' && likedByMe);
6 var _cnt = (typeof likeCount !== 'undefined' && likeCount != null) ? likeCount : 0;
7 var _logged = (typeof loggedIn !== 'undefined' && loggedIn);
8%>
9<% if (_logged) { %>
10 <button type="button" class="like-btn<%= _liked ? ' is-liked' : '' %>"
11 hx-post="/posts/<%= post.id %>/like" hx-swap="outerHTML"
12 aria-pressed="<%= _liked ? 'true' : 'false' %>"
13 aria-label="<%= _liked ? 'Uit favorieten verwijderen' : 'Toevoegen aan favorieten' %>"
14 title="<%= _liked ? 'Uit favorieten verwijderen' : 'Toevoegen aan favorieten' %>">
15 <span class="like-heart" aria-hidden="true"><%= _liked ? '♥' : '♡' %></span>
16 <span class="like-count"><%= _cnt %></span>
17 </button>
18<% } else { %>
19 <a class="like-btn" href="/auth/login?next=<%= encodeURIComponent((typeof loginNext !== 'undefined' && loginNext) ? loginNext : '/') %>"
20 title="<%= t('like.login_title') %>">
21 <span class="like-heart" aria-hidden="true">♡</span>
22 <span class="like-count"><%= _cnt %></span>
23 </a>
24<% } %>
Note: See TracBrowser for help on using the repository browser.