Redmine 4.1.1
This commit is contained in:
parent
33e7b881a5
commit
3d976f1b3b
1593 changed files with 36180 additions and 19489 deletions
|
@ -1,7 +1,7 @@
|
|||
# encoding: utf-8
|
||||
#
|
||||
# frozen_string_literal: true
|
||||
|
||||
# Redmine - project management software
|
||||
# Copyright (C) 2006-2017 Jean-Philippe Lang
|
||||
# Copyright (C) 2006-2019 Jean-Philippe Lang
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
|
@ -18,12 +18,11 @@
|
|||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
|
||||
module UsersHelper
|
||||
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), ''],
|
||||
["#{l(:status_active)} (#{user_count_by_status[1].to_i})", '1'],
|
||||
["#{l(:status_registered)} (#{user_count_by_status[2].to_i})", '2'],
|
||||
["#{l(:status_locked)} (#{user_count_by_status[3].to_i})", '3']], selected.to_s)
|
||||
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)
|
||||
|
@ -34,6 +33,15 @@ module UsersHelper
|
|||
[[l(:label_font_default), '']] + UserPreference::TEXTAREA_FONT_OPTIONS.map {|o| [l("label_font_#{o}"), o]}
|
||||
end
|
||||
|
||||
def history_default_tab_options
|
||||
[[l('label_issue_history_notes'), 'notes'],
|
||||
[l('label_history'), 'history'],
|
||||
[l('label_issue_history_properties'), 'properties'],
|
||||
[l('label_time_entry_plural'), 'time_entries'],
|
||||
[l('label_associated_revisions'), 'changesets'],
|
||||
[l('label_last_tab_visited'), 'last_tab_visited']]
|
||||
end
|
||||
|
||||
def change_status_link(user)
|
||||
url = {:controller => 'users', :action => 'update', :id => user, :page => params[:page], :status => params[:status], :tab => nil}
|
||||
|
||||
|
@ -61,4 +69,32 @@ module UsersHelper
|
|||
end
|
||||
tabs
|
||||
end
|
||||
|
||||
def users_to_csv(users)
|
||||
Redmine::Export::CSV.generate(:encoding => params[:encoding]) do |csv|
|
||||
columns = [
|
||||
'login',
|
||||
'firstname',
|
||||
'lastname',
|
||||
'mail',
|
||||
'admin',
|
||||
'created_on',
|
||||
'last_login_on',
|
||||
'status'
|
||||
]
|
||||
|
||||
# csv header fields
|
||||
csv << columns.map{|column| l('field_' + column)}
|
||||
# csv lines
|
||||
users.each do |user|
|
||||
csv << columns.map do |column|
|
||||
if column == 'status'
|
||||
l(("status_#{User::LABEL_BY_STATUS[user.status]}"))
|
||||
else
|
||||
format_object(user.send(column), false)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue