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
@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
@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
rescue => text
flash[:error] = "Unable to connect (#{text})"
end
- redirect_to :action => 'list'
+ redirect_to :action => 'index'
end
def destroy
@auth_source.destroy
flash[:notice] = l(:notice_successful_delete)
end
- redirect_to :action => 'list'
+ redirect_to :action => 'index'
end
end
--- /dev/null
+<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>
+++ /dev/null
-<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>
</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) %>