]> source.dussan.org Git - sonarqube.git/commitdiff
ReviewData changed into ReviewComment : OK
authorFabrice Bellingard <bellingard@gmail.com>
Wed, 6 Apr 2011 12:18:22 +0000 (14:18 +0200)
committerFabrice Bellingard <bellingard@gmail.com>
Wed, 20 Apr 2011 06:49:56 +0000 (08:49 +0200)
sonar-server/src/main/webapp/WEB-INF/app/controllers/resource_controller.rb
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/models/review_comment.rb [new file with mode: 0644]
sonar-server/src/main/webapp/WEB-INF/app/models/review_data.rb [deleted file]
sonar-server/src/main/webapp/WEB-INF/app/views/reviews/_form.html.erb
sonar-server/src/main/webapp/WEB-INF/app/views/reviews/_view.html.erb
sonar-server/src/main/webapp/WEB-INF/db/migrate/190_create_review.rb

index 41eb70554b74f7a23a351ada35083435a94ac57e..6f491007194745ff10a7d41793a17299bdd6db0a 100644 (file)
@@ -195,7 +195,7 @@ class ResourceController < ApplicationController
       end
     end
 
-    RuleFailure.find(:all, :include => ['rule', 'reviews', { 'reviews' => 'review_data' } ], :conditions => [conditions] + values, :order => 'failure_level DESC').each do |violation|
+    RuleFailure.find(:all, :include => ['rule', 'reviews' ], :conditions => [conditions] + values, :order => 'failure_level DESC').each do |violation|
       # sorted by severity => from blocker to info
       if violation.line && violation.line>0 && @lines
         @lines[violation.line-1].add_violation(violation)
index e78b99580be52514029c3cb32f32ecb295842922..36e2c12a22c291fcba72ac29bb3c1956617bb52b 100644 (file)
@@ -29,10 +29,10 @@ class ReviewsController < ApplicationController
          @review = Review.new
          @review.rule_failure_id = params[:violation_id]
          @review.user = current_user
-         @review_data = ReviewData.new
-         @review_data.user = current_user
-         @review_data.review = @review
-         @review_data.review_text = "Enter your review here"
+         @review_comment = ReviewComment.new
+         @review_comment.user = current_user
+         @review_comment.review = @review
+         @review_comment.review_text = "Enter your review here"
          render "_form", :layout => false
        end
        
@@ -40,11 +40,11 @@ class ReviewsController < ApplicationController
          review = Review.new(params[:review])
          review.user = current_user
          review.save
-      review_data = ReviewData.new(params[:review_data])
-         review_data.user = current_user
-         review_data.review_id = review.id
-         review_data.save
-         #render "_view", :layout => false
+      review_comment = ReviewComment.new(params[:review_comment])
+         review_comment.user = current_user
+         review_comment.review_id = review.id
+         review_comment.save
+         render "create", :layout => false
        end
        
        def cancel_create
index eea61dffc9cf1b560cd6098342b2f644a47e6588..661227a8fba40d011ea1f04435e21c8e2739e6f9 100644 (file)
@@ -21,7 +21,7 @@ class Review < ActiveRecord::Base
   belongs_to :user
   belongs_to :rule_failure
   belongs_to :resource, :class_name => 'Project', :foreign_key => 'resource_id'
-  has_many :review_data, :order => "created_at", :dependent => :destroy
+  has_many :review_comments, :order => "created_at", :dependent => :destroy
   validates_presence_of :user
   validates_presence_of :review_type
   validates_presence_of :status
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/models/review_comment.rb b/sonar-server/src/main/webapp/WEB-INF/app/models/review_comment.rb
new file mode 100644 (file)
index 0000000..d763ae2
--- /dev/null
@@ -0,0 +1,27 @@
+#
+# Sonar, entreprise quality control tool.
+# Copyright (C) 2008-2011 SonarSource
+# mailto:contact AT sonarsource DOT com
+#
+# Sonar is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 3 of the License, or (at your option) any later version.
+#
+# Sonar is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with Sonar; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02
+#
+class ReviewComment < ActiveRecord::Base
+  belongs_to :user
+  belongs_to :review
+  validates_presence_of :user
+  validates_presence_of :review
+  validates_length_of :review_text, :minimum => 1, :too_short => "Your review cannot be empty."
+
+end
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/models/review_data.rb b/sonar-server/src/main/webapp/WEB-INF/app/models/review_data.rb
deleted file mode 100644 (file)
index a0b250e..0000000
+++ /dev/null
@@ -1,29 +0,0 @@
-#
-# Sonar, entreprise quality control tool.
-# Copyright (C) 2008-2011 SonarSource
-# mailto:contact AT sonarsource DOT com
-#
-# Sonar is free software; you can redistribute it and/or
-# modify it under the terms of the GNU Lesser General Public
-# License as published by the Free Software Foundation; either
-# version 3 of the License, or (at your option) any later version.
-#
-# Sonar is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-# Lesser General Public License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public
-# License along with Sonar; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02
-#
-class ReviewData < ActiveRecord::Base
-  set_table_name :review_data
-
-  belongs_to :user
-  belongs_to :review
-  validates_presence_of :user
-  validates_presence_of :review
-  validates_length_of :review_text, :minimum => 1, :too_short => "Your review cannot be empty."
-
-end
index b26e64c846ab3606bfb36f8ec852d46f9491a698..334699da652b698a8cdd5baebf26955145716568 100644 (file)
@@ -12,7 +12,7 @@
       <br/>
       Comment:
       <br/>
-      <%= text_area :review_data, :review_text, :rows => 10 %>
+      <%= text_area :review_comment, :review_text, :rows => 10 %>
       <br/>
       <%= submit_to_remote 'create_btn', 'Create review', 
                      :url => { :action => 'create', :id => @review.id },
index 1541b84399b3a4a3a95149699cb2cc43c1d87766..32dc6c4ed7bbf4070b2d82c58d4ab8cf1a74a333 100644 (file)
@@ -1,21 +1,19 @@
 <div>
-      Review Id: <%= review.id -%>
+      User name: <%= h(review.user.name) -%>
       <br/>
-      Review Id: <%= review.user.name -%>
+      Status: <%= h(review.status) -%>
       <br/>
-      Review type: <%= review.review_type -%>
+      Severity: <%= h(review.severity) -%>
       <br/>
-      Status: <%= review.status -%>
-      <br/>
-      Severity: <%= review.severity -%>
-      <br/>
-      External Link: <%= review.external_link -%>
+      External Link: <%= h(review.external_link) -%>
       <br/>
       
-                 <% unless review.review_data.blank? 
-                      review.review_data.each do |review_data|
+                 <% unless review.review_comments.blank? 
+                      review.review_comments.each do |review_comment|
                  %>
-                   Comment: <%= review_data.review_text -%>
+                   <%= l review_comment.created_at -%>, by <%= h(review_comment.user.name) -%>
+                   ยป 
+                   <%= h(review_comment.review_text) -%>
             <br/>
                  <% 
                       end
index 378b69db9683cecd54542a9fefb406b4751a91a7..c6c7d764e78cbd482a03f77f2486c69b7b44a643 100644 (file)
@@ -36,7 +36,7 @@ class CreateReview < ActiveRecord::Migration
       t.column 'resource_line',        :integer,       :null => true      
     end
     
-    create_table 'review_data' do |t|
+    create_table 'review_comments' do |t|
       t.column 'created_at',           :datetime
       t.column 'review_id',            :integer
       t.column 'user_id',                      :integer,       :null => true