show number of files associated with post if > 1
This commit is contained in:
@@ -144,6 +144,10 @@ class Domain::Post < ReduxApplicationRecord
|
|||||||
def title
|
def title
|
||||||
end
|
end
|
||||||
|
|
||||||
|
sig { abstract.returns(Integer) }
|
||||||
|
def num_post_files_for_view
|
||||||
|
end
|
||||||
|
|
||||||
sig { overridable.returns(String) }
|
sig { overridable.returns(String) }
|
||||||
def title_for_view
|
def title_for_view
|
||||||
title || "(unknown)"
|
title || "(unknown)"
|
||||||
|
|||||||
@@ -57,6 +57,11 @@ class Domain::Post::BlueskyPost < Domain::Post
|
|||||||
["bsky", :rkey]
|
["bsky", :rkey]
|
||||||
end
|
end
|
||||||
|
|
||||||
|
sig { override.returns(Integer) }
|
||||||
|
def num_post_files_for_view
|
||||||
|
self.files.group(:file_order).count.size
|
||||||
|
end
|
||||||
|
|
||||||
sig { override.returns(String) }
|
sig { override.returns(String) }
|
||||||
def self.view_prefix
|
def self.view_prefix
|
||||||
"bsky"
|
"bsky"
|
||||||
|
|||||||
@@ -47,6 +47,11 @@ class Domain::Post::E621Post < Domain::Post
|
|||||||
self.index_page_ids << log_entry.id
|
self.index_page_ids << log_entry.id
|
||||||
end
|
end
|
||||||
|
|
||||||
|
sig { override.returns(Integer) }
|
||||||
|
def num_post_files_for_view
|
||||||
|
1
|
||||||
|
end
|
||||||
|
|
||||||
sig { override.returns([String, Symbol]) }
|
sig { override.returns([String, Symbol]) }
|
||||||
def self.param_prefix_and_attribute
|
def self.param_prefix_and_attribute
|
||||||
["e621", :e621_id]
|
["e621", :e621_id]
|
||||||
|
|||||||
@@ -50,6 +50,11 @@ class Domain::Post::FaPost < Domain::Post
|
|||||||
self.creator
|
self.creator
|
||||||
end
|
end
|
||||||
|
|
||||||
|
sig { override.returns(Integer) }
|
||||||
|
def num_post_files_for_view
|
||||||
|
1
|
||||||
|
end
|
||||||
|
|
||||||
sig { override.returns(T.nilable(T.any(String, Integer))) }
|
sig { override.returns(T.nilable(T.any(String, Integer))) }
|
||||||
def domain_id_for_view
|
def domain_id_for_view
|
||||||
self.fa_id
|
self.fa_id
|
||||||
|
|||||||
@@ -135,4 +135,9 @@ class Domain::Post::InkbunnyPost < Domain::Post
|
|||||||
def num_favorites_for_view
|
def num_favorites_for_view
|
||||||
num_favs
|
num_favs
|
||||||
end
|
end
|
||||||
|
|
||||||
|
sig { override.returns(Integer) }
|
||||||
|
def num_post_files_for_view
|
||||||
|
self.files.group(:file_order).count.size
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -112,4 +112,10 @@ class Domain::Post::SofurryPost < Domain::Post
|
|||||||
def scanned_post_log_entry_for_view
|
def scanned_post_log_entry_for_view
|
||||||
last_scan_log_entry
|
last_scan_log_entry
|
||||||
end
|
end
|
||||||
|
|
||||||
|
sig { override.returns(Integer) }
|
||||||
|
def num_post_files_for_view
|
||||||
|
# TODO - this might not be correct, but sofurry is still down
|
||||||
|
1
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
<div
|
<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"
|
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">
|
<div class="flex justify-between p-2">
|
||||||
<%= render "domain/posts/inline_postable_domain_link", post: post %>
|
<%= render "domain/posts/inline_postable_domain_link", post: post %>
|
||||||
</div>
|
</div>
|
||||||
<div class="flex flex-grow items-center justify-center p-2">
|
<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)) %>
|
<% if (thumbnail_file = gallery_file_for_post(post)) && (thumbnail_path = thumbnail_for_post_path(post)) %>
|
||||||
<%= link_to domain_post_path(post) do %>
|
<%= link_to domain_post_path(post) do %>
|
||||||
<%= image_tag thumbnail_path,
|
<%= image_tag thumbnail_path,
|
||||||
@@ -26,6 +26,12 @@
|
|||||||
<% else %>
|
<% else %>
|
||||||
<span class="text-sm text-slate-500 italic">No file available</span>
|
<span class="text-sm text-slate-500 italic">No file available</span>
|
||||||
<% end %>
|
<% 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>
|
||||||
<div>
|
<div>
|
||||||
<h2 class="p-1 pb-0 text-center text-md">
|
<h2 class="p-1 pb-0 text-center text-md">
|
||||||
|
|||||||
Reference in New Issue
Block a user