Issue新建页面的指派者,按照姓名排序

This commit is contained in:
daiao 2017-02-07 15:15:10 +08:00
parent 0cfd2fc1ef
commit 574f491b56
1 changed files with 3 additions and 2 deletions

View File

@ -19,7 +19,7 @@
require 'forwardable'
require 'cgi'
require 'iconv'
module ApplicationHelper
include Redmine::WikiFormatting::Macros::Definitions
include Redmine::I18n
@ -1185,13 +1185,14 @@ module ApplicationHelper
end
def assigned_options_for_select(collection, selected=nil)
conv = Iconv.new("GBK", "utf-8")
s = ''
s << content_tag('option', "#{l(:label_assiged_tip)}", :value => 0)
if collection.include?(User.current)
s << content_tag('option', "<< #{l(:label_me)} >>", :value => User.current.id)
end
groups = ''
collection.sort.each do |element|
collection.sort{|x, y| conv.iconv(x.lastname) <=> conv.iconv(y.lastname)}.each do |element|
selected_attribute = ' selected="selected"' if option_value_selected?(element, selected)
(element.is_a?(Group) ? groups : s) << %(<option value="#{element.id}"#{selected_attribute}>#{h element.show_name}</option>)
end