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)
@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
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
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
--- /dev/null
+#
+# 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
+++ /dev/null
-#
-# 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
<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 },
<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
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