summaryrefslogtreecommitdiffstats
path: root/app/views/users/list.rhtml
blob: 87d42391cd0fb7d9263f10946f1bc39639045692 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
<div class="contextual">
<%= link_to l(:label_user_new), {:action => 'add'}, :class => 'icon icon-add' %>
</div>

<h2><%=l(:label_user_plural)%></h2>

<table class="list">		
  <thead><tr>
	<%= sort_header_tag('login', :caption => l(:field_login)) %>
	<%= sort_header_tag('firstname', :caption => l(:field_firstname)) %>
	<%= sort_header_tag('lastname', :caption => l(:field_lastname)) %>
	<th><%=l(:field_mail)%></th>
	<%= sort_header_tag('admin', :caption => l(:field_admin)) %>
	<%= sort_header_tag('status', :caption => l(:field_status)) %>
	<%= sort_header_tag('created_on', :caption => l(:field_created_on)) %>
	<%= sort_header_tag('last_login_on', :caption => l(:field_last_login_on)) %>
    <th></th>
  </tr></thead>
  <tbody>
<% for user in @users %>
  <tr class="<%= cycle("odd", "even") %>">
	<td><%= link_to user.login, :action => 'edit', :id => user %></td>
	<td><%= user.firstname %></td>
	<td><%= user.lastname %></td>
	<td><%= user.mail %></td>
	<td align="center"><%= image_tag 'true.png' if user.admin? %></td>
	<td align="center"><%= image_tag 'locked.png' if user.locked? %><%= image_tag 'user_new.png' if user.registered? %></td>
	<td align="center"><%= format_time(user.created_on) %></td>
	<td align="center"><%= format_time(user.last_login_on) unless user.last_login_on.nil? %></td>
  <td align="center">
    <% form_tag({:action => 'edit', :id => user}) do %>
    <% if user.locked? %>
      <%= hidden_field_tag 'user[status]', User::STATUS_ACTIVE %>
      <%= submit_tag l(:button_unlock), :class => "button-small"  %>
    <% elsif user.registered? %>
      <%= hidden_field_tag 'user[status]', User::STATUS_ACTIVE %>
      <%= submit_tag l(:button_activate), :class => "button-small"  %>
    <% else %>
      <%= hidden_field_tag 'user[status]', User::STATUS_LOCKED %>
      <%= submit_tag l(:button_lock), :class => "button-small"  %>
    <% end %>
    <% end %>  
  </td>
  </tr>
<% end %>
  </tbody>
</table>

<p><%= pagination_links_full @user_pages %>
[ <%= @user_pages.current.first_item %> - <%= @user_pages.current.last_item %> / <%= @user_count %> ]
</p>