diff options
author | elijah <elijah@riseup.net> | 2013-07-04 01:34:06 -0700 |
---|---|---|
committer | elijah <elijah@riseup.net> | 2013-07-04 01:34:06 -0700 |
commit | 7569f58c656fd2c274e49da6f366b9ef7138e961 (patch) | |
tree | 8d503b4d16ff4f9d14028228acccb5d23a104ba3 /users/app/controllers | |
parent | 738a6c5576992e665821c76ad720a58edd228b28 (diff) |
users - make a nice overview page (well, nice enough) and better users index/search.
Diffstat (limited to 'users/app/controllers')
-rw-r--r-- | users/app/controllers/users_controller.rb | 21 |
1 files changed, 8 insertions, 13 deletions
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 |