プロジェクト

全般

プロフィール

Vote #75179

未完了

Fix ordering in ApplicationHelper method principals_options_for_select

Admin Redmine さんが約4年前に追加. 約4年前に更新.

ステータス:
New
優先度:
通常
担当者:
-
カテゴリ:
Issues_2
対象バージョン:
-
開始日:
2022/05/09
期日:
進捗率:

0%

予定工数:
category_id:
2
version_id:
0
issue_org_id:
16730
author_id:
75979
assigned_to_id:
0
comments:
7
status_id:
1
tracker_id:
3
plus1:
1
affected_version:
closed_on:
affected_version_id:
ステータス-->[New]

説明

We experienced problems on assigning issues recently.
We have a lot of members for some projects (about 30+ people each project).
User's name (first name & last name) are in non-English.
The problem is seems Redmine does not sort users in Assignee drop down while editing a issue, so it is very hard to find a user.
We are wondering if Redmine could provide a search box like adding watchers do.


journals

I think that ApplicationHelpers' method principals_options_for_select does sort, perhaps it's not properly working for foreign locales?
source:trunk/app/helpers/application_helper.rb#L375
--------------------------------------------------------------------------------
Jan Niggemann (redmine.org team member) wrote:
> I think that ApplicationHelpers' method principals_options_for_select does sort, perhaps it's not properly working for foreign locales?
> source:trunk/app/helpers/application_helper.rb#L375

My locale is zh. User names are in Chinese.
--------------------------------------------------------------------------------
Jan Niggemann (redmine.org team member) wrote:
> I think that ApplicationHelpers' method principals_options_for_select does sort, perhaps it's not properly working for foreign locales?
> source:trunk/app/helpers/application_helper.rb#L375

I totally don't have experience on Ruby, but seems this line is a problem:
<pre><code class="ruby">
collection.sort.each do |element|
</code></pre>
collection contains User objects? Doesn't the sort method sort elements by address? or something else?

I googled "Ruby sort collection" and got this:
http://stackoverflow.com/questions/882070/sorting-an-array-of-objects-in-ruby-by-object-attribute

Then I changed the line to following:
<pre><code class="ruby">
collection.sort_by{|user|user.lastname}.each do |element|
</code></pre>

Then glad to see it works. Redmine sorted Assignees by last name even in Chinese.

Hope that won't bring side effect.
--------------------------------------------------------------------------------

--------------------------------------------------------------------------------

--------------------------------------------------------------------------------
"User" has order attribute.
source:tags/2.5.1/app/models/user.rb#L24
--------------------------------------------------------------------------------
+1. This problem is very unbearable.

Currently, I must configure to displaying login as user name - which is hard to read. But, sorting by user `login` is what we need - at least for Chinese.

--------------------------------------------------------------------------------

Admin Redmine さんが約4年前に更新

  • カテゴリIssues_2 にセット

他の形式にエクスポート: Atom PDF

いいね!0
いいね!0