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