add xhr variant detection
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
class IqdbQueriesController < ApplicationController
|
||||
respond_to :html, :json
|
||||
before_action :detect_xhr
|
||||
|
||||
def show
|
||||
if params[:url]
|
||||
@@ -15,10 +16,8 @@ class IqdbQueriesController < ApplicationController
|
||||
end
|
||||
|
||||
respond_with(@matches) do |fmt|
|
||||
fmt.html
|
||||
|
||||
fmt.html.xhr do
|
||||
render layout: false
|
||||
fmt.html do |html|
|
||||
html.xhr { render layout: false}
|
||||
end
|
||||
|
||||
fmt.json do
|
||||
@@ -26,4 +25,12 @@ class IqdbQueriesController < ApplicationController
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def detect_xhr
|
||||
if request.xhr?
|
||||
request.variant = :xhr
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user