mirror of
https://github.com/meineerde/redmine.git
synced 2026-02-16 08:32:02 +00:00
Remove code no longer necessary due to r21823 (#37674).
git-svn-id: https://svn.redmine.org/redmine/trunk@22046 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
parent
91705e083b
commit
4768bebf3f
@ -20,11 +20,6 @@
|
|||||||
module UsersHelper
|
module UsersHelper
|
||||||
include ApplicationHelper
|
include ApplicationHelper
|
||||||
|
|
||||||
def users_status_options_for_select(selected)
|
|
||||||
user_count_by_status = User.group('status').count.to_hash
|
|
||||||
options_for_select([[l(:label_all), '']] + (User.valid_statuses.map {|c| ["#{l('status_' + User::LABEL_BY_STATUS[c])} (#{user_count_by_status[c].to_i})", c]}), selected.to_s)
|
|
||||||
end
|
|
||||||
|
|
||||||
def user_mail_notification_options(user)
|
def user_mail_notification_options(user)
|
||||||
user.valid_notification_options.collect {|o| [l(o.last), o.first]}
|
user.valid_notification_options.collect {|o| [l(o.last), o.first]}
|
||||||
end
|
end
|
||||||
@ -105,58 +100,4 @@ module UsersHelper
|
|||||||
end
|
end
|
||||||
tabs
|
tabs
|
||||||
end
|
end
|
||||||
|
|
||||||
def csv_content(column_name, user)
|
|
||||||
case column_name
|
|
||||||
when 'status'
|
|
||||||
l("status_#{User::LABEL_BY_STATUS[user.status]}")
|
|
||||||
when 'twofa_scheme'
|
|
||||||
if user.twofa_active?
|
|
||||||
l("twofa__#{user.twofa_scheme}__name")
|
|
||||||
else
|
|
||||||
l(:label_disabled)
|
|
||||||
end
|
|
||||||
else
|
|
||||||
user.send(column_name)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
def users_to_csv(users)
|
|
||||||
Redmine::Export::CSV.generate(:encoding => params[:encoding]) do |csv|
|
|
||||||
columns = [
|
|
||||||
'login',
|
|
||||||
'firstname',
|
|
||||||
'lastname',
|
|
||||||
'mail',
|
|
||||||
'admin',
|
|
||||||
'status',
|
|
||||||
'twofa_scheme',
|
|
||||||
'created_on',
|
|
||||||
'updated_on',
|
|
||||||
'last_login_on',
|
|
||||||
'passwd_changed_on'
|
|
||||||
]
|
|
||||||
user_custom_fields = UserCustomField.sorted
|
|
||||||
|
|
||||||
# csv header fields
|
|
||||||
csv << columns.map {|column| l('field_' + column)} + user_custom_fields.pluck(:name)
|
|
||||||
# csv lines
|
|
||||||
users = users.preload(:custom_values)
|
|
||||||
users.each do |user|
|
|
||||||
values = columns.map {|c| csv_content(c, user)} +
|
|
||||||
user_custom_fields.map {|custom_field| user.custom_value_for(custom_field)}
|
|
||||||
|
|
||||||
csv << values.map do |value|
|
|
||||||
format_object(value, false) do |v|
|
|
||||||
case v.class.name
|
|
||||||
when 'Float'
|
|
||||||
sprintf('%.2f', v).gsub('.', l(:general_csv_decimal_separator))
|
|
||||||
else
|
|
||||||
v
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user