Mercurial > hg > soundsoftware-site
diff app/controllers/users_controller.rb @ 1298:4f746d8966dd redmine_2.3_integration
Merge from redmine-2.3 branch to create new branch redmine-2.3-integration
author | Chris Cannam |
---|---|
date | Fri, 14 Jun 2013 09:28:30 +0100 |
parents | 96790506f247 622f24f53b42 |
children |
line wrap: on
line diff
--- a/app/controllers/users_controller.rb Fri Jun 14 09:07:32 2013 +0100 +++ b/app/controllers/users_controller.rb Fri Jun 14 09:28:30 2013 +0100 @@ -1,5 +1,5 @@ # Redmine - project management software -# Copyright (C) 2006-2012 Jean-Philippe Lang +# Copyright (C) 2006-2013 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 @@ -45,12 +45,9 @@ scope = scope.in_group(params[:group_id]) if params[:group_id].present? @user_count = scope.count - @user_pages = Paginator.new self, @user_count, @limit, params['page'] - @offset ||= @user_pages.current.offset - @users = scope.find :all, - :order => sort_clause, - :limit => @limit, - :offset => @offset + @user_pages = Paginator.new @user_count, @limit, params['page'] + @offset ||= @user_pages.offset + @users = scope.order(sort_clause).limit(@limit).offset(@offset).all respond_to do |format| format.html { @@ -58,7 +55,7 @@ render :layout => !request.xhr? } format.api - end + end end def show @@ -89,7 +86,7 @@ def new @user = User.new(:language => Setting.default_language, :mail_notification => Setting.default_notification_option) - @auth_sources = AuthSource.find(:all) + @auth_sources = AuthSource.all @ssamr_user_details = SsamrUserDetail.new end @@ -124,15 +121,16 @@ respond_to do |format| format.html { flash[:notice] = l(:notice_user_successful_create, :id => view_context.link_to(@user.login, user_path(@user))) - redirect_to(params[:continue] ? - {:controller => 'users', :action => 'new'} : - {:controller => 'users', :action => 'edit', :id => @user} - ) + if params[:continue] + redirect_to new_user_path + else + redirect_to edit_user_path(@user) + end } format.api { render :action => 'show', :status => :created, :location => user_url(@user) } end else - @auth_sources = AuthSource.find(:all) + @auth_sources = AuthSource.all # Clear password input @user.password = @user.password_confirmation = nil @@ -144,7 +142,7 @@ end def edit - + @auth_sources = AuthSource.all @ssamr_user_details = @user.ssamr_user_detail if @user.ssamr_user_detail == nil @@ -153,7 +151,6 @@ @selected_institution_id = @user.ssamr_user_detail.institution_id.to_i end - @auth_sources = AuthSource.find(:all) @membership ||= Member.new end @@ -208,7 +205,7 @@ format.api { render_api_ok } end else - @auth_sources = AuthSource.find(:all) + @auth_sources = AuthSource.all @membership ||= Member.new # Clear password input @user.password = @user.password_confirmation = nil @@ -223,7 +220,7 @@ def destroy @user.destroy respond_to do |format| - format.html { redirect_back_or_default(users_url) } + format.html { redirect_back_or_default(users_path) } format.api { render_api_ok } end end @@ -232,7 +229,7 @@ @membership = Member.edit_membership(params[:membership_id], params[:membership], @user) @membership.save respond_to do |format| - format.html { redirect_to :controller => 'users', :action => 'edit', :id => @user, :tab => 'memberships' } + format.html { redirect_to edit_user_path(@user, :tab => 'memberships') } format.js end end @@ -243,7 +240,7 @@ @membership.destroy end respond_to do |format| - format.html { redirect_to :controller => 'users', :action => 'edit', :id => @user, :tab => 'memberships' } + format.html { redirect_to edit_user_path(@user, :tab => 'memberships') } format.js end end