Adds user count in status drop down on admin user list.

git-svn-id: http://redmine.rubyforge.org/svn/trunk@1735 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang 2008-08-11 21:10:24 +00:00
parent d47400aa8d
commit 41d44c5285
2 changed files with 6 additions and 5 deletions

View File

@ -16,11 +16,12 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
module UsersHelper module UsersHelper
def status_options_for_select(selected) def users_status_options_for_select(selected)
user_count_by_status = User.count(:group => 'status').to_hash
options_for_select([[l(:label_all), ''], options_for_select([[l(:label_all), ''],
[l(:status_active), 1], ["#{l(:status_active)} (#{user_count_by_status[1].to_i})", 1],
[l(:status_registered), 2], ["#{l(:status_registered)} (#{user_count_by_status[2].to_i})", 2],
[l(:status_locked), 3]], selected) ["#{l(:status_locked)} (#{user_count_by_status[3].to_i})", 3]], selected)
end end
# Options for the new membership projects combo-box # Options for the new membership projects combo-box

View File

@ -7,7 +7,7 @@
<% form_tag({}, :method => :get) do %> <% form_tag({}, :method => :get) do %>
<fieldset><legend><%= l(:label_filter_plural) %></legend> <fieldset><legend><%= l(:label_filter_plural) %></legend>
<label><%= l(:field_status) %> :</label> <label><%= l(:field_status) %> :</label>
<%= select_tag 'status', status_options_for_select(@status), :class => "small", :onchange => "this.form.submit(); return false;" %> <%= select_tag 'status', users_status_options_for_select(@status), :class => "small", :onchange => "this.form.submit(); return false;" %>
</fieldset> </fieldset>
<% end %> <% end %>
&nbsp; &nbsp;