refactor iqdb endpoints
This commit is contained in:
9
app/views/iqdb_queries/_matches.html.erb
Normal file
9
app/views/iqdb_queries/_matches.html.erb
Normal 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 %>
|
||||
@@ -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 %>
|
||||
1
app/views/iqdb_queries/show+xhr.html.erb
Normal file
1
app/views/iqdb_queries/show+xhr.html.erb
Normal file
@@ -0,0 +1 @@
|
||||
<%= render "iqdb_queries/matches" %>
|
||||
@@ -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>
|
||||
|
||||
|
||||
@@ -1,3 +0,0 @@
|
||||
<% if @matches %>
|
||||
<%= raw @matches.to_json %>
|
||||
<% end %>
|
||||
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user