Skip to content
Extraits de code Groupes Projets
Valider 93f7f28b rédigé par maxwell's avatar maxwell
Parcourir les fichiers

if you search for a hash (with a '#') it will just take you to that hash page

parent f4c482cd
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
...@@ -11,6 +11,12 @@ class PeopleController < ApplicationController ...@@ -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 ...@@ -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
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter