84 lines
4.2 KiB
Plaintext
84 lines
4.2 KiB
Plaintext
<div
|
|
class="m-1 flex min-h-fit flex-col rounded-lg border border-slate-300 bg-slate-50 divide-y divide-slate-300 shadow-sm group sm:hover:shadow-md transition-shadow duration-200"
|
|
>
|
|
<div class="flex justify-between p-2">
|
|
<%= render "domain/posts/inline_postable_domain_link", post: post %>
|
|
</div>
|
|
<div class="flex flex-grow items-center justify-center p-2 relative">
|
|
<% if (thumbnail_file = gallery_file_for_post(post)) && (thumbnail_path = thumbnail_for_post_path(post)) %>
|
|
<%= link_to domain_post_path(post) do %>
|
|
<%= image_tag thumbnail_path,
|
|
class:
|
|
"max-h-[250px] max-w-[250px] rounded-md border border-slate-300 object-contain shadow-md",
|
|
alt: post.title_for_view %>
|
|
<% end %>
|
|
<% elsif file_info = gallery_file_info_for_post(post) %>
|
|
<% if file_info == :post_pending %>
|
|
<span class="text-sm text-slate-500 italic">Post pending scan</span>
|
|
<% elsif file_info == :file_pending %>
|
|
<span class="text-sm text-slate-500 italic">File pending download</span>
|
|
<% else %>
|
|
<div class="flex items-center border border-slate-200 rounded-md px-3 py-2 bg-slate-100 shadow-sm">
|
|
<i class="fas fa-file-alt text-slate-400 mr-2"></i>
|
|
<span class="text-sm text-slate-500 italic"><%= file_info %>, <%= gallery_file_size_for_post(post) %></span>
|
|
</div>
|
|
<% end %>
|
|
<% else %>
|
|
<span class="text-sm text-slate-500 italic">No file available</span>
|
|
<% end %>
|
|
<% if post.num_post_files_for_view > 1 %>
|
|
<div class="absolute top-0 right-0 bg-slate-600 text-slate-200 text-sm opacity-80 font-bold px-2 py-1 rounded-bl shadow-md flex items-center gap-1 group-hover:opacity-100 transition-opacity duration-200 pointer-events-none whitespace-nowrap z-10">
|
|
<i class="fa fa-images"></i>
|
|
<%= post.num_post_files_for_view %>
|
|
</div>
|
|
<% end %>
|
|
</div>
|
|
<div>
|
|
<h2 class="p-1 pb-0 text-center text-md">
|
|
<%= link_to(
|
|
post.title_for_view,
|
|
domain_post_path(post),
|
|
title: post.title_for_view,
|
|
class: "blue-link inline-block truncate max-w-[250px]",
|
|
) %>
|
|
</h2>
|
|
<div class="px-2 pb-2 text-sm text-slate-500">
|
|
<div class="flex justify-between gap-2 items-center">
|
|
<% if @posts_index_view_config.show_creator_links %>
|
|
<% if creator = post.primary_creator_for_view || post.primary_fallback_creator_for_view %>
|
|
<span class="flex gap-1 items-center">
|
|
<span class="text-slate-500 italic text-sm">by</span>
|
|
<%= render "domain/has_description_html/inline_link_domain_user", user: creator, visual_style: "sky-link", size: "small" %>
|
|
</span>
|
|
<% elsif creator = post.primary_creator_name_fallback_for_view %>
|
|
<span class="flex gap-1 items-center" title="Guessed from sources">
|
|
<i class="fa-solid fa-user text-slate-500"></i>
|
|
<%= creator %>
|
|
</span>
|
|
<% end %>
|
|
<% end %>
|
|
<span class="flex-grow text-right">
|
|
<% user_post_fav = local_assigns[:user_post_fav] %>
|
|
<% if (faved_at = user_post_fav&.faved_at) && (time = faved_at.time) %>
|
|
<span class="flex items-center gap-1 justify-end">
|
|
<span
|
|
title="<%= time&.in_time_zone&.strftime("%Y-%m-%d %I:%M:%S %p %Z") %>"
|
|
><%= time_ago_in_words_no_prefix(time) %> ago</span>
|
|
<div class="relative group">
|
|
<i class="fas <%= faved_at_type_icon(faved_at.type) %>"></i>
|
|
<div class="absolute bottom-full right-0 mb-2 px-2 py-1 text-xs text-white bg-gray-800 rounded opacity-0 group-hover:opacity-100 transition-opacity duration-200 pointer-events-none whitespace-nowrap z-10">
|
|
<%= faved_at_type_tooltip(faved_at.type) %>
|
|
</div>
|
|
</div>
|
|
</span>
|
|
<% elsif post.posted_at %>
|
|
<span title="<%= post.posted_at&.strftime("%Y-%m-%d %I:%M:%S %p %Z") %>">
|
|
<%= time_ago_in_words_no_prefix(post.posted_at) %> ago
|
|
</span>
|
|
<% end %>
|
|
</span>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|