diff --git a/app/assets/javascripts/posts.js b/app/assets/javascripts/posts.js index e9d258ba8..69040e109 100644 --- a/app/assets/javascripts/posts.js +++ b/app/assets/javascripts/posts.js @@ -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(); }); } diff --git a/app/views/iqdb_queries/create_by_post.html.erb b/app/views/iqdb_queries/create_by_post.html.erb deleted file mode 100644 index f66fb5b58..000000000 --- a/app/views/iqdb_queries/create_by_post.html.erb +++ /dev/null @@ -1,9 +0,0 @@ -<% if @results.any? %> -

Similar

- <% @results.each do |match| %> - <%= PostPresenter.preview(Post.find(match.post_id)) %> - <% end %> -<% else %> -

Similar

-

No matches found

-<% end %> diff --git a/app/views/iqdb_queries/create_by_post.js.erb b/app/views/iqdb_queries/create_by_post.js.erb new file mode 100644 index 000000000..01a1dd2e2 --- /dev/null +++ b/app/views/iqdb_queries/create_by_post.js.erb @@ -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 += '

No matches found

'; +<% end %> + +$("
").html(html).dialog({title: "Similar Posts", modal: true, width: "600px"}); diff --git a/app/views/posts/partials/show/_edit.html.erb b/app/views/posts/partials/show/_edit.html.erb index 59386e619..906cfe82b 100644 --- a/app/views/posts/partials/show/_edit.html.erb +++ b/app/views/posts/partials/show/_edit.html.erb @@ -62,6 +62,10 @@ <%= button_tag "Artist", :id => "find-artist-button", :type => "button" %> + <% if Danbooru.config.iqdb_hostname_and_port %> + + <% end %> +
<%= f.label :tag_string, "Tags" %>