Files
redux-scraper/app/views/domain/inkbunny/posts/index.html.erb
2024-12-19 06:04:37 +00:00

33 lines
1.4 KiB
Plaintext

<div class='mx-auto'>
<% if @user %>
<h1 class='text-2xl'><%= link_to(@user.name, @user, class: "underline") %>'s posts</h1>
<% else %>
<h1 class='text-2xl'>Inkbunny Posts (<%= @posts.total_count %>), page <%= page_str(params) %></h1>
<% end %>
</div>
<div class='flex-row mx-2 flex justify-between'>
<%= link_to "Previous page", path_to_prev_page(@posts) %>
<%= link_to "Next page", path_to_next_page(@posts) %>
</div>
<div class='flex-row mx-2'>
<% @posts.each do |post| %>
<div class='border-stone-00 border-2 rounded-md mb-4 p-4'>
<div class='text-stone-800 mb-2 flex justify-between'>
<div>
<%= link_to post.title, post, class: 'hover:underline' %>
<span class="text-stone-500 text-sm ml-2">by <%= link_to post.creator.name, post.creator, class: 'hover:underline' %></span>
</div>
<div class='text-stone-400 text-sm'>(ID: <%= post.ib_post_id %>, <%= pluralize(post.files.count, 'file') %>)</div>
</div>
<div class='flex flex-row gap-2'>
<% post.files.each do |file| %>
<% img_src_path = contents_blob_path(HexUtil.bin2hex(file.blob_entry_sha256), format: "jpg", thumb: 'small') %>
<div class="rounded-md overflow-hidden">
<img class='p-2 first:pl-0 last:pr-0 h-32' alt='<%= post.title %>' src='<%= img_src_path %>' />
</div>
<% end %>
</div>
</div>
<% end %>
</div>