From 36297a74b2cf6982d126e009ba92c23025e04ba1 Mon Sep 17 00:00:00 2001 From: Fabrice Bellingard Date: Tue, 24 May 2011 18:03:33 +0200 Subject: [PATCH] SONAR-2443 Improve the assignee select-box in the resource viewer For: - creating a review - assigning a review --- .../app/controllers/reviews_controller.rb | 16 ---------------- .../app/views/autocomplete/_text_field.html.erb | 2 +- .../app/views/resource/_violation.html.erb | 1 - .../app/views/reviews/_assign_form.html.erb | 13 +++++++++---- .../reviews/_violation_assign_form.html.erb | 13 +++++++++---- .../reviews/_violation_comment_form.html.erb | 12 ++++++++---- .../src/main/webapp/stylesheets/style.css | 1 + 7 files changed, 28 insertions(+), 30 deletions(-) diff --git a/sonar-server/src/main/webapp/WEB-INF/app/controllers/reviews_controller.rb b/sonar-server/src/main/webapp/WEB-INF/app/controllers/reviews_controller.rb index 8ab6f3a2f74..742b81c7d2f 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/controllers/reviews_controller.rb +++ b/sonar-server/src/main/webapp/WEB-INF/app/controllers/reviews_controller.rb @@ -61,7 +61,6 @@ class ReviewsController < ApplicationController # GET def assign_form - @user_options = options_for_users() render :partial => "assign_form" end @@ -163,7 +162,6 @@ class ReviewsController < ApplicationController # GET def violation_assign_form - @user_options = options_for_users() render :partial => "violation_assign_form" end @@ -220,7 +218,6 @@ class ReviewsController < ApplicationController if !params[:comment_id].blank? && @violation.review @comment = @violation.review.comments.find(params[:comment_id]) end - @user_options = [["Unassigned", ""]] + options_for_users render :partial => 'reviews/violation_comment_form' end @@ -269,7 +266,6 @@ class ReviewsController < ApplicationController private def init_params - @user_names = [["Any", ""]] + options_for_users default_user = (current_user ? current_user.id : '') @assignee_id = params[:assignee_id] || default_user @author_id = params[:author_id] || '' @@ -281,18 +277,6 @@ class ReviewsController < ApplicationController @asc = params[:asc] == "true" end - def options_for_users - options=[] - User.find( :all ).each do |user| - username = user.name - if current_user && current_user.id == user.id - username = "Me (" + user.name + ")" - end - options<<[username, user.id.to_s] - end - options - end - def filter_any(array) if array && array.size>1 && array.include?("") array=[""] diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/autocomplete/_text_field.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/autocomplete/_text_field.html.erb index 393007219de..5f37632ba08 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/views/autocomplete/_text_field.html.erb +++ b/sonar-server/src/main/webapp/WEB-INF/app/views/autocomplete/_text_field.html.erb @@ -1,4 +1,4 @@ - +