Slight changes on users list view and hide Anonymous user.
git-svn-id: http://redmine.rubyforge.org/svn/trunk@1118 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
parent
09cfef094c
commit
4e244be21c
|
@ -34,7 +34,7 @@ class UsersController < ApplicationController
|
|||
sort_update
|
||||
|
||||
@status = params[:status] ? params[:status].to_i : 1
|
||||
conditions = nil
|
||||
conditions = "status <> 0"
|
||||
conditions = ["status=?", @status] unless @status == 0
|
||||
|
||||
@user_count = User.count(:conditions => conditions)
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
|
||||
module UsersHelper
|
||||
def status_options_for_select(selected)
|
||||
options_for_select([[l(:label_all), "*"],
|
||||
options_for_select([[l(:label_all), ''],
|
||||
[l(:status_active), 1],
|
||||
[l(:status_registered), 2],
|
||||
[l(:status_locked), 3]], selected)
|
||||
|
|
|
@ -4,11 +4,10 @@
|
|||
|
||||
<h2><%=l(:label_user_plural)%></h2>
|
||||
|
||||
<% form_tag() do %>
|
||||
<% form_tag({}, :method => :get) do %>
|
||||
<fieldset><legend><%= l(:label_filter_plural) %></legend>
|
||||
<label><%= l(:field_status) %> :</label>
|
||||
<%= select_tag 'status', status_options_for_select(@status), :class => "small", :onchange => "this.form.submit(); return false;" %>
|
||||
<%= submit_tag l(:button_apply), :class => "small" %>
|
||||
</fieldset>
|
||||
<% end %>
|
||||
|
||||
|
@ -20,38 +19,33 @@
|
|||
<%= 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>
|
||||
<% for user in @users -%>
|
||||
<tr class="user <%= cycle("odd", "even") %> <%= %w(anon active registered locked)[user.status] %>">
|
||||
<td class="username"><%= link_to user.login, :action => 'edit', :id => user %></td>
|
||||
<td class="firstname"><%= user.firstname %></td>
|
||||
<td class="lastname"><%= user.lastname %></td>
|
||||
<td class="email"><%= user.mail %></td>
|
||||
<td align="center"><%= image_tag('true.png') if user.admin? %></td>
|
||||
<td class="created_on" align="center"><%= format_time(user.created_on) %></td>
|
||||
<td class="last_login_on" align="center"><%= format_time(user.last_login_on) unless user.last_login_on.nil? %></td>
|
||||
<td>
|
||||
<small>
|
||||
<% if user.locked? -%>
|
||||
<%= link_to l(:button_unlock), {:action => 'edit', :id => user, :user => {:status => User::STATUS_ACTIVE}}, :method => :post, :class => 'icon icon-unlock' %>
|
||||
<% elsif user.registered? -%>
|
||||
<%= link_to l(:button_activate), {:action => 'edit', :id => user, :user => {:status => User::STATUS_ACTIVE}}, :method => :post, :class => 'icon icon-unlock' %>
|
||||
<% else -%>
|
||||
<%= link_to l(:button_lock), {:action => 'edit', :id => user, :user => {:status => User::STATUS_LOCKED}}, :method => :post, :class => 'icon icon-lock' %>
|
||||
<% end -%>
|
||||
</small>
|
||||
</td>
|
||||
</tr>
|
||||
<% end %>
|
||||
<% end -%>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
|
|
|
@ -94,6 +94,12 @@ tr.message td.last_message { font-size: 80%; }
|
|||
tr.message.locked td.subject a { background-image: url(../images/locked.png); }
|
||||
tr.message.sticky td.subject a { background-image: url(../images/sticky.png); font-weight: bold; }
|
||||
|
||||
tr.user td { width:13%; }
|
||||
tr.user td.email { width:18%; }
|
||||
tr.user td { white-space: nowrap; }
|
||||
tr.user.locked, tr.user.registered { color: #aaa; }
|
||||
tr.user.locked a, tr.user.registered a { color: #aaa; }
|
||||
|
||||
table.list tbody tr:hover { background-color:#ffffdd; }
|
||||
table td {padding:2px;}
|
||||
table p {margin:0;}
|
||||
|
|
Loading…
Reference in New Issue