iqdb: add more info to iqdb thumbnails.
* Add the source (twitter, pixiv, etc) and upload date ("X minutes ago")
to iqdb thumbnails.
* Link the filesize to the full file so you can compare files in new tabs.
* Link the similarity to a iqdb search so you can pivot your search to other posts.
This commit is contained in:
@@ -67,7 +67,7 @@ module ApplicationHelper
|
|||||||
def time_ago_in_words_tagged(time, compact: false)
|
def time_ago_in_words_tagged(time, compact: false)
|
||||||
if time.past?
|
if time.past?
|
||||||
text = time_ago_in_words(time) + " ago"
|
text = time_ago_in_words(time) + " ago"
|
||||||
text = text.gsub(/almost|about|over/, "") if compact
|
text = text.gsub(/almost|about|over/, "").strip if compact
|
||||||
raw time_tag(text, time)
|
raw time_tag(text, time)
|
||||||
else
|
else
|
||||||
raw time_tag("in " + distance_of_time_in_words(Time.now, time), time)
|
raw time_tag("in " + distance_of_time_in_words(Time.now, time), time)
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ class PostPresenter < Presenter
|
|||||||
end
|
end
|
||||||
|
|
||||||
locals = {}
|
locals = {}
|
||||||
|
locals[:post] = post
|
||||||
|
|
||||||
locals[:article_attrs] = {
|
locals[:article_attrs] = {
|
||||||
"id" => "post_#{post.id}",
|
"id" => "post_#{post.id}",
|
||||||
@@ -74,7 +75,7 @@ class PostPresenter < Presenter
|
|||||||
end
|
end
|
||||||
|
|
||||||
if options[:similarity]
|
if options[:similarity]
|
||||||
locals[:similarity] = options[:similarity].round
|
locals[:similarity] = options[:similarity].round(1)
|
||||||
else
|
else
|
||||||
locals[:similarity] = nil
|
locals[:similarity] = nil
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -13,12 +13,23 @@
|
|||||||
<% end -%>
|
<% end -%>
|
||||||
<% if similarity -%>
|
<% if similarity -%>
|
||||||
<p class="desc">
|
<p class="desc">
|
||||||
Similarity: <%= similarity %>
|
<% 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>
|
||||||
<% end -%>
|
<% end %>
|
||||||
<% if size -%>
|
<% if size -%>
|
||||||
<p class="desc">
|
<p class="desc">
|
||||||
<%= number_to_human_size(size) %> (<%= width %>x<%= height %>)
|
<%= 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>
|
</p>
|
||||||
<% end -%>
|
<% end -%>
|
||||||
<% end -%>
|
<% end -%>
|
||||||
|
|||||||
Reference in New Issue
Block a user