1
0
Fork 0
forked from OpenNeo/impress

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 class UsersController < ApplicationController
before_filter :find_and_authorize_user!, :only => [:update] 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 def top_contributors
@users = User.top_contributors.paginate :page => params[:page], :per_page => 20 @users = User.top_contributors.paginate :page => params[:page], :per_page => 20
end end

View file

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

View file

@ -37,6 +37,9 @@
%p %p
Make lists of the items you own and want, and share them with the Make lists of the items you own and want, and share them with the
world. world.
= form_tag users_path, :method => 'get' do
= text_field_tag 'name', '', :placeholder => raw('find a user&hellip;'), :type => 'search'
= submit_tag 'search'
%li %li
%a{:href => items_path} %a{:href => items_path}
@ -49,7 +52,7 @@
%p %p
Take a look through our wearables database! Take a look through our wearables database!
= form_tag items_path, :method => 'get' do = 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' = submit_tag 'search'
%li#blog-preview %li#blog-preview
%a{:href => "http://blog.openneo.net"} %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 '/logout' => 'sessions#destroy', :as => :logout
match '/users/authorize' => 'sessions#create' 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 :contributions, :only => [:index]
resources :closet_hangers, :only => [:index], :path => 'closet' do resources :closet_hangers, :only => [:index], :path => 'closet' do
collection do collection do

View file

@ -3598,10 +3598,14 @@ body.outfits-new #sections img:hover {
-khtml-opacity: 1; -khtml-opacity: 1;
} }
/* line 137, ../../../app/stylesheets/outfits/_new.sass */ /* 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 { body.outfits-new #read-more {
float: right; float: right;
} }
/* line 142, ../../../app/stylesheets/outfits/_new.sass */ /* line 144, ../../../app/stylesheets/outfits/_new.sass */
body.outfits-new #your-items-module h3:after { body.outfits-new #your-items-module h3:after {
color: red; color: red;
content: "new!"; content: "new!";