From: Simon Brandhof Date: Tue, 7 Feb 2012 16:04:02 +0000 (+0100) Subject: SONAR-2069 fix path to treemap widget + minor refactoring X-Git-Tag: 2.14~151 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=72caee0b94b9c6955dd46925c2f5145d9924872b;p=sonarqube.git SONAR-2069 fix path to treemap widget + minor refactoring --- diff --git a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/widgets/TreemapWidget.java b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/widgets/TreemapWidget.java index 733e0a07780..b7b6640c325 100644 --- a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/widgets/TreemapWidget.java +++ b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/widgets/TreemapWidget.java @@ -39,6 +39,6 @@ public class TreemapWidget extends AbstractRubyTemplate implements RubyRailsWidg @Override protected String getTemplatePath() { - return "/Users/sbrandhof/projects/github/sonar/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/treemap.html.erb"; + return "/org/sonar/plugins/core/widgets/treemap.html.erb"; } } \ No newline at end of file diff --git a/sonar-server/src/main/webapp/WEB-INF/app/controllers/treemap_controller.rb b/sonar-server/src/main/webapp/WEB-INF/app/controllers/treemap_controller.rb index 9288782b57b..1d124172737 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/controllers/treemap_controller.rb +++ b/sonar-server/src/main/webapp/WEB-INF/app/controllers/treemap_controller.rb @@ -39,16 +39,14 @@ class TreemapController < ApplicationController color_metric=(params[:color_metric].present? ? Metric.by_key(params[:color_metric]) : nil) - resource = nil - if params[:resource] - resource = Project.by_key(params[:resource]) - bad_request('Unknown resource: ' + params[:resource]) unless resource - access_denied unless has_role?(:user, resource) - end + resource = Project.by_key(params[:resource]) + bad_request('Unknown resource: ' + params[:resource]) unless resource + bad_request('Data not available') unless resource.last_snapshot + access_denied unless has_role?(:user, resource) treemap = Sonar::Treemap.new(html_id, size_metric, width.to_i, height.to_i, { :color_metric => color_metric, - :root_snapshot => (resource ? resource.last_snapshot : nil), + :root_snapshot => resource.last_snapshot, :period_index => params[:period_index].to_i, :browsable => true }) diff --git a/sonar-server/src/main/webapp/WEB-INF/app/models/sonar/treemap.rb b/sonar-server/src/main/webapp/WEB-INF/app/models/sonar/treemap.rb index 6352a9a283b..7571409b52b 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/models/sonar/treemap.rb +++ b/sonar-server/src/main/webapp/WEB-INF/app/models/sonar/treemap.rb @@ -148,7 +148,7 @@ class Sonar::HtmlOutput < Treemap::HtmlOutput return "" if node.bounds.nil? html = '' - html += "