comparison app/helpers/users_helper.rb @ 1339:c03a6c3c4db9 luisf

Merge
author luisf <luis.figueira@eecs.qmul.ac.uk>
date Thu, 20 Jun 2013 14:34:42 +0100
parents 433d4f72a19b
children 622f24f53b42
comparison
equal deleted inserted replaced
1079:413d1d9c3efa 1339:c03a6c3c4db9
1 # encoding: utf-8 1 # encoding: utf-8
2 # 2 #
3 # Redmine - project management software 3 # Redmine - project management software
4 # Copyright (C) 2006-2011 Jean-Philippe Lang 4 # Copyright (C) 2006-2012 Jean-Philippe Lang
5 # 5 #
6 # This program is free software; you can redistribute it and/or 6 # This program is free software; you can redistribute it and/or
7 # modify it under the terms of the GNU General Public License 7 # modify it under the terms of the GNU General Public License
8 # as published by the Free Software Foundation; either version 2 8 # as published by the Free Software Foundation; either version 2
9 # of the License, or (at your option) any later version. 9 # of the License, or (at your option) any later version.
19 19
20 module UsersHelper 20 module UsersHelper
21 def users_status_options_for_select(selected) 21 def users_status_options_for_select(selected)
22 user_count_by_status = User.count(:group => 'status').to_hash 22 user_count_by_status = User.count(:group => 'status').to_hash
23 options_for_select([[l(:label_all), ''], 23 options_for_select([[l(:label_all), ''],
24 ["#{l(:status_active)} (#{user_count_by_status[1].to_i})", 1], 24 ["#{l(:status_active)} (#{user_count_by_status[1].to_i})", '1'],
25 ["#{l(:status_registered)} (#{user_count_by_status[2].to_i})", 2], 25 ["#{l(:status_registered)} (#{user_count_by_status[2].to_i})", '2'],
26 ["#{l(:status_locked)} (#{user_count_by_status[3].to_i})", 3]], selected) 26 ["#{l(:status_locked)} (#{user_count_by_status[3].to_i})", '3']], selected.to_s)
27 end
28
29 # Options for the new membership projects combo-box
30 def options_for_membership_project_select(user, projects)
31 options = content_tag('option', "--- #{l(:actionview_instancetag_blank_option)} ---")
32 options << project_tree_options_for_select(projects) do |p|
33 {:disabled => (user.projects.include?(p))}
34 end
35 options
36 end 27 end
37 28
38 def user_mail_notification_options(user) 29 def user_mail_notification_options(user)
39 user.valid_notification_options.collect {|o| [l(o.last), o.first]} 30 user.valid_notification_options.collect {|o| [l(o.last), o.first]}
40 end 31 end