From d683342a74401d5edccd16c34b96fd53975d3c79 Mon Sep 17 00:00:00 2001 From: Stas Vilchik Date: Thu, 26 Feb 2015 10:24:20 +0100 Subject: [PATCH] SONAR-6155 upgrade selection of users --- .../src/main/webapp/WEB-INF/app/helpers/application_helper.rb | 4 ++-- .../src/main/webapp/WEB-INF/app/helpers/properties_helper.rb | 3 ++- .../WEB-INF/app/views/settings/_type_USER_LOGIN.html.erb | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/helpers/application_helper.rb b/server/sonar-web/src/main/webapp/WEB-INF/app/helpers/application_helper.rb index 881b85429c9..c1eb79b9028 100644 --- a/server/sonar-web/src/main/webapp/WEB-INF/app/helpers/application_helper.rb +++ b/server/sonar-web/src/main/webapp/WEB-INF/app/helpers/application_helper.rb @@ -614,7 +614,7 @@ module ApplicationHelper def select2_tag(name, ws_url, options={}) width=options[:width]||'250px' - html_id=options[:html_id]||name + html_id=options[:html_id]||sanitize_to_id(name).gsub('.', '_') html_class=options[:html_class]||'' min_length=options[:min_length] @@ -764,7 +764,7 @@ module ApplicationHelper if user # the login is a string so it have to be surrounded by quote to be taken in account by select2 options[:selected_id]="'" + user.login + "'" - options[:selected_text]=user.name + options[:selected_text]=user.name + ' (' + user.login + ')' end select2_tag(name, ws_url, options) diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/helpers/properties_helper.rb b/server/sonar-web/src/main/webapp/WEB-INF/app/helpers/properties_helper.rb index 0ecc980b77d..55c546244d7 100644 --- a/server/sonar-web/src/main/webapp/WEB-INF/app/helpers/properties_helper.rb +++ b/server/sonar-web/src/main/webapp/WEB-INF/app/helpers/properties_helper.rb @@ -105,7 +105,8 @@ module PropertiesHelper select_tag name, select_options, html_options when PropertyType::TYPE_USER_LOGIN - text_field_tag name, value, {:size => options[:size] || 50}.update(html_options) + user = User.find_active_by_login(value) + user_select_tag name, {:size => options[:size] || 50, :selected_user => user, :allow_empty => true, :include_choices => [ ['', message('none')] ] }.update(html_options) else hidden_field_tag id, html_options diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/views/settings/_type_USER_LOGIN.html.erb b/server/sonar-web/src/main/webapp/WEB-INF/app/views/settings/_type_USER_LOGIN.html.erb index 430dc5464c9..6f94fa6a651 100644 --- a/server/sonar-web/src/main/webapp/WEB-INF/app/views/settings/_type_USER_LOGIN.html.erb +++ b/server/sonar-web/src/main/webapp/WEB-INF/app/views/settings/_type_USER_LOGIN.html.erb @@ -2,4 +2,4 @@ options = {:id => id} options[:size] = (defined? size) ? size : nil %> -<%= property_input_field(name, PropertyType::TYPE_USER_LOGIN, value, PropertiesHelper::SCREEN_SETTINGS, options) %> \ No newline at end of file +<%= property_input_field(name, PropertyType::TYPE_USER_LOGIN, value, PropertiesHelper::SCREEN_SETTINGS, options) %> -- 2.39.5