ISSUE中指派者按中文姓名排序

This commit is contained in:
huang 2016-11-18 10:04:02 +08:00
parent 00d12fdeb3
commit f87d1ce3bd
1 changed files with 5 additions and 3 deletions

View File

@ -20,6 +20,8 @@
module IssuesHelper
include ApplicationHelper
include TagsHelper
require 'iconv'
def issue_list(issues, &block)
ancestors = []
issues.each do |issue|
@ -119,10 +121,11 @@ module IssuesHelper
end
def principals_options_for_isuue_list(project)
conv = Iconv.new("GBK", "utf-8")
if User.current.member_of?(project)
project.members.includes(:user).order("lower(users.login)").map{|c| [User.find(c.user_id).show_name, c.user_id]}.unshift(["<< #{l(:label_me)} >>", User.current.id]).unshift(["指派给", 0])
project.members.includes(:user).sort{|x, y| conv.iconv(x.user.lastname) <=> conv.iconv(y.user.lastname)}.map{|c| [User.find(c.user_id).show_name, c.user_id]}.unshift(["<< #{l(:label_me)} >>", User.current.id]).unshift(["指派给", 0])
else
project.members.includes(:user).order("lower(users.login)").map{|c| [User.find(c.user_id).show_name, c.user_id]}.unshift(["指派给", 0])
project.members.includes(:user).sort{|x, y| conv.iconv(x.user.lastname) <=> conv.iconv(y.user.lastname)}.map{|c| [User.find(c.user_id).show_name, c.user_id]}.unshift(["指派给", 0])
end
end
@ -130,7 +133,6 @@ module IssuesHelper
versions = Version.where(:project_id => project, :status => "open").map{|version| [version.name, version.id]}.unshift(["里程碑", 0])
end
def render_issue_subject_with_tree(issue)
s = ''
ancestors = issue.root? ? [] : issue.ancestors.visible.all