iqdb: simplify ajax call.

Also add support for .xml responses to /iqdb_queries.
This commit is contained in:
evazion
2019-10-14 21:16:04 -05:00
parent ccf32aa7a4
commit ca54e2d67b
4 changed files with 4 additions and 21 deletions

View File

@@ -1,6 +1,5 @@
class IqdbQueriesController < ApplicationController
respond_to :html, :json
before_action :detect_xhr
respond_to :html, :json, :xml, :js
def show
if params[:url]
@@ -16,22 +15,6 @@ class IqdbQueriesController < ApplicationController
@matches = IqdbProxy.decorate_posts(JSON.parse(params[:matches]))
end
respond_with(@matches) do |fmt|
fmt.html do |html|
html.xhr { render layout: false}
end
fmt.json do
render json: @matches
end
end
end
private
def detect_xhr
if request.xhr?
request.variant = :xhr
end
respond_with(@matches)
end
end