Project

General

Profile

« Previous | Next » 

Revision fcaa7349

Added by Marc Dequènes almost 16 years ago

  • ID fcaa7349150c075d65b5b5fa30064d66d0878ee9

[evol] add complete user management interface

View differences:

app/helpers/application_helper.rb
image_submit_tag icons_subpath(image_name, size_name), html_options
end
def display_standard_item_actions(obj = nil)
def display_standard_item_actions(obj = nil, action_list = nil)
obj = resource_object if obj.nil?
res = resource_family(obj)
disp = ""
disp += link_to display_icon_tag('actions/document-properties', :medium, :title => _("Modify")), edit_polymorphic_path(res.dup)
disp += link_to display_icon_tag('actions/edit-delete', :medium, :title => _("Delete")), polymorphic_path(res.dup), :method => :delete, :confirm => _("Are you sure?")
if action_list.nil? or action_list.include? :modify
disp += link_to display_icon_tag('actions/document-properties', :medium, :title => _("Modify")), edit_polymorphic_path(res.dup)
else
disp += display_action_placeholder
end
if action_list.nil? or action_list.include? :delete
disp += link_to display_icon_tag('actions/edit-delete', :medium, :title => _("Delete")), polymorphic_path(res.dup), :method => :delete, :confirm => _("Are you sure?")
else
disp += display_action_placeholder
end
return disp
end
app/views/admin/users/index.rhtml
<p><%= display_alert _("Not implemented yet !") %></p>
<h2><%= _("List of users") %></h2>
<p>
<table>
<tr>
<th><%= sortable_header :login, :label => _("Login"), :default => true %></th>
<th><%= sortable_header :real_name, :label => _("Real Name") %></th>
<th><%= sortable_header :email, :label => _("eMail") %></th>
<th><%= _("Actions") %></th>
</tr>
<%
# work around 'sortable-list' plugin not enforcing default sort
params[:sort] ||= :login
%>
<% @users = resource_model.paginate(:all, :order => params[:sort], :page => params[:page]) %>
<% @users.each do |user| %>
<tr>
<td><%= link_to_resource user, user.login %></td>
<td><%= user.real_name %></td>
<td><%= user.email %></td>
<td class="actions"><%= display_standard_item_actions(user, (user == @current_user) ? [:modify] : nil) %></td>
</tr>
<% end %>
</table>
<%= will_paginate @users %>
<%= display_new_action %>
</p>

Also available in: Unified diff