summaryrefslogtreecommitdiffstats
path: root/sonar-server
diff options
context:
space:
mode:
authorFabrice Bellingard <bellingard@gmail.com>2011-04-07 18:58:26 +0200
committerFabrice Bellingard <bellingard@gmail.com>2011-04-20 08:49:57 +0200
commit83216f69146cc4a0ab71fb7b4883062bc74c3872 (patch)
treea0bfe738aa9b900e3c8bdb45867dff745e88cfa7 /sonar-server
parent5e68322598aaeda5a54025b20b1b2ee5f1a3fa02 (diff)
downloadsonarqube-83216f69146cc4a0ab71fb7b4883062bc74c3872.tar.gz
sonarqube-83216f69146cc4a0ab71fb7b4883062bc74c3872.zip
[SONAR-1973] Adds select box for severity
Diffstat (limited to 'sonar-server')
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/app/controllers/reviews_controller.rb1
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/app/models/review.rb21
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/app/views/reviews/_form.html.erb3
3 files changed, 24 insertions, 1 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 93e3f46137d..91e0a489f6d 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
@@ -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"
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/models/review.rb b/sonar-server/src/main/webapp/WEB-INF/app/models/review.rb
index bdaaa65e512..13ee58b80fe 100644
--- a/sonar-server/src/main/webapp/WEB-INF/app/models/review.rb
+++ b/sonar-server/src/main/webapp/WEB-INF/app/models/review.rb
@@ -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
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/reviews/_form.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/reviews/_form.html.erb
index 0cd174a4d7c..ffd94f09f46 100644
--- a/sonar-server/src/main/webapp/WEB-INF/app/views/reviews/_form.html.erb
+++ b/sonar-server/src/main/webapp/WEB-INF/app/views/reviews/_form.html.erb
@@ -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/>