]> source.dussan.org Git - redmine.git/commitdiff
Slight changes on users list view and hide Anonymous user.
authorJean-Philippe Lang <jp_lang@yahoo.fr>
Sun, 3 Feb 2008 19:53:52 +0000 (19:53 +0000)
committerJean-Philippe Lang <jp_lang@yahoo.fr>
Sun, 3 Feb 2008 19:53:52 +0000 (19:53 +0000)
git-svn-id: http://redmine.rubyforge.org/svn/trunk@1118 e93f8b46-1217-0410-a6f0-8f06a7374b81

app/controllers/users_controller.rb
app/helpers/users_helper.rb
app/views/users/list.rhtml
public/stylesheets/application.css

index f67d1ae53786e4cd2c949946a58b94b4073cb864..ceb70ab924f614060d9ab3a22485c4a0eec54979 100644 (file)
@@ -33,8 +33,8 @@ class UsersController < ApplicationController
     sort_init 'login', 'asc'
     sort_update
     
-    @status = params[:status] ? params[:status].to_i : 1    
-    conditions = nil
+    @status = params[:status] ? params[:status].to_i : 1
+    conditions = "status <> 0"
     conditions = ["status=?", @status] unless @status == 0
     
     @user_count = User.count(:conditions => conditions)
index 9dc87c5cca61527bc7734b3a45efd83dc71b6b23..7bd1371617c3a4220353720f50b2698517afdd41 100644 (file)
@@ -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)
index 50054c989fc7be1e0f12e39eb6f7abaf301d43de..7415af3087dbea36335ffee31135308c10868ca3 100644 (file)
@@ -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 %>
 &nbsp;
        <%= 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>
 
index 1090d8c8749083e10837fa6950cf24fb78aa390f..1abd1f6fd1a595e3ed66413090a9995e14eca9f4 100644 (file)
@@ -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;}