Files
danbooru/app/components/post_preview_component/post_preview_component.html.erb
evazion eda23c719a votes: fixup various minor issues.
* Add a gap between thumbnails on mobile.
* Adjust CSS for scores and vote buttons.
* Include "Private favorites" as an incentive on the user upgrade page.
* Fix vote buttons not being visible beneath thumbnails on mobile.
* Fix the "Show scores" link not preserving the current page number.
* Fix vote buttons being unintentionally enabled for all thumbnails by default.
* Fix banned and restricted users being able to favorite posts by
  tagging them with `fav:self`.
* Fix search engines being able to crawl /posts?view=score pages.
* Fix broken tests.
2021-11-20 02:40:18 -06:00

63 lines
2.4 KiB
Plaintext

<%= tag.article id: "post_#{post.id}", **article_attrs do -%>
<%= link_to polymorphic_path(link_target, q: tags) do -%>
<% if is_animated? || has_sound? %>
<div class="post-animation-icon absolute top-0.5 left-0.5 p-0.5 m-0.5 leading-none rounded text-xs font-arial font-bold">
<% if is_animated? %>
<span class="post-duration align-middle">
<%= duration_to_hhmmss(duration) %>
</span>
<% end %>
<% if has_sound? %>
<%= sound_icon(class: "h-3 mx-0.5") -%>
<% end %>
</div>
<% end %>
<%= tag.picture do -%>
<%= tag.source media: "(max-width: 660px)", srcset: cropped_url -%>
<%= tag.source media: "(min-width: 660px)", srcset: post.preview_file_url -%>
<%= tag.img class: "has-cropped-#{post.has_cropped?}", src: post.preview_file_url, style: "min-width: #{preview_dimensions[:width]}px; min-height: #{preview_dimensions[:height]}px;", title: tooltip, alt: "post ##{post.id}", crossorigin: "anonymous" -%>
<% end -%>
<% end -%>
<% if pool -%>
<p class="desc">
<%= link_to pool.pretty_name.truncate(80), pool %>
</p>
<% elsif similarity -%>
<p class="desc">
<% if post.source =~ %r!\Ahttps?://!i %>
<%= external_link_to post.normalized_source, post.source_domain %>
(<%= time_ago_in_words_tagged(post.created_at, compact: true) %>)
<% else %>
<%= time_ago_in_words_tagged(post.created_at, compact: true) %>
<% end %>
</p>
<p class="desc">
<%= link_to number_to_human_size(size), post.file_url %>
(<%= post.image_width %>x<%= post.image_height %>)
</p>
<p class="desc">
<%= link_to "#{similarity}%", iqdb_queries_path(post_id: post.id) %> similarity
</p>
<% elsif size -%>
<p class="desc">
<%= link_to number_to_human_size(size), post.file_url %>
(<%= post.image_width %>x<%= post.image_height %>)
</p>
<% elsif recommended -%>
<p class="desc recommended">
<%= link_to recommended_posts_path(search: { post_id: post.id }), class: "more-recommended-posts", "data-post-id": post.id do %>
<%= post.fav_count %>
<%= empty_heart_icon(class: "fa-xs") %>
<br>more »
<% end %>
</p>
<% elsif show_votes -%>
<div class="post-preview-score text-sm mt-1">
<%= render_post_votes post, current_user: current_user %>
</div>
<% end -%>
<% end -%>