search by username

This commit is contained in:
Emi Matchu 2011-08-05 11:28:11 -04:00
parent f9de777c79
commit 4c510f91db
5 changed files with 23 additions and 3 deletions

View file

@ -1,6 +1,17 @@
class UsersController < ApplicationController
before_filter :find_and_authorize_user!, :only => [:update]
def index # search, really
name = params[:name]
@user = User.find_by_name(name)
if @user
redirect_to user_closet_hangers_path(@user)
else
flash[:alert] = "We don't have a user named \"#{name}\". Did you spell it correctly?"
redirect_to root_path
end
end
def top_contributors
@users = User.top_contributors.paginate :page => params[:page], :per_page => 20
end

View file

@ -134,6 +134,8 @@ body.outfits-new
margin-left: .5em
&:hover
+opacity(1)
p
min-height: 4.5em
#read-more
float: right

View file

@ -37,6 +37,9 @@
%p
Make lists of the items you own and want, and share them with the
world.
= form_tag users_path, :method => 'get' do
= text_field_tag 'name', '', :placeholder => raw('find a user&hellip;'), :type => 'search'
= submit_tag 'search'
%li
%a{:href => items_path}
@ -49,7 +52,7 @@
%p
Take a look through our wearables database!
= form_tag items_path, :method => 'get' do
= text_field_tag 'q', '', :placeholder => raw('search items&hellip;'), :type => 'search'
= text_field_tag 'q', '', :placeholder => raw('find an item&hellip;'), :type => 'search'
= submit_tag 'search'
%li#blog-preview
%a{:href => "http://blog.openneo.net"}

View file

@ -49,7 +49,7 @@ OpenneoImpressItems::Application.routes.draw do |map|
match '/logout' => 'sessions#destroy', :as => :logout
match '/users/authorize' => 'sessions#create'
resources :users, :path => 'user', :only => [:update] do
resources :users, :path => 'user', :only => [:index, :update] do
resources :contributions, :only => [:index]
resources :closet_hangers, :only => [:index], :path => 'closet' do
collection do

View file

@ -3598,10 +3598,14 @@ body.outfits-new #sections img:hover {
-khtml-opacity: 1;
}
/* line 137, ../../../app/stylesheets/outfits/_new.sass */
body.outfits-new #sections p {
min-height: 4.5em;
}
/* line 139, ../../../app/stylesheets/outfits/_new.sass */
body.outfits-new #read-more {
float: right;
}
/* line 142, ../../../app/stylesheets/outfits/_new.sass */
/* line 144, ../../../app/stylesheets/outfits/_new.sass */
body.outfits-new #your-items-module h3:after {
color: red;
content: "new!";