Mercurial > hg > soundsoftware-site
diff app/controllers/.svn/text-base/users_controller.rb.svn-base @ 441:cbce1fd3b1b7 redmine-1.2
Update to Redmine 1.2-stable branch (Redmine SVN rev 6000)
author | Chris Cannam |
---|---|
date | Mon, 06 Jun 2011 14:24:13 +0100 |
parents | 07fa8a8b56a8 |
children | 0c939c159af4 |
line wrap: on
line diff
--- a/app/controllers/.svn/text-base/users_controller.rb.svn-base Thu Mar 03 11:42:28 2011 +0000 +++ b/app/controllers/.svn/text-base/users_controller.rb.svn-base Mon Jun 06 14:24:13 2011 +0100 @@ -1,5 +1,5 @@ # Redmine - project management software -# Copyright (C) 2006-2010 Jean-Philippe Lang +# Copyright (C) 2006-2011 Jean-Philippe Lang # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License @@ -38,6 +38,9 @@ @limit = per_page_option end + scope = User + scope = scope.in_group(params[:group_id].to_i) if params[:group_id].present? + @status = params[:status] ? params[:status].to_i : 1 c = ARCondition.new(@status == 0 ? "status <> 0" : ["status = ?", @status]) @@ -46,24 +49,27 @@ c << ["LOWER(login) LIKE ? OR LOWER(firstname) LIKE ? OR LOWER(lastname) LIKE ? OR LOWER(mail) LIKE ?", name, name, name, name] end - @user_count = User.count(:conditions => c.conditions) + @user_count = scope.count(:conditions => c.conditions) @user_pages = Paginator.new self, @user_count, @limit, params['page'] @offset ||= @user_pages.current.offset - @users = User.find :all, + @users = scope.find :all, :order => sort_clause, :conditions => c.conditions, :limit => @limit, :offset => @offset - respond_to do |format| - format.html { render :layout => !request.xhr? } + respond_to do |format| + format.html { + @groups = Group.all.sort + render :layout => !request.xhr? + } format.api - end + end end def show # show projects based on current user visibility - @memberships = @user.memberships.all(:conditions => Project.visible_by(User.current)) + @memberships = @user.memberships.all(:conditions => Project.visible_condition(User.current)) events = Redmine::Activity::Fetcher.new(User.current, :author => @user).events(nil, nil, :limit => 10) @events_by_day = events.group_by(&:event_date)