diff options
author | Fabrice Bellingard <bellingard@gmail.com> | 2011-04-27 11:06:47 +0200 |
---|---|---|
committer | Fabrice Bellingard <bellingard@gmail.com> | 2011-04-27 11:06:47 +0200 |
commit | e86b05a3cd25415544cfbf0698244fa321e7699f (patch) | |
tree | 7dcd4319938736ce9c880089309b8b2f511623a0 | |
parent | 7c5db32e248986472ae759970dd7070b63df66b2 (diff) | |
download | sonarqube-e86b05a3cd25415544cfbf0698244fa321e7699f.tar.gz sonarqube-e86b05a3cd25415544cfbf0698244fa321e7699f.zip |
SONAR-2327 Provide a new "Reviews" service
4 files changed, 32 insertions, 4 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 74311837a18..4df243f2de1 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 @@ -262,6 +262,7 @@ class ReviewsController < ApplicationController @severities = filter_any(params[:severities]) || [''] @statuses = filter_any(params[:statuses]) || [Review::STATUS_OPEN] @projects = filter_any(params[:projects]) || [''] + @id = params[:id] || "" end def options_for_users @@ -303,10 +304,23 @@ class ReviewsController < ApplicationController conditions << "assignee_id in (:assignees)" values[:assignees]=@assignees.map{|s| s.to_i} end + unless @id == "" + if is_number? @id + conditions << "id = :id" + values[:id] = @id + else + conditions << "id = :id" + values[:id] = -1 + end + end @reviews = Review.find( :all, :order => "created_at DESC", :conditions => [ conditions.join(" AND "), values] ).uniq end + def is_number?(s) + true if Float(s) rescue false + end + def has_rights_to_modify?(violation) current_user && has_role?(:user, violation.snapshot) end diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/reviews/_review.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/reviews/_review.html.erb index bc87b3a9ad1..aa13895b6ed 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/views/reviews/_review.html.erb +++ b/sonar-server/src/main/webapp/WEB-INF/app/views/reviews/_review.html.erb @@ -51,7 +51,7 @@ Created by: </td> <td class="val"> - <%= h(review.user.name) -%> on <%= l(review.created_at, :format => :long) -%> + <%= h(review.user.name) -%>, on <%= l(review.created_at, :format => :long) -%> </td> </tr> <% if review.rule %> @@ -77,7 +77,7 @@ </table> <% if review.rule_failure && review.resource_line && review.rule_failure.snapshot %> - <div class="marginbottom10"> + <div class="marginbottom10 marginleft10"> <%= snapshot_source_to_html(review.rule_failure.snapshot, {:line_range => (review.resource_line-5)..(review.resource_line+5), :highlighted_lines => [review.resource_line]}) -%> </div> <% end %> diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/reviews/index.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/reviews/index.html.erb index 6d4daf0d084..7926a401119 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/views/reviews/index.html.erb +++ b/sonar-server/src/main/webapp/WEB-INF/app/views/reviews/index.html.erb @@ -67,9 +67,18 @@ <span class="note">Assigned to</span><br/> <%= select_tag "assignees", options_for_select(@user_names, @assignees), :multiple => true, :size => 6 %> </td> - <td> + <td width="1%" nowrap> + <span class="note">Id</span><br/> + <%= text_field_tag "id", @id, :size => 10 -%> + <br/> + <br/> <br/> + <br/> + <div style="width:100%; text-align: right"> <%= submit_tag "Search", :id => 'submit_search' %> + </div> + </td> + <td> </td> </tr> </tbody> diff --git a/sonar-server/src/main/webapp/stylesheets/style.css b/sonar-server/src/main/webapp/stylesheets/style.css index 00e5cb59976..d1d5b596431 100644 --- a/sonar-server/src/main/webapp/stylesheets/style.css +++ b/sonar-server/src/main/webapp/stylesheets/style.css @@ -814,7 +814,12 @@ span.rulename a:hover { - +div#review .actions{ + visibility: hidden; +} +div#review:hover .actions{ + visibility: visible; +} div.reportTitle { background-color: #E4ECF3; color: #4B9FD5; |