diff options
6 files changed, 15 insertions, 11 deletions
diff --git a/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/reviews/reviews_per_developer.html.erb b/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/reviews/reviews_per_developer.html.erb index 4a573f3117b..ae699f45e6c 100644 --- a/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/reviews/reviews_per_developer.html.erb +++ b/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/reviews/reviews_per_developer.html.erb @@ -1,6 +1,6 @@ <% options = {} - options['statuses'] = 'OPEN,REOPENED' + options['statuses'] = "#{Review::STATUS_OPEN},#{Review::STATUS_REOPENED}" options['projects'] = @project.key if @dashboard_configuration.selected_period? from_date = dashboard_configuration.from_datetime @@ -57,8 +57,8 @@ <tr class="<%= cycle 'even', 'odd', :name => (div_id) -%>"> <td class="max-width"> <%= link_to dev.name, - :controller => "reviews", :action => "index", :statuses => ['OPEN','REOPENED'], :assignee_login => dev.login, - :projects => [@project.id], :from => from_date, :to => to_date -%> + :controller => "project_reviews", :action => "index", :statuses => "#{Review::STATUS_OPEN},#{Review::STATUS_REOPENED}", :assignees => dev.login, + :projects => @project.id, :from => from_date, :to => to_date -%> </td> <td class="nowrap"> <%= '+' if @dashboard_configuration.selected_period? -%><%= count.to_s -%> @@ -77,8 +77,8 @@ <tr class="<%= cycle 'even', 'odd', :name => (div_id) -%>"> <td class="max-width"> <%= link_to message('widget.reviews_per_developer.not_assigned'), - :controller => "reviews", :action => "index", :statuses => ['OPEN','REOPENED'], :assignee_login => '', - :projects => [@project.id], :from => from_date, :to => to_date -%> + :controller => "project_reviews", :action => "index", :statuses => "#{Review::STATUS_OPEN},#{Review::STATUS_REOPENED}", :assignees => '', + :projects => @project.id, :from => from_date, :to => to_date -%> </td> <td class="nowrap"> <%= '+' if @dashboard_configuration.selected_period? -%><%= counter_no_assignee.to_s -%> diff --git a/sonar-server/src/main/webapp/WEB-INF/app/controllers/resource_controller.rb b/sonar-server/src/main/webapp/WEB-INF/app/controllers/resource_controller.rb index b2fd5af628c..44523f2e747 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/controllers/resource_controller.rb +++ b/sonar-server/src/main/webapp/WEB-INF/app/controllers/resource_controller.rb @@ -321,7 +321,7 @@ class ResourceController < ApplicationController @global_violations=[] @expandable=(@lines!=nil) @filtered=!@expanded - @action_plans_size=ActionPlan.open_by_project_id(@snapshot.root_project_id).size + @action_plans_size=ActionPlan.count_open_for_project_id(@snapshot.root_project_id) conditions='snapshot_id=?' values=[@snapshot.id] diff --git a/sonar-server/src/main/webapp/WEB-INF/app/models/action_plan.rb b/sonar-server/src/main/webapp/WEB-INF/app/models/action_plan.rb index 9e72e9b3b3b..7be4ba432a5 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/models/action_plan.rb +++ b/sonar-server/src/main/webapp/WEB-INF/app/models/action_plan.rb @@ -36,6 +36,10 @@ class ActionPlan < ActiveRecord::Base ActionPlan.find :all, :conditions => ['status=? AND project_id=?', STATUS_OPEN, project_id], :order => :name end + def self.count_open_for_project_id(project_id) + ActionPlan.count :conditions => ['status=? AND project_id=?', STATUS_OPEN, project_id] + end + def user @user ||= begin diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/project_reviews/_review.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/project_reviews/_review.html.erb index 66832ee83dd..8fc18e84b4f 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/views/project_reviews/_review.html.erb +++ b/sonar-server/src/main/webapp/WEB-INF/app/views/project_reviews/_review.html.erb @@ -39,7 +39,7 @@ :update => "actionForm", :complete => "$('actionButtons').remove();$('actionForm').show();$('selectSeverity').focus();" -%> - <% if ActionPlan.open_by_project_id(@review.project_id).size>0 %> + <% if ActionPlan.count_open_for_project_id(@review.project_id)>0 %> <%= button_to_remote message('reviews.link_to_action_plan'), :url => {:controller => "project_reviews", :action => "action_plan_form", :id => review.id}, :update => "actionForm", 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 b58a030aa0d..e49e5c0287a 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 @@ -5,7 +5,7 @@ <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> + <span class="review_permalink"><%= link_to "Review #"+violation.review.id.to_s, :controller => "project_reviews", :action => "view", :id => violation.review.id -%></span> </div> <% end %> @@ -75,7 +75,7 @@ <%= button_to_function message('reviews.change_severity'), "sCSF(#{violation.id})", :name => 'bChangeSeverity' -%> <% - @action_plans_size = ActionPlan.open_by_project_id(violation.review.project_id).size unless @action_plans_size + @action_plans_size = ActionPlan.count_open_for_project_id(violation.snapshot.root_project_id) unless @action_plans_size if @action_plans_size > 0 %> <%= button_to_function message('reviews.link_to_action_plan'), "sAPF(#{violation.id})", :name => 'bLinkActionPlan' -%> diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/reviews/_list.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/reviews/_list.html.erb index 1d0a4c81ee6..97c0e647779 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/views/reviews/_list.html.erb +++ b/sonar-server/src/main/webapp/WEB-INF/app/views/reviews/_list.html.erb @@ -55,11 +55,11 @@ <tr class="<%= cycle('even', 'odd') -%>"> <td><img src="<%= ApplicationController.root_context -%>/images/status/<%= review.status -%>.png" title="<%= message(review.status.downcase).capitalize -%>"/></td> <td> - <%= link_to h(review.id), :controller => "reviews", :action => "view", :id => review.id -%> + <%= link_to h(review.id), :controller => "project_reviews", :action => "view", :id => review.id -%> </td> <td><img src="<%= ApplicationController.root_context -%>/images/priority/<%= review.severity -%>.png" title="<%= message(review.severity.downcase).capitalize -%>"/></td> <td> - <%= link_to h(review.title), :controller => "reviews", :action => "view", :id => review.id -%> + <%= link_to h(review.title), :controller => "project_reviews", :action => "view", :id => review.id -%> <% if comment %> <div class="comment-excerpt"> <img src="<%= ApplicationController.root_context -%>/images/reviews/comment.png"/> |