Don't will_paginate json requests on people search
This commit is contained in:
parent
e922ef8f22
commit
2d31d364f2
1 changed files with 16 additions and 8 deletions
|
|
@ -11,22 +11,30 @@ class PeopleController < ApplicationController
|
||||||
def index
|
def index
|
||||||
@aspect = :search
|
@aspect = :search
|
||||||
params[:q] ||= params[:term]
|
params[:q] ||= params[:term]
|
||||||
|
|
||||||
if (params[:q][0] == 35 || params[:q][0] == '#') && params[:q].length > 1
|
if (params[:q][0] == 35 || params[:q][0] == '#') && params[:q].length > 1
|
||||||
redirect_to "/tags/#{params[:q].gsub("#", "")}"
|
redirect_to "/tags/#{params[:q].gsub("#", "")}"
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
limit = params[:limit] || 15
|
limit = params[:limit] ? params[:limit].to_i : 15
|
||||||
|
|
||||||
@people = Person.search(params[:q], current_user).paginate :page => params[:page], :per_page => limit
|
respond_to do |format|
|
||||||
@hashes = hashes_for_people(@people, @aspects) unless request.format == :json
|
format.json do
|
||||||
|
@people = Person.search(params[:q], current_user).limit(limit)
|
||||||
|
render :json => @people
|
||||||
|
end
|
||||||
|
|
||||||
#only do it if it is an email address
|
format.html do
|
||||||
if params[:q].try(:match, Devise.email_regexp)
|
@people = Person.search(params[:q], current_user).paginate :page => params[:page], :per_page => limit
|
||||||
webfinger(params[:q])
|
@hashes = hashes_for_people(@people, @aspects)
|
||||||
|
|
||||||
|
#only do it if it is an email address
|
||||||
|
if params[:q].try(:match, Devise.email_regexp)
|
||||||
|
webfinger(params[:q])
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
respond_with @people
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def hashes_for_people people, aspects
|
def hashes_for_people people, aspects
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue