This commit is contained in:
r888888888
2014-05-21 18:02:06 -07:00
committed by Toks
parent b194935bde
commit 5f29ef5557
4 changed files with 16 additions and 23 deletions

View File

@@ -135,20 +135,8 @@
Danbooru.Post.initialize_similar = function() {
$("#similar-button").click(function(e) {
var old_source_name = $("#post_source").attr("name");
var old_action = $("#form").attr("action");
$("#post_source").attr("name", "url");
$("#form").attr("target", "_blank");
$("#form").attr("action", "http://danbooru.iqdb.org/");
$("#form").trigger("submit");
$("#post_source").attr("name", old_source_name);
$("#form").attr("target", "");
$("#form").attr("action", old_action);
e.preventDefault();
$.post("/iqdb_queries", {"url": $("#post_source").val()}).done(function(html) {$("#iqdb-similar").html(html).show()});
e.preventDefault();
});
}

View File

@@ -1,9 +0,0 @@
<% if @results.any? %>
<h3>Similar</h3>
<% @results.each do |match| %>
<%= PostPresenter.preview(Post.find(match.post_id)) %>
<% end %>
<% else %>
<h3>Similar</h3>
<p>No matches found</p>
<% end %>

View File

@@ -0,0 +1,10 @@
var html = '';
<% if @results.any? %>
<% @results.each do |match| %>
html += '<%= j PostPresenter.preview(Post.find(match.post_id)) %>';
<% end %>
<% else %>
html += '<p>No matches found</p>';
<% end %>
$("<div></div>").html(html).dialog({title: "Similar Posts", modal: true, width: "600px"});

View File

@@ -62,6 +62,10 @@
<%= button_tag "Artist", :id => "find-artist-button", :type => "button" %>
</div>
<% if Danbooru.config.iqdb_hostname_and_port %>
<div class="input" id="iqdb-similar" style="display: none;"></div>
<% end %>
<div class="input">
<div>
<%= f.label :tag_string, "Tags" %>