From 7569f58c656fd2c274e49da6f366b9ef7138e961 Mon Sep 17 00:00:00 2001 From: elijah Date: Thu, 4 Jul 2013 01:34:06 -0700 Subject: users - make a nice overview page (well, nice enough) and better users index/search. --- users/app/controllers/users_controller.rb | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) (limited to 'users/app/controllers') diff --git a/users/app/controllers/users_controller.rb b/users/app/controllers/users_controller.rb index 09622b3..98294b9 100644 --- a/users/app/controllers/users_controller.rb +++ b/users/app/controllers/users_controller.rb @@ -3,22 +3,24 @@ # class UsersController < UsersBaseController - before_filter :authorize, :only => [:show, :edit, :update, :destroy] before_filter :fetch_user, :only => [:show, :edit, :update, :destroy] - #before_filter :authorize_self, :only => [:update] before_filter :authorize_admin, :only => [:index] - respond_to :json + respond_to :html def index if params[:query] - @users = User.by_login.startkey(params[:query]).endkey(params[:query].succ) + if @user = User.find_by_login(params[:query]) + redirect_to user_overview_url(@user) + return + else + @users = User.by_login.startkey(params[:query]).endkey(params[:query].succ) + end else @users = User.by_created_at.descending end - @users = @users.limit(APP_CONFIG[:pagination_size]) - #respond_with @users.map(&:login).sort + @users = @users.limit(100) end def new @@ -52,11 +54,4 @@ class UsersController < UsersBaseController end end - protected - - #def authorize_self - # # have already checked that authorized - # access_denied unless (@user == current_user) - #end - end -- cgit v1.2.3