refactor iqdb endpoints

This commit is contained in:
r888888888
2018-06-23 10:32:39 -07:00
parent 27baa08e59
commit 3ba5c6fb51
11 changed files with 93 additions and 53 deletions

View File

@@ -0,0 +1,9 @@
<% if @matches.present? %>
<h3>Similar</h3>
<% @matches.each do |match| %>
<%= PostPresenter.preview(match["post"], :tags => "status:any", :similarity => match["score"], :size => true) %>
<% end %>
<% else %>
<h3>Similar</h3>
<p>No matches found</p>
<% end %>

View File

@@ -1,9 +0,0 @@
<% if @results.any? %>
<h3>Similar</h3>
<% @results.each do |match| %>
<%= PostPresenter.preview(Post.find(match["post_id"]), :tags => "status:any", :similarity => match["score"], :size => true) %>
<% end %>
<% else %>
<h3>Similar</h3>
<p>No matches found</p>
<% end %>

View File

@@ -0,0 +1 @@
<%= render "iqdb_queries/matches" %>

View File

@@ -21,18 +21,7 @@
<% end %>
</section>
<% if @matches %>
<section>
<h2>Similar results</h2>
<% if @matches.any? %>
<% @matches.each do |post, score| %>
<%= PostPresenter.preview(post, :tags => "status:any", :size => true, :similarity => score) %>
<% end %>
<% else %>
<p>No matches found</p>
<% end %>
</section>
<% end %>
<%= render "iqdb_queries/matches" %>
</div>
</div>

View File

@@ -1,3 +0,0 @@
<% if @matches %>
<%= raw @matches.to_json %>
<% end %>

View File

@@ -16,7 +16,7 @@
<% end %>
<li id="add-artist-commentary-list"><%= link_to "Add commentary", "#", :id => "add-commentary" %></li>
<li><%= link_to "Add to favorite group", "#", :id => "open-favgroup-dialog-link" %></li>
<li><%= link_to "Find similar", iqdb_queries_path(:post_id => post.id), :method => :post, :remote => true %></li>
<li><%= link_to "Find similar", iqdb_queries_path(:post_id => post.id) %></li>
<% if post.is_status_locked? %>
<li><span id="status-locked-notice">Status locked</span></li>