PostText/templates/thread/by_page.html.ep

61 lines
2 KiB
Plaintext

% layout 'default';
% title 'Threads List';
% content_for open_graph => begin
<meta property="og:type" content="website">
<meta property="og:title" content="<%= title %>">
<meta property="og:description" content="In UTF-8 we trust. 🫡">
% end
% content_for twitter_card => begin
<meta name="twitter:title" content="<%= title %>">
<meta name="twitter:description" content="In UTF-8 we trust. 🫡">
% end
<h2 class="page-title"><%= title %></h2>
<% if (scalar @{$threads}) { =%>
<main class="pager">
<% for my $thread (@{$threads}) { =%>
<article class="post">
<h3 class="post__title">
<span>
<%= $thread->{'title'} %>
</span>
<%= link_to "#$thread->{'id'}", single_thread =>
{thread_id => $thread->{'id'}}, (class => 'post__id') %>
</h3>
<h4 class="post__date"><%= $thread->{'date'} %></h4>
<h5 class="post__author"><%= $thread->{'author'} %></h5>
<% if (299 < length $thread->{'body'}) { =%>
<details class="post__body">
<summary>
<%= truncate_text $thread->{'body'} %>
</summary>
<%== markdown $thread->{'body'} =%>
</details>
<% } else { =%>
<div class="post__body">
<%== markdown $thread->{'body'} =%>
</div>
<% } =%>
<nav class="post__nav">
<%= link_to Remark => post_remark => {thread_id => $thread->{'id'}},
(class => 'click') %>
<%= link_to url_for(single_thread => {thread_id => $thread->{'id'}})
->fragment('remarks'), (class => 'click'), begin %>
<%= $thread->{'remark_tally'} %> Remarks
<% end %>
<%= link_to bump_thread => {thread_id => $thread->{'id'}},
(class => 'click'), begin %>
Bump (<%= $thread->{'bump_tally'} %>)
<% end %>
<%= link_to Flag => flag_thread => {thread_id => $thread->{'id'}},
(class => 'click') %>
</nav>
</article>
<% } =%>
<% if ($last_page && $last_page != 1) { =%>
<nav class="pager__nav">
<%= pagination $this_page, $last_page, ($base_path . '/{page}') %>
</nav>
<% } =%>
</main>
<% } =%>