aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-server/src
diff options
context:
space:
mode:
Diffstat (limited to 'sonar-server/src')
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/app/controllers/reviews_controller.rb10
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/app/controllers/settings_controller.rb2
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/app/models/project.rb12
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/app/models/review.rb2
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/app/views/resource/_violation.html.erb2
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/app/views/reviews/_review.html.erb3
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/app/views/reviews/_show.html.erb11
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/app/views/reviews/index.html.erb6
-rw-r--r--sonar-server/src/main/webapp/stylesheets/style.css17
9 files changed, 39 insertions, 26 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 62b3f3b8759..7a69b96676c 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
@@ -53,7 +53,7 @@ class ReviewsController < ApplicationController
def show
@review = Review.find(params[:id], :include => ['project'])
if has_role?(:user, @review.project)
- render :partial => 'reviews/view'
+ render :partial => 'reviews/show'
else
render :text => "access denied"
end
@@ -76,7 +76,7 @@ class ReviewsController < ApplicationController
@review.assignee = User.find params[:assignee_id]
@review.save
- render :partial => 'reviews/view'
+ render :partial => 'reviews/show'
end
# GET
@@ -106,7 +106,7 @@ class ReviewsController < ApplicationController
@review.comments.create!(:user => current_user, :text => params[:text])
end
- render :partial => "reviews/view"
+ render :partial => "reviews/show"
end
# GET
@@ -134,7 +134,7 @@ class ReviewsController < ApplicationController
@review.comments.create(:review_text => params[:comment], :user_id => current_user.id)
end
- render :partial => "reviews/view"
+ render :partial => "reviews/show"
end
# POST
@@ -149,7 +149,7 @@ class ReviewsController < ApplicationController
comment=@review.comments.find(params[:comment_id].to_i)
comment.delete if comment
end
- render :partial => "reviews/view"
+ render :partial => "reviews/show"
end
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/controllers/settings_controller.rb b/sonar-server/src/main/webapp/WEB-INF/app/controllers/settings_controller.rb
index e7f95603788..854c5f746db 100644
--- a/sonar-server/src/main/webapp/WEB-INF/app/controllers/settings_controller.rb
+++ b/sonar-server/src/main/webapp/WEB-INF/app/controllers/settings_controller.rb
@@ -32,6 +32,8 @@ class SettingsController < ApplicationController
project=Project.by_key(params[:resource_id])
return access_denied unless is_admin?(project)
resource_id=project.id
+ else
+ return access_denied unless is_admin?
end
plugins = java_facade.getPluginsMetadata()
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/models/project.rb b/sonar-server/src/main/webapp/WEB-INF/app/models/project.rb
index 8489caea88b..9658c9dfcb3 100644
--- a/sonar-server/src/main/webapp/WEB-INF/app/models/project.rb
+++ b/sonar-server/src/main/webapp/WEB-INF/app/models/project.rb
@@ -43,6 +43,13 @@ class Project < ActiveRecord::Base
root||self
end
+ def root_project
+ @root_project ||=
+ begin
+ parent_module(self)
+ end
+ end
+
def last_snapshot
@last_snapshot ||=
begin
@@ -153,4 +160,9 @@ class Project < ActiveRecord::Base
end
chart_measures
end
+
+ def parent_module(current_module)
+ current_module.root ? parent_module(current_module.root) : current_module
+ end
+
end
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 46e97ba9c95..1f91e4abe79 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
@@ -205,7 +205,7 @@ class Review < ActiveRecord::Base
def assign_project
if self.project.nil? && self.resource
- self.project=self.resource.project
+ self.project=self.resource.root_project
end
end
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/resource/_violation.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/resource/_violation.html.erb
index 25989a7b1e0..3282a0fedee 100644
--- a/sonar-server/src/main/webapp/WEB-INF/app/views/resource/_violation.html.erb
+++ b/sonar-server/src/main/webapp/WEB-INF/app/views/resource/_violation.html.erb
@@ -2,7 +2,7 @@
<div class="violation">
<div class="vtitle">
<% if violation.review %>
- <div class="review_permalink"><span class="review_permalink"><%= link_to "Review #"+violation.review.id.to_s, :controller => "reviews", :action => "view", :id => violation.review.id -%></span></div>
+ <div style="float: right"><span class="review_permalink"><%= link_to violation.review.id.to_s, :controller => "reviews", :action => "view", :id => violation.review.id -%></span></div>
<% end %>
<%= image_tag("priority/" + violation.failure_level.to_s + '.png') -%>
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 5e8fcd7299e..79b0a2c864d 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
@@ -1,6 +1,7 @@
<div id="rev_<%= review.id -%>">
<div class="reportTitle">
- <h2>Review #<%= h(review.id.to_s) -%> - <%= h(review.title) -%></h2>
+ <div style="float: right"><span class="violation_date"><%= review.id.to_s -%></span></div>
+ <h2><%= h(review.title) -%></h2>
<% if current_user && review.status != "CLOSED" %>
<span class="actions" id="rActions">
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/reviews/_show.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/reviews/_show.html.erb
new file mode 100644
index 00000000000..b9faf2e6d30
--- /dev/null
+++ b/sonar-server/src/main/webapp/WEB-INF/app/views/reviews/_show.html.erb
@@ -0,0 +1,11 @@
+<div id="backReviewDiv" class="marginbottom10">
+ <a href="#" onclick="backReviews()">&laquo; Back to reviews</a>
+</div>
+<script>
+ if ($('reviews-search')==null) {
+ // This happens when this page results from a call made from the review permalink page
+ $('backReviewDiv').hide();
+ }
+</script>
+
+<%= render :partial => 'reviews/review', :locals => {:review => @review} -%> \ No newline at end of file
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 9946a4564f8..7bd4895f05a 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
@@ -107,11 +107,11 @@ function reviewIdFieldModified(field) {
<tr class="<%= cycle('even', 'odd') -%>">
<td><img src="<%= ApplicationController.root_context -%>/images/status/<%= review.status -%>.png" title="<%= review.status.capitalize -%>"/></td>
<td>
- <%= link_to h(review.id), :controller => "reviews", :action => "view", :id => review.id -%>
+ <%= link_to_remote( h(review.id), :update => 'review', :url => {:action => 'show', :id => review.id}, :loading => 'onReviewLoading()', :complete => "onReviewLoaded()") -%>
</td>
<td><img src="<%= ApplicationController.root_context -%>/images/priority/<%= review.severity -%>.png" title="<%= review.severity.capitalize -%>"/></td>
<td>
- <%= link_to h(review.title), :controller => "reviews", :action => "view", :id => review.id -%>
+ <%= link_to_remote(h(review.title), :update => 'review', :url => {:action => 'show', :id => review.id}, :loading => 'onReviewLoading()', :complete => "onReviewLoaded()") -%>
</td>
<td><%= review.project.name -%>
<br/><span class="note"><%= review.resource.long_name -%></span></td>
@@ -138,6 +138,8 @@ function reviewIdFieldModified(field) {
</div>
+<div id="review-loading" style="display: none"><%= image_tag 'loading.gif' -%></div>
+<div id="review" style="display: none"></div>
<script>
$('review_id').focus();
</script> \ No newline at end of file
diff --git a/sonar-server/src/main/webapp/stylesheets/style.css b/sonar-server/src/main/webapp/stylesheets/style.css
index fd11c07a403..a6a1af75d40 100644
--- a/sonar-server/src/main/webapp/stylesheets/style.css
+++ b/sonar-server/src/main/webapp/stylesheets/style.css
@@ -686,7 +686,7 @@ ul.operations li img {
div.vtitle{
background-color:#E4ECF3;
margin:0;
- padding:0 0 0 10px;
+ padding:0 10px;
line-height: 2.2em;
text-shadow: 0 1px 0 #FFF;
color:#777
@@ -706,24 +706,9 @@ span.violation_date {
color:#777;
font-size:90%;
}
-div.review_permalink {
- float: right;
- background-color: #F4F4F4;
- border-color: #CDCDCD;
- border-style: none none none solid;
- border-width: 1px;
- color: #333333;
- font-size: 12px;
- font-weight: bold;
- margin: 0;
- padding: 0 10px;
- text-shadow: 1px 1px 0 #FFFFFF;
-}
span.review_permalink a {
color:#777;
font-size:90%;
- padding: 0 0 0 20px;
- background: url('../images/zoom.png') no-repeat left;
}
span.rulename a:hover {
text-decoration: underline;