]> source.dussan.org Git - redmine.git/commitdiff
Refactor: Merged AuthSourcesController#list and #index
authorEric Davis <edavis@littlestreamsoftware.com>
Mon, 15 Feb 2010 16:41:21 +0000 (16:41 +0000)
committerEric Davis <edavis@littlestreamsoftware.com>
Mon, 15 Feb 2010 16:41:21 +0000 (16:41 +0000)
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@3436 e93f8b46-1217-0410-a6f0-8f06a7374b81

app/controllers/auth_sources_controller.rb
app/views/auth_sources/index.html.erb [new file with mode: 0644]
app/views/auth_sources/list.rhtml [deleted file]
app/views/settings/_authentication.rhtml

index 0f5fba1410b3fb35a9517b872df2c72850e468a2..eaedb5ba3cff9951c59e9bdbdc05bc3710b87763 100644 (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
diff --git a/app/views/auth_sources/index.html.erb b/app/views/auth_sources/index.html.erb
new file mode 100644 (file)
index 0000000..6e8b4d7
--- /dev/null
@@ -0,0 +1,35 @@
+<div class="contextual">
+<%= link_to l(:label_auth_source_new), {:action => 'new'}, :class => 'icon icon-add' %>
+</div>
+
+<h2><%=l(:label_auth_source_plural)%></h2>
+
+<table class="list">
+  <thead><tr>
+         <th><%=l(:field_name)%></th>
+         <th><%=l(:field_type)%></th>
+         <th><%=l(:field_host)%></th>
+         <th><%=l(:label_user_plural)%></th>
+         <th></th>
+  </tr></thead>
+  <tbody>
+<% for source in @auth_sources %>
+  <tr class="<%= cycle("odd", "even") %>">
+    <td><%= link_to source.name, :action => 'edit', :id => source%></td>
+    <td align="center"><%= source.auth_method_name %></td>
+    <td align="center"><%= source.host %></td>    
+    <td align="center"><%= source.users.count %></td>
+    <td class="buttons">
+       <%= link_to l(:button_test), :action => 'test_connection', :id => source %>
+       <%= link_to l(:button_delete), { :action => 'destroy', :id => source },
+                                                                                                                                                                                                               :method => :post,
+                                                        :confirm => l(:text_are_you_sure),
+                                                        :class => 'icon icon-del',
+                                                        :disabled => source.users.any? %>
+    </td>
+  </tr>
+<% end %>
+  </tbody>
+</table>
+
+<p class="pagination"><%= pagination_links_full @auth_source_pages %></p>
diff --git a/app/views/auth_sources/list.rhtml b/app/views/auth_sources/list.rhtml
deleted file mode 100644 (file)
index 6e8b4d7..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
-<div class="contextual">
-<%= link_to l(:label_auth_source_new), {:action => 'new'}, :class => 'icon icon-add' %>
-</div>
-
-<h2><%=l(:label_auth_source_plural)%></h2>
-
-<table class="list">
-  <thead><tr>
-         <th><%=l(:field_name)%></th>
-         <th><%=l(:field_type)%></th>
-         <th><%=l(:field_host)%></th>
-         <th><%=l(:label_user_plural)%></th>
-         <th></th>
-  </tr></thead>
-  <tbody>
-<% for source in @auth_sources %>
-  <tr class="<%= cycle("odd", "even") %>">
-    <td><%= link_to source.name, :action => 'edit', :id => source%></td>
-    <td align="center"><%= source.auth_method_name %></td>
-    <td align="center"><%= source.host %></td>    
-    <td align="center"><%= source.users.count %></td>
-    <td class="buttons">
-       <%= link_to l(:button_test), :action => 'test_connection', :id => source %>
-       <%= link_to l(:button_delete), { :action => 'destroy', :id => source },
-                                                                                                                                                                                                               :method => :post,
-                                                        :confirm => l(:text_are_you_sure),
-                                                        :class => 'icon icon-del',
-                                                        :disabled => source.users.any? %>
-    </td>
-  </tr>
-<% end %>
-  </tbody>
-</table>
-
-<p class="pagination"><%= pagination_links_full @auth_source_pages %></p>
index eb51ee9f6afa8d1db5edc0680d49d4247b1057ea..81814bba334cb28ff2e13a56983d8459ff48dc63 100644 (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) %>