Fix infinite scroll on search... some kind of weird thing with rails responding with json even when request.format is html, with a mime type of html

This commit is contained in:
Raphael Sofaer 2011-08-13 09:59:17 -07:00
parent f60ce932b1
commit 3a18044821

View file

@ -30,7 +30,18 @@ class PeopleController < ApplicationController
render :json => @people
end
format.all do
format.html do
#only do it if it is an email address
if params[:q].try(:match, Devise.email_regexp)
people = Person.where(:diaspora_handle => params[:q])
webfinger(params[:q]) if people.empty?
else
people = Person.search(params[:q], current_user)
end
@people = people.paginate( :page => params[:page], :per_page => 15)
@hashes = hashes_for_people(@people, @aspects)
end
format.mobile do
#only do it if it is an email address
if params[:q].try(:match, Devise.email_regexp)
people = Person.where(:diaspora_handle => params[:q])