Feature #43996 » 0001-Add-assignee-list-display-format-with-groups-first-o.patch
| app/helpers/application_helper.rb | ||
|---|---|---|
| 699 | 699 |
users_html = +'' |
| 700 | 700 |
groups_html = +'' |
| 701 | 701 |
collection.sort.each do |element| |
| 702 |
selected_attribute = nil |
|
| 702 | 703 |
if option_value_selected?(element, selected) || element.id.to_s == selected |
| 703 | 704 |
selected_attribute = ' selected="selected"' |
| 704 | 705 |
end |
| ... | ... | |
| 708 | 709 |
if involved_principals_html.blank? && groups_html.blank? |
| 709 | 710 |
s << users_html |
| 710 | 711 |
else |
| 711 |
[ |
|
| 712 |
[l(:label_involved_principals), involved_principals_html], |
|
| 713 |
[l(:label_user_plural), users_html], |
|
| 714 |
[l(:label_group_plural), groups_html] |
|
| 715 |
].each do |label, options_html| |
|
| 712 |
principal_optgroups = case Setting.principal_display_format.to_s |
|
| 713 |
when 'groups_then_users' |
|
| 714 |
[ |
|
| 715 |
[l(:label_group_plural), groups_html], |
|
| 716 |
[l(:label_user_plural), users_html] |
|
| 717 |
] |
|
| 718 |
else |
|
| 719 |
[ |
|
| 720 |
[l(:label_user_plural), users_html], |
|
| 721 |
[l(:label_group_plural), groups_html] |
|
| 722 |
] |
|
| 723 |
end |
|
| 724 |
([[l(:label_involved_principals), involved_principals_html]] + principal_optgroups).each do |label, options_html| |
|
| 716 | 725 |
s << %(<optgroup label="#{h(label)}">#{options_html}</optgroup>) if options_html.present?
|
| 717 | 726 |
end |
| 718 | 727 |
end |
| app/helpers/settings_helper.rb | ||
|---|---|---|
| 200 | 200 |
options.map {|label, value| [l(label), value.to_s]}
|
| 201 | 201 |
end |
| 202 | 202 | |
| 203 |
def principal_display_format_options |
|
| 204 |
options = [ |
|
| 205 |
[:label_principal_display_format_users_then_groups, 'users_then_groups'], |
|
| 206 |
[:label_principal_display_format_groups_then_users, 'groups_then_users'] |
|
| 207 |
] |
|
| 208 | ||
| 209 |
options.map {|label, value| [l(label), value.to_s]}
|
|
| 210 |
end |
|
| 211 | ||
| 203 | 212 |
def parent_issue_dates_options |
| 204 | 213 |
options = [ |
| 205 | 214 |
[:label_parent_task_attributes_derived, 'derived'], |
| app/views/settings/_issues.html.erb | ||
|---|---|---|
| 11 | 11 | |
| 12 | 12 |
<p><%= setting_check_box :close_duplicate_issues %></p> |
| 13 | 13 | |
| 14 |
<p><%= setting_check_box :issue_group_assignment %></p> |
|
| 14 |
<p><%= setting_check_box :issue_group_assignment, :data => {:enables => '#settings_principal_display_format'} %></p>
|
|
| 15 | ||
| 16 |
<p><%= setting_select :principal_display_format, principal_display_format_options %></p> |
|
| 15 | 17 | |
| 16 | 18 |
<p><%= setting_check_box :default_issue_start_date_to_creation_date %></p> |
| 17 | 19 | |
| config/locales/en.yml | ||
|---|---|---|
| 497 | 497 |
setting_gantt_items_limit: Maximum number of items displayed on the gantt chart |
| 498 | 498 |
setting_gantt_months_limit: Maximum number of months displayed on the gantt chart |
| 499 | 499 |
setting_issue_group_assignment: Allow issue assignment to groups |
| 500 |
setting_principal_display_format: Assignee list display format |
|
| 500 | 501 |
setting_default_issue_start_date_to_creation_date: Use current date as start date for new issues |
| 501 | 502 |
setting_commit_cross_project_ref: Allow issues of all the other projects to be referenced and fixed |
| 502 | 503 |
setting_unsubscribe: Allow users to delete their own account |
| ... | ... | |
| 1172 | 1173 |
label_edited: Edited |
| 1173 | 1174 |
label_time_by_author: "%{time} by %{author}"
|
| 1174 | 1175 |
label_involved_principals: Author / Previous assignee |
| 1176 |
label_principal_display_format_users_then_groups: Users then groups |
|
| 1177 |
label_principal_display_format_groups_then_users: Groups then users |
|
| 1175 | 1178 |
label_progressbar: Progress bar |
| 1176 | 1179 |
label_oauth_permission_admin: Administrate this Redmine |
| 1177 | 1180 |
label_oauth_admin_access: Administration |
| config/settings.yml | ||
|---|---|---|
| 196 | 196 |
default: 1 |
| 197 | 197 |
issue_group_assignment: |
| 198 | 198 |
default: 0 |
| 199 |
principal_display_format: |
|
| 200 |
default: users_then_groups |
|
| 199 | 201 |
default_issue_start_date_to_creation_date: |
| 200 | 202 |
default: 0 |
| 201 | 203 |
notified_events: |
| test/functional/issues_controller_test.rb | ||
|---|---|---|
| 4335 | 4335 |
assert_equal group, issue.assigned_to |
| 4336 | 4336 |
end |
| 4337 | 4337 | |
| 4338 |
def test_new_should_render_groups_before_users_in_assignee_select_when_configured |
|
| 4339 |
group = Group.find(11) |
|
| 4340 |
project = Project.find(1) |
|
| 4341 |
project.members << Member.new(:principal => group, :roles => [Role.givable.first]) |
|
| 4342 | ||
| 4343 |
with_settings :issue_group_assignment => '1', :principal_display_format => 'groups_then_users' do |
|
| 4344 |
@request.session[:user_id] = 2 |
|
| 4345 |
get :new, :params => {:project_id => project.id}
|
|
| 4346 |
assert_response :success |
|
| 4347 |
end |
|
| 4348 | ||
| 4349 |
assert_select 'select[name=?]', 'issue[assigned_to_id]' do |
|
| 4350 |
assert_select %(optgroup:nth-of-type(1)[label="#{l(:label_group_plural)}"]) do
|
|
| 4351 |
assert_select 'option[value=?]', group.id.to_s |
|
| 4352 |
end |
|
| 4353 |
assert_select %(optgroup:nth-of-type(2)[label="#{l(:label_user_plural)}"])
|
|
| 4354 |
end |
|
| 4355 |
end |
|
| 4356 | ||
| 4338 | 4357 |
def test_post_create_without_start_date_and_default_start_date_is_not_creation_date |
| 4339 | 4358 |
with_settings :default_issue_start_date_to_creation_date => 0 do |
| 4340 | 4359 |
@request.session[:user_id] = 2 |
| test/helpers/application_helper_test.rb | ||
|---|---|---|
| 1937 | 1937 |
end |
| 1938 | 1938 |
end |
| 1939 | 1939 | |
| 1940 |
def test_principals_options_for_select_with_users_and_groups_with_groups_then_users |
|
| 1941 |
User.current = nil |
|
| 1942 |
set_language_if_valid 'en' |
|
| 1943 |
principals = [User.find(2), Group.find(11), User.find(4), Group.find(10)] |
|
| 1944 | ||
| 1945 |
with_settings :principal_display_format => 'groups_then_users' do |
|
| 1946 |
result = principals_options_for_select(principals) |
|
| 1947 | ||
| 1948 |
assert_select_in result, 'optgroup:nth-of-type(1)[label="Groups"]' do |
|
| 1949 |
assert_select 'option[value="10"]', text: 'A Team' |
|
| 1950 |
assert_select 'option[value="11"]', text: 'B Team' |
|
| 1951 |
end |
|
| 1952 |
assert_select_in result, 'optgroup:nth-of-type(2)[label="Users"]' do |
|
| 1953 |
assert_select 'option[value="2"]', text: 'John Smith' |
|
| 1954 |
assert_select 'option[value="4"]', text: 'Robert Hill' |
|
| 1955 |
end |
|
| 1956 |
end |
|
| 1957 |
end |
|
| 1958 | ||
| 1940 | 1959 |
def test_principals_options_for_select_with_empty_collection |
| 1941 | 1960 |
assert_equal '', principals_options_for_select([]) |
| 1942 | 1961 |
end |
- « Previous
- 1
- 2
- 3
- 4
- Next »