remove principal transform to select2

This commit is contained in:
Alexander Meindl 2022-02-01 20:07:35 +01:00
parent 821c0ded3c
commit 467aa066bf
3 changed files with 19 additions and 6 deletions

View File

@ -28,11 +28,6 @@
multiple: true,
url: grouped_users_auto_completes_path
/= additionals_transform_to_select2 'principal',
format_state: 'formatNameWithIcon',
multiple: true,
url: grouped_principals_auto_completes_path(project_id: @project)
- if @additionals_help_items.present?
javascript:
$(function() {

View File

@ -49,7 +49,9 @@ module Additionals
def grouped_principals
scope = @project ? @project.principals : Principal.assignable
render_grouped_users_with_select2 scope, search_term: @search_term, with_me: false
render_grouped_users_with_select2 scope,
search_term: @search_term,
with_me: RedminePluginKit.true?(params[:with_me])
end
private

View File

@ -94,6 +94,22 @@ class AutoCompletesControllerTest < Additionals::ControllerTest
assert_equal 2, json.second['children'].count
end
def test_grouped_principals_with_me
get :grouped_principals,
params: { with_me: true }
assert_response :success
json = ActiveSupport::JSON.decode response.body
assert_kind_of Array, json
assert_equal 3, json.count
assert_equal 'me', json.first['id']
assert_equal 'active', json.second['text']
assert_equal 7, json.second['children'].count
assert_equal 'Groups', json.third['text']
assert_equal 2, json.third['children'].count
end
def test_grouped_users
get :grouped_users