]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-6155 upgrade selection of users 123/head
authorStas Vilchik <vilchiks@gmail.com>
Thu, 26 Feb 2015 09:24:20 +0000 (10:24 +0100)
committerTeryk Bellahsene <teryk.bellahsene@sonarsource.com>
Fri, 27 Feb 2015 16:08:56 +0000 (17:08 +0100)
server/sonar-web/src/main/webapp/WEB-INF/app/helpers/application_helper.rb
server/sonar-web/src/main/webapp/WEB-INF/app/helpers/properties_helper.rb
server/sonar-web/src/main/webapp/WEB-INF/app/views/settings/_type_USER_LOGIN.html.erb

index 881b85429c94ac001ab6aba377cf5b85c5aa54ea..c1eb79b9028bd8f3d67aeef8f0c122fc99729cbd 100644 (file)
@@ -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)
index 0ecc980b77dcd3362fd1df597c63e1beb27aaae0..55c546244d7ea6f2e3cb16a741cbe0116df0f972 100644 (file)
@@ -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
index 430dc5464c9ad4253b7af19818e269de263798af..6f94fa6a65102e3d32e2d93f6ee975d0a84c4ea6 100644 (file)
@@ -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) %>