if you search for a hash (with a '#') it will just take you to that hash page
This commit is contained in:
parent
f4c482cdb3
commit
93f7f28b07
2 changed files with 11 additions and 0 deletions
|
|
@ -11,6 +11,12 @@ 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] == '#'
|
||||||
|
redirect_to "/p/?tag=#{params[:q].gsub("#", "")}"
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
limit = params[:limit] || 15
|
limit = params[:limit] || 15
|
||||||
|
|
||||||
@people = Person.search(params[:q], current_user).paginate :page => params[:page], :per_page => limit
|
@people = Person.search(params[:q], current_user).paginate :page => params[:page], :per_page => limit
|
||||||
|
|
|
||||||
|
|
@ -50,6 +50,11 @@ describe PeopleController do
|
||||||
get :index, :q => "Korthsauce"
|
get :index, :q => "Korthsauce"
|
||||||
response.should_not be_redirect
|
response.should_not be_redirect
|
||||||
end
|
end
|
||||||
|
|
||||||
|
it 'goes to a tag page if you search for a hash' do
|
||||||
|
get :index, :q => '#babies'
|
||||||
|
response.should redirect_to('/p/?tag=babies')
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
describe "#show performance", :performance => true do
|
describe "#show performance", :performance => true do
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue