]> source.dussan.org Git - sonarqube.git/commitdiff
[SONAR-1973] Adds select box for severity
authorFabrice Bellingard <bellingard@gmail.com>
Thu, 7 Apr 2011 16:58:26 +0000 (18:58 +0200)
committerFabrice Bellingard <bellingard@gmail.com>
Wed, 20 Apr 2011 06:49:57 +0000 (08:49 +0200)
sonar-server/src/main/webapp/WEB-INF/app/controllers/reviews_controller.rb
sonar-server/src/main/webapp/WEB-INF/app/models/review.rb
sonar-server/src/main/webapp/WEB-INF/app/views/reviews/_form.html.erb

index 93e3f46137d3b2525c7646ac599677aad837adb8..91e0a489f6d35e8250cf373a4bc02ffe8552c4e0 100644 (file)
@@ -33,6 +33,7 @@ class ReviewsController < ApplicationController
          @review = Review.new
          @review.rule_failure_id = params[:violation_id]
          @review.user = current_user
+         @review.severity = Review.default_severity
          @review_comment = ReviewComment.new
          @review_comment.review_text = ""
          render :partial => "form"
index bdaaa65e512dcae1479414abd05fe983ad04d4d6..13ee58b80feedb7b34a580ddf0a7d6fd4f5ca584 100644 (file)
@@ -26,4 +26,25 @@ class Review < ActiveRecord::Base
   validates_presence_of :review_type, :message => "can't be empty"
   validates_presence_of :status, :message => "can't be empty"
 
+  INFO = "info"
+  MINOR = "minor"
+  MAJOR = "major"
+  CRITICAL = "critical"
+  BLOCKER = "blocker"
+
+
+  def self.default_severity
+    return MAJOR
+  end
+  
+  def self.severity_options
+    severity_ops = []
+    severity_ops << ["Info", INFO]
+    severity_ops << ["Minor", MINOR]
+    severity_ops << ["Major", MAJOR]
+    severity_ops << ["Critical", CRITICAL]
+    severity_ops << ["Blocker", BLOCKER]
+    return severity_ops
+  end
+
 end
index 0cd174a4d7c59699bb58c48dec1763d9e5f71e06..ffd94f09f46e0b43f5f7753bc85f9ef3db38639e 100644 (file)
@@ -3,7 +3,8 @@
       <%= f.hidden_field :rule_failure_id %>
       Review made by: <%= @review.user.name -%>
       <br/>
-      Severity: <%= f.text_field :severity %>
+      Severity: 
+      <%= select_tag "review[severity]", options_for_select(Review.severity_options, @review.severity)  %>
       <br/>
       Comment:
       <br/>