better UI for document gallery items
This commit is contained in:
@@ -473,6 +473,12 @@ module Domain::PostsHelper
|
||||
post.keywords.map(&:strip).reject(&:blank?).compact
|
||||
end
|
||||
|
||||
sig { params(time: T.nilable(ActiveSupport::TimeWithZone)).returns(String) }
|
||||
def time_ago_in_words_no_prefix(time)
|
||||
return "never" if time.nil?
|
||||
time_ago_in_words(time).delete_prefix("over ").delete_prefix("about ")
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
sig { params(url: String).returns(T.nilable(String)) }
|
||||
|
||||
@@ -4,24 +4,25 @@
|
||||
<div class="flex justify-between border-b border-slate-300 p-4">
|
||||
<%= render "domain/posts/inline_postable_domain_link", post: post %>
|
||||
</div>
|
||||
<% if thumbnail_path = thumbnail_for_post_path(post) %>
|
||||
<div class="flex items-center justify-center p-4 border-b border-slate-300">
|
||||
<% if thumbnail_file = gallery_file_for_post(post) %>
|
||||
<%= link_to domain_post_path(post) do %>
|
||||
<%= image_tag thumbnail_path,
|
||||
<div class="flex items-center justify-center p-4 border-b border-slate-300">
|
||||
<% 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-[300px] max-w-[300px] 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) %>
|
||||
<span class="text-sm text-slate-500 italic"><%= file_info %>, <%= gallery_file_size_for_post(post) %></span>
|
||||
<% else %>
|
||||
<span class="text-sm text-slate-500 italic">No file available</span>
|
||||
<% end %>
|
||||
</div>
|
||||
<% end %>
|
||||
<% elsif file_info = gallery_file_info_for_post(post) %>
|
||||
<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>
|
||||
<% else %>
|
||||
<span class="text-sm text-slate-500 italic">No file available</span>
|
||||
<% end %>
|
||||
</div>
|
||||
<div class="">
|
||||
<h2 class="p-4 text-center text-lg">
|
||||
<h2 class="p-2 text-center text-lg">
|
||||
<%= link_to title_for_post_model(post), domain_post_path(post), class: "blue-link" %>
|
||||
</h2>
|
||||
<div class="px-4 pb-4 text-sm text-slate-500">
|
||||
@@ -38,7 +39,7 @@
|
||||
<% end %>
|
||||
<span class="flex-grow text-right">
|
||||
<% if post.posted_at %>
|
||||
Posted <%= time_ago_in_words(post.posted_at) %> ago
|
||||
<%= time_ago_in_words_no_prefix(post.posted_at) %> ago
|
||||
<% end %>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
@@ -331,10 +331,10 @@ namespace :fa do
|
||||
query.find_each do |post_file|
|
||||
next if post_file.url_str.include?("/stories/")
|
||||
Job::FaPostFurArchiverPostFileJob.perform_now({ post_file: })
|
||||
pb.progress = [pb.progress + 1, total].min
|
||||
post = post_file.post
|
||||
puts "processed #{post.to_param} / #{post.title_for_view}".bold
|
||||
counter += 1
|
||||
pb.progress = [pb.progress + 1, total].min
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user