Files
danbooru/app/views/posts/partials/index/_preview.html.erb
evazion 5791f4e805 recommendations: show favcount beneath recommended posts.
* Add favorite count beneath recommended posts. Clicking the favcount
  loads more recommended posts like that post.
* Increase number of recommendations shown on post show page.
2019-12-02 03:08:01 -06:00

52 lines
1.7 KiB
Plaintext

<%= content_tag(:article, article_attrs) do -%>
<%= link_to polymorphic_path(link_target, link_params) do -%>
<%= content_tag(:picture) do -%>
<%= tag.source media: "(max-width: 660px)", srcset: cropped_url -%>
<%= tag.source media: "(min-width: 660px)", srcset: preview_url -%>
<%= tag.img class: "has-cropped-#{has_cropped}", src: preview_url, style: "min-width: #{preview_width}px; min-height: #{preview_height}px;", title: tooltip, alt: alt_text -%>
<% end -%>
<% end -%>
<% if pool -%>
<p class="desc">
<%= link_to pool.pretty_name.truncate(80), pool %>
</p>
<% end -%>
<% if 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>
<% end %>
<% if size -%>
<p class="desc">
<%= link_to number_to_human_size(size), post.file_url %>
(<%= width %>x<%= height %>)
</p>
<% end -%>
<% if similarity -%>
<p class="desc">
<%= link_to "#{similarity}%", iqdb_queries_path(post_id: post.id) %> similarity
</p>
<% end -%>
<% if 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 %>
<% if post.favorited_by?(CurrentUser.id) %>
<i class="fas fa-heart fa-xs"></i>
<% else %>
<i class="far fa-heart fa-xs"></i>
<% end %>
<br>more »
<% end %>
</p>
<% end -%>
<% end -%>