more UI for showing fa posts
This commit is contained in:
@@ -1,20 +1,51 @@
|
||||
<div class='mx-auto'>
|
||||
<div class='mx-auto mt-4 sm:mt-6 text-center'>
|
||||
<% if @user %>
|
||||
<h1 class='text-2xl'><%= link_to(@user.name, @user, class: "underline") %>'s posts</h1>
|
||||
<h1 class='text-2xl'><%= link_to(@user.name, @user, class: "underline") %>'s posts (page <%= page_str(params) || 1 %>)</h1>
|
||||
<% else %>
|
||||
<h1 class='text-2xl'>All FurAffinity posts, page <%= page_str(params) %></h1>
|
||||
<h1 class='text-2xl'>All FurAffinity posts, page <%= page_str(params) || 1 %></h1>
|
||||
<% end %>
|
||||
</div>
|
||||
<% # link_to "Previous page", path_to_prev_page(@posts) %>
|
||||
<% # link_to "Next page", path_to_next_page(@posts) %>
|
||||
<div class='flex-row'>
|
||||
<div class='mx-auto w-full border-2 border-slate-300 sm:max-w-md rounded-md mt-4 sm:mt-6 mb-4 sm:mb-6'>
|
||||
<div class='flex justify-center items-stretch h-full'>
|
||||
<%= link_to "Previous page", path_to_prev_page(@posts), class: 'hover:underline hover:bg-slate-200 hover:shadow-sm px-6 py-2 text-center border-slate-300 border-r-2 bg-slate-100 flex-1 flex items-center justify-center' %>
|
||||
<%= link_to "Next page", path_to_next_page(@posts), class: 'hover:underline hover:bg-slate-200 hover:shadow-sm px-6 py-2 text-center bg-slate-100 flex-1 flex items-center justify-center' %>
|
||||
</div>
|
||||
</div>
|
||||
<div class='flex flex-row flex-wrap'>
|
||||
<% @posts.each do |post| %>
|
||||
<div class=''>
|
||||
<% if post.file %>
|
||||
<img class='' alt='<%= post.title %>' src='<%= contents_log_entry_path(post.file, thumb: "small") %>' />
|
||||
<% else %>
|
||||
<span>No file for <%= post.fa_id %></span>
|
||||
<% end %>
|
||||
<div class='border border-gray-300 rounded flex-shrink-0 bg-slate-50 m-4 flex flex-col'>
|
||||
<div class='p-4 flex items-center justify-center flex-1'>
|
||||
<% if post.file %>
|
||||
<%= link_to domain_fa_post_path(post.fa_id) do %>
|
||||
<img class='max-w-[300px] max-h-[300px] object-contain border border-gray-300 shadow-md' alt='<%= post.title %>' src='<%= contents_blob_path(HexUtil.bin2hex(post.file.response_sha256), format: "jpg", thumb: "small") %>' />
|
||||
<% end %>
|
||||
<% else %>
|
||||
<span>No file for <%= post.fa_id %></span>
|
||||
<% end %>
|
||||
</div>
|
||||
<div class='border-t border-gray-300'>
|
||||
<h2 class='text-lg p-4 text-center'>
|
||||
<%= link_to post.title, domain_fa_post_path(post.fa_id), class: "hover:underline" %>
|
||||
</h2>
|
||||
<div class='px-4 pb-4 text-sm text-gray-600'>
|
||||
<div class='flex justify-between items-start'>
|
||||
<div>
|
||||
<% if post.posted_at %>
|
||||
Posted <%= post.posted_at.strftime("%Y-%m-%d") %>
|
||||
<div class="text-gray-500">
|
||||
(<%= time_ago_in_words(post.posted_at) %> ago)
|
||||
</div>
|
||||
<% else %>
|
||||
Posted date unknown
|
||||
<% end %>
|
||||
</div>
|
||||
<%= link_to "https://www.furaffinity.net/view/#{post.fa_id}", target: "_blank", rel: "noopener", class: "inline-flex items-center text-gray-500 hover:text-gray-700 ml-8" do %>
|
||||
<span>FA #<%= post.fa_id %></span>
|
||||
<%= render partial: "shared/icons/external_link", locals: { class_name: "w-4 h-4 ml-1" } %>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<section class='border-2 border-slate-300 rounded-md mb-2'>
|
||||
<div class='border-b-2 border-b-slate-300 text-slate-600 p-1 italic flex'>
|
||||
<span class='text-lg grow'>
|
||||
Recent Posts <span class='text-sm'>(<%= user.posts.count %> total)</span>
|
||||
Recent Posts <span class='text-sm'>(<%= link_to "#{user.posts.count} total", domain_fa_user_posts_path(user), class: "underline" %>)</span>
|
||||
</span>
|
||||
<span class='text-sm self-center'>Posted at</span>
|
||||
</div>
|
||||
@@ -22,7 +22,7 @@
|
||||
post.title,
|
||||
domain_fa_post_path(post.fa_id),
|
||||
post_link_opts
|
||||
) %> -
|
||||
) %> -
|
||||
<%= link_to(fa_post_link, fa_post_link_opts) do %>
|
||||
<% image_tag(
|
||||
image_path("arrow-top-right-on-square.svg"),
|
||||
|
||||
@@ -10,9 +10,9 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<a
|
||||
href="https://www.furaffinity.net/user/<%= user.url_name %>/"
|
||||
target="_blank" rel='noopener noreferrer'
|
||||
<a
|
||||
href="https://www.furaffinity.net/user/<%= user.url_name %>/"
|
||||
target="_blank" rel='noopener noreferrer'
|
||||
class="underline decoration-dashed text-slate-600 self-center"
|
||||
>
|
||||
FurAffinity <img src="<%= image_path("fa-logo.png") %>" class='w-5 inline' />
|
||||
@@ -35,6 +35,14 @@
|
||||
<span class="grow">Followed by</span>
|
||||
<span><%= number_with_delimiter(user.followed_joins.count, delimiter: ",") %></span>
|
||||
</div>
|
||||
<div class='flex'>
|
||||
<span class="grow">Gallery scanned</span>
|
||||
<span><%= user.time_ago_for_gallery_scan %></span>
|
||||
</div>
|
||||
<div class='flex'>
|
||||
<span class="grow">Page scanned</span>
|
||||
<span><%= user.time_ago_for_page_scan %></span>
|
||||
</div>
|
||||
</section>
|
||||
<%= render "recent_posts_section", user: user %>
|
||||
<section class='border-2 border-slate-300 rounded-md mb-2 overflow-clip'>
|
||||
|
||||
@@ -5,27 +5,27 @@
|
||||
<h1 class='text-2xl'>Inkbunny Posts (<%= @posts.total_count %>), page <%= page_str(params) %></h1>
|
||||
<% end %>
|
||||
</div>
|
||||
<div class='mx-auto w-full p-2 sm:p-2 sm:border-2 sm:border-slate-100 sm:max-w-md rounded-xl mt-4 sm:mt-6 mb-4 sm:mb-6'>
|
||||
<div class='flex justify-center items-center'>
|
||||
<%= link_to "Previous page", path_to_prev_page(@posts), class: 'hover:underline px-6 py-2 text-center border-slate-100 border-r-2' %>
|
||||
<%= link_to "Next page", path_to_next_page(@posts), class: 'hover:underline px-6 py-2 text-center' %>
|
||||
<div class='mx-auto w-full border-2 border-slate-300 sm:max-w-md rounded-md mt-4 sm:mt-6 mb-4 sm:mb-6'>
|
||||
<div class='flex justify-center items-stretch h-full'>
|
||||
<%= link_to "Previous page", path_to_prev_page(@posts), class: 'hover:underline hover:bg-slate-200 hover:shadow-sm px-6 py-2 text-center border-slate-300 border-r-2 bg-slate-100 flex-1 flex items-center justify-center' %>
|
||||
<%= link_to "Next page", path_to_next_page(@posts), class: 'hover:underline hover:bg-slate-200 hover:shadow-sm px-6 py-2 text-center bg-slate-100 flex-1 flex items-center justify-center' %>
|
||||
</div>
|
||||
</div>
|
||||
<div class='flex-row mx-2'>
|
||||
<% @posts.each do |post| %>
|
||||
<div class='border-stone-200 border-2 rounded-md mb-4 p-2'>
|
||||
<div class='text-stone-800 mb-2 flex justify-between'>
|
||||
<div class='mx-auto border-slate-300 border-2 rounded-md mb-4 p-2 bg-slate-100 max-w-6xl'>
|
||||
<div class='text-slate-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>
|
||||
<span class="text-slate-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 class='text-slate-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 %>' />
|
||||
<img class='my-2 first:pl-0 last:pr-0 h-32 border-2 border-slate-400 shadow-md rounded-md' alt='<%= post.title %>' src='<%= img_src_path %>' />
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
@@ -29,8 +29,8 @@ namespace :ib do
|
||||
puts "auth credentials set to #{username} / #{password}"
|
||||
end
|
||||
|
||||
desc "enqueue FileJob for missing files"
|
||||
task enqueue_file_jobs: :environment do
|
||||
desc "Perform FileJob for missing files"
|
||||
task perform_file_jobs: :environment do
|
||||
Domain::Inkbunny::File
|
||||
.where(state: :ok)
|
||||
.where(blob_entry_sha256: nil)
|
||||
|
||||
Reference in New Issue
Block a user