##// END OF EJS Templates
Refactor: Merged AuthSourcesController#list and #index...
Eric Davis -
r3322:c5f30fde2872
parent child
Show More
@@ -20,18 +20,13 class AuthSourcesController < ApplicationController
20
20
21 before_filter :require_admin
21 before_filter :require_admin
22
22
23 def index
24 list
25 render :action => 'list' unless request.xhr?
26 end
27
28 # GETs should be safe (see http://www.w3.org/2001/tag/doc/whenToUseGet.html)
23 # GETs should be safe (see http://www.w3.org/2001/tag/doc/whenToUseGet.html)
29 verify :method => :post, :only => [ :destroy, :create, :update ],
24 verify :method => :post, :only => [ :destroy, :create, :update ],
30 :redirect_to => { :action => :list }
25 :redirect_to => { :action => :list }
31
26
32 def list
27 def index
33 @auth_source_pages, @auth_sources = paginate :auth_sources, :per_page => 10
28 @auth_source_pages, @auth_sources = paginate :auth_sources, :per_page => 10
34 render :action => "list", :layout => false if request.xhr?
29 render :action => "index", :layout => false if request.xhr?
35 end
30 end
36
31
37 def new
32 def new
@@ -42,7 +37,7 class AuthSourcesController < ApplicationController
42 @auth_source = AuthSourceLdap.new(params[:auth_source])
37 @auth_source = AuthSourceLdap.new(params[:auth_source])
43 if @auth_source.save
38 if @auth_source.save
44 flash[:notice] = l(:notice_successful_create)
39 flash[:notice] = l(:notice_successful_create)
45 redirect_to :action => 'list'
40 redirect_to :action => 'index'
46 else
41 else
47 render :action => 'new'
42 render :action => 'new'
48 end
43 end
@@ -56,7 +51,7 class AuthSourcesController < ApplicationController
56 @auth_source = AuthSource.find(params[:id])
51 @auth_source = AuthSource.find(params[:id])
57 if @auth_source.update_attributes(params[:auth_source])
52 if @auth_source.update_attributes(params[:auth_source])
58 flash[:notice] = l(:notice_successful_update)
53 flash[:notice] = l(:notice_successful_update)
59 redirect_to :action => 'list'
54 redirect_to :action => 'index'
60 else
55 else
61 render :action => 'edit'
56 render :action => 'edit'
62 end
57 end
@@ -70,7 +65,7 class AuthSourcesController < ApplicationController
70 rescue => text
65 rescue => text
71 flash[:error] = "Unable to connect (#{text})"
66 flash[:error] = "Unable to connect (#{text})"
72 end
67 end
73 redirect_to :action => 'list'
68 redirect_to :action => 'index'
74 end
69 end
75
70
76 def destroy
71 def destroy
@@ -79,6 +74,6 class AuthSourcesController < ApplicationController
79 @auth_source.destroy
74 @auth_source.destroy
80 flash[:notice] = l(:notice_successful_delete)
75 flash[:notice] = l(:notice_successful_delete)
81 end
76 end
82 redirect_to :action => 'list'
77 redirect_to :action => 'index'
83 end
78 end
84 end
79 end
1 NO CONTENT: file renamed from app/views/auth_sources/list.rhtml to app/views/auth_sources/index.html.erb
NO CONTENT: file renamed from app/views/auth_sources/list.rhtml to app/views/auth_sources/index.html.erb
@@ -20,7 +20,7
20 </div>
20 </div>
21
21
22 <div style="float:right;">
22 <div style="float:right;">
23 <%= link_to l(:label_ldap_authentication), :controller => 'auth_sources', :action => 'list' %>
23 <%= link_to l(:label_ldap_authentication), :controller => 'auth_sources', :action => 'index' %>
24 </div>
24 </div>
25
25
26 <%= submit_tag l(:button_save) %>
26 <%= submit_tag l(:button_save) %>
General Comments 0
You need to be logged in to leave comments. Login now