Refactor: Merged AuthSourcesController#list and #index

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@3436 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Eric Davis 2010-02-15 16:41:21 +00:00
parent 038a88e970
commit c5f30fde28
3 changed files with 7 additions and 12 deletions

View File

@ -20,18 +20,13 @@ class AuthSourcesController < ApplicationController
before_filter :require_admin
def index
list
render :action => 'list' unless request.xhr?
end
# GETs should be safe (see http://www.w3.org/2001/tag/doc/whenToUseGet.html)
verify :method => :post, :only => [ :destroy, :create, :update ],
:redirect_to => { :action => :list }
def list
def index
@auth_source_pages, @auth_sources = paginate :auth_sources, :per_page => 10
render :action => "list", :layout => false if request.xhr?
render :action => "index", :layout => false if request.xhr?
end
def new
@ -42,7 +37,7 @@ class AuthSourcesController < ApplicationController
@auth_source = AuthSourceLdap.new(params[:auth_source])
if @auth_source.save
flash[:notice] = l(:notice_successful_create)
redirect_to :action => 'list'
redirect_to :action => 'index'
else
render :action => 'new'
end
@ -56,7 +51,7 @@ class AuthSourcesController < ApplicationController
@auth_source = AuthSource.find(params[:id])
if @auth_source.update_attributes(params[:auth_source])
flash[:notice] = l(:notice_successful_update)
redirect_to :action => 'list'
redirect_to :action => 'index'
else
render :action => 'edit'
end
@ -70,7 +65,7 @@ class AuthSourcesController < ApplicationController
rescue => text
flash[:error] = "Unable to connect (#{text})"
end
redirect_to :action => 'list'
redirect_to :action => 'index'
end
def destroy
@ -79,6 +74,6 @@ class AuthSourcesController < ApplicationController
@auth_source.destroy
flash[:notice] = l(:notice_successful_delete)
end
redirect_to :action => 'list'
redirect_to :action => 'index'
end
end

View File

@ -20,7 +20,7 @@
</div>
<div style="float:right;">
<%= link_to l(:label_ldap_authentication), :controller => 'auth_sources', :action => 'list' %>
<%= link_to l(:label_ldap_authentication), :controller => 'auth_sources', :action => 'index' %>
</div>
<%= submit_tag l(:button_save) %>