@@ -34,7 +34,7 class UsersController < ApplicationController | |||
|
34 | 34 | sort_update |
|
35 | 35 | |
|
36 | 36 |
@status = params[:status] ? params[:status].to_i : 1 |
|
37 |
conditions = |
|
|
37 | conditions = "status <> 0" | |
|
38 | 38 | conditions = ["status=?", @status] unless @status == 0 |
|
39 | 39 | |
|
40 | 40 | @user_count = User.count(:conditions => conditions) |
@@ -17,7 +17,7 | |||
|
17 | 17 | |
|
18 | 18 | module UsersHelper |
|
19 | 19 | def status_options_for_select(selected) |
|
20 |
options_for_select([[l(:label_all), |
|
|
20 | options_for_select([[l(:label_all), ''], | |
|
21 | 21 | [l(:status_active), 1], |
|
22 | 22 | [l(:status_registered), 2], |
|
23 | 23 | [l(:status_locked), 3]], selected) |
@@ -4,11 +4,10 | |||
|
4 | 4 | |
|
5 | 5 | <h2><%=l(:label_user_plural)%></h2> |
|
6 | 6 | |
|
7 | <% form_tag() do %> | |
|
7 | <% form_tag({}, :method => :get) do %> | |
|
8 | 8 | <fieldset><legend><%= l(:label_filter_plural) %></legend> |
|
9 | 9 | <label><%= l(:field_status) %> :</label> |
|
10 | 10 | <%= select_tag 'status', status_options_for_select(@status), :class => "small", :onchange => "this.form.submit(); return false;" %> |
|
11 | <%= submit_tag l(:button_apply), :class => "small" %> | |
|
12 | 11 | </fieldset> |
|
13 | 12 | <% end %> |
|
14 | 13 | |
@@ -20,38 +19,33 | |||
|
20 | 19 | <%= sort_header_tag('lastname', :caption => l(:field_lastname)) %> |
|
21 | 20 | <th><%=l(:field_mail)%></th> |
|
22 | 21 | <%= sort_header_tag('admin', :caption => l(:field_admin)) %> |
|
23 | <%= sort_header_tag('status', :caption => l(:field_status)) %> | |
|
24 | 22 | <%= sort_header_tag('created_on', :caption => l(:field_created_on)) %> |
|
25 | 23 | <%= sort_header_tag('last_login_on', :caption => l(:field_last_login_on)) %> |
|
26 | 24 | <th></th> |
|
27 | 25 | </tr></thead> |
|
28 | 26 | <tbody> |
|
29 | <% for user in @users %> | |
|
30 | <tr class="<%= cycle("odd", "even") %>"> | |
|
31 | <td><%= link_to user.login, :action => 'edit', :id => user %></td> | |
|
32 | <td><%= user.firstname %></td> | |
|
33 | <td><%= user.lastname %></td> | |
|
34 | <td><%= user.mail %></td> | |
|
35 |
<td align="center"><%= image_tag |
|
|
36 | <td align="center"><%= image_tag 'locked.png' if user.locked? %><%= image_tag 'user_new.png' if user.registered? %></td> | |
|
37 |
<td align="center"><%= format_time(user. |
|
|
38 | <td align="center"><%= format_time(user.last_login_on) unless user.last_login_on.nil? %></td> | |
|
39 | <td align="center"> | |
|
40 | <% form_tag({:action => 'edit', :id => user}) do %> | |
|
41 | <% if user.locked? %> | |
|
42 | <%= hidden_field_tag 'user[status]', User::STATUS_ACTIVE %> | |
|
43 | <%= submit_tag l(:button_unlock), :class => "button-small" %> | |
|
44 | <% elsif user.registered? %> | |
|
45 | <%= hidden_field_tag 'user[status]', User::STATUS_ACTIVE %> | |
|
46 | <%= submit_tag l(:button_activate), :class => "button-small" %> | |
|
47 | <% else %> | |
|
48 | <%= hidden_field_tag 'user[status]', User::STATUS_LOCKED %> | |
|
49 | <%= submit_tag l(:button_lock), :class => "button-small" %> | |
|
50 | <% end %> | |
|
51 | <% end %> | |
|
27 | <% for user in @users -%> | |
|
28 | <tr class="user <%= cycle("odd", "even") %> <%= %w(anon active registered locked)[user.status] %>"> | |
|
29 | <td class="username"><%= link_to user.login, :action => 'edit', :id => user %></td> | |
|
30 | <td class="firstname"><%= user.firstname %></td> | |
|
31 | <td class="lastname"><%= user.lastname %></td> | |
|
32 | <td class="email"><%= user.mail %></td> | |
|
33 | <td align="center"><%= image_tag('true.png') if user.admin? %></td> | |
|
34 | <td class="created_on" align="center"><%= format_time(user.created_on) %></td> | |
|
35 | <td class="last_login_on" align="center"><%= format_time(user.last_login_on) unless user.last_login_on.nil? %></td> | |
|
36 | <td> | |
|
37 | <small> | |
|
38 | <% if user.locked? -%> | |
|
39 | <%= link_to l(:button_unlock), {:action => 'edit', :id => user, :user => {:status => User::STATUS_ACTIVE}}, :method => :post, :class => 'icon icon-unlock' %> | |
|
40 | <% elsif user.registered? -%> | |
|
41 | <%= link_to l(:button_activate), {:action => 'edit', :id => user, :user => {:status => User::STATUS_ACTIVE}}, :method => :post, :class => 'icon icon-unlock' %> | |
|
42 | <% else -%> | |
|
43 | <%= link_to l(:button_lock), {:action => 'edit', :id => user, :user => {:status => User::STATUS_LOCKED}}, :method => :post, :class => 'icon icon-lock' %> | |
|
44 | <% end -%> | |
|
45 | </small> | |
|
52 | 46 | </td> |
|
53 | 47 | </tr> |
|
54 | <% end %> | |
|
48 | <% end -%> | |
|
55 | 49 | </tbody> |
|
56 | 50 | </table> |
|
57 | 51 |
@@ -94,6 +94,12 tr.message td.last_message { font-size: 80%; } | |||
|
94 | 94 | tr.message.locked td.subject a { background-image: url(../images/locked.png); } |
|
95 | 95 | tr.message.sticky td.subject a { background-image: url(../images/sticky.png); font-weight: bold; } |
|
96 | 96 | |
|
97 | tr.user td { width:13%; } | |
|
98 | tr.user td.email { width:18%; } | |
|
99 | tr.user td { white-space: nowrap; } | |
|
100 | tr.user.locked, tr.user.registered { color: #aaa; } | |
|
101 | tr.user.locked a, tr.user.registered a { color: #aaa; } | |
|
102 | ||
|
97 | 103 | table.list tbody tr:hover { background-color:#ffffdd; } |
|
98 | 104 | table td {padding:2px;} |
|
99 | 105 | table p {margin:0;} |
General Comments 0
You need to be logged in to leave comments.
Login now