Commit c5f30fde authored by Eric Davis's avatar Eric Davis

Refactor: Merged AuthSourcesController#list and #index

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@3436 e93f8b46-1217-0410-a6f0-8f06a7374b81
parent 038a88e9
...@@ -20,18 +20,13 @@ class AuthSourcesController < ApplicationController ...@@ -20,18 +20,13 @@ class AuthSourcesController < ApplicationController
before_filter :require_admin 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) # GETs should be safe (see http://www.w3.org/2001/tag/doc/whenToUseGet.html)
verify :method => :post, :only => [ :destroy, :create, :update ], verify :method => :post, :only => [ :destroy, :create, :update ],
:redirect_to => { :action => :list } :redirect_to => { :action => :list }
def list def index
@auth_source_pages, @auth_sources = paginate :auth_sources, :per_page => 10 @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 end
def new def new
...@@ -42,7 +37,7 @@ class AuthSourcesController < ApplicationController ...@@ -42,7 +37,7 @@ class AuthSourcesController < ApplicationController
@auth_source = AuthSourceLdap.new(params[:auth_source]) @auth_source = AuthSourceLdap.new(params[:auth_source])
if @auth_source.save if @auth_source.save
flash[:notice] = l(:notice_successful_create) flash[:notice] = l(:notice_successful_create)
redirect_to :action => 'list' redirect_to :action => 'index'
else else
render :action => 'new' render :action => 'new'
end end
...@@ -56,7 +51,7 @@ class AuthSourcesController < ApplicationController ...@@ -56,7 +51,7 @@ class AuthSourcesController < ApplicationController
@auth_source = AuthSource.find(params[:id]) @auth_source = AuthSource.find(params[:id])
if @auth_source.update_attributes(params[:auth_source]) if @auth_source.update_attributes(params[:auth_source])
flash[:notice] = l(:notice_successful_update) flash[:notice] = l(:notice_successful_update)
redirect_to :action => 'list' redirect_to :action => 'index'
else else
render :action => 'edit' render :action => 'edit'
end end
...@@ -70,7 +65,7 @@ class AuthSourcesController < ApplicationController ...@@ -70,7 +65,7 @@ class AuthSourcesController < ApplicationController
rescue => text rescue => text
flash[:error] = "Unable to connect (#{text})" flash[:error] = "Unable to connect (#{text})"
end end
redirect_to :action => 'list' redirect_to :action => 'index'
end end
def destroy def destroy
...@@ -79,6 +74,6 @@ class AuthSourcesController < ApplicationController ...@@ -79,6 +74,6 @@ class AuthSourcesController < ApplicationController
@auth_source.destroy @auth_source.destroy
flash[:notice] = l(:notice_successful_delete) flash[:notice] = l(:notice_successful_delete)
end end
redirect_to :action => 'list' redirect_to :action => 'index'
end end
end end
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
</div> </div>
<div style="float:right;"> <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> </div>
<%= submit_tag l(:button_save) %> <%= submit_tag l(:button_save) %>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment