From d1a65e8c6cd5c5f3893e706b44e0ae9b7d68702b Mon Sep 17 00:00:00 2001 From: Simon Brandhof Date: Wed, 5 Dec 2012 17:28:37 +0100 Subject: [PATCH] Fix treemaps on IE8 --- .../widgets/MeasureFilterTreemapWidget.java | 2 +- .../WEB-INF/app/helpers/measures_helper.rb | 4 +- .../main/webapp/javascripts/application.js | 58 ++++++++----------- .../src/main/webapp/stylesheets/layout.css | 1 - 4 files changed, 29 insertions(+), 36 deletions(-) diff --git a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/widgets/MeasureFilterTreemapWidget.java b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/widgets/MeasureFilterTreemapWidget.java index e6e4af46bff..ff41d441dca 100644 --- a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/widgets/MeasureFilterTreemapWidget.java +++ b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/widgets/MeasureFilterTreemapWidget.java @@ -34,7 +34,7 @@ import static org.sonar.api.web.WidgetScope.GLOBAL; @WidgetProperties({ @WidgetProperty(key = MeasureFilterTreemapWidget.FILTER_PROPERTY, type = WidgetPropertyType.FILTER, optional = false), @WidgetProperty(key = MeasureFilterTreemapWidget.SIZE_METRIC_PROPERTY, type = WidgetPropertyType.METRIC, optional = true), - @WidgetProperty(key = MeasureFilterTreemapWidget.COLOR_METRIC_PROPERTY, type = WidgetPropertyType.METRIC, optional = true) + @WidgetProperty(key = MeasureFilterTreemapWidget.COLOR_METRIC_PROPERTY, type = WidgetPropertyType.METRIC, optional = true, options = "type:PERCENT") } ) public class MeasureFilterTreemapWidget extends AbstractRubyTemplate implements RubyRailsWidget { diff --git a/sonar-server/src/main/webapp/WEB-INF/app/helpers/measures_helper.rb b/sonar-server/src/main/webapp/WEB-INF/app/helpers/measures_helper.rb index 5c8ceb97160..accc20e7455 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/helpers/measures_helper.rb +++ b/sonar-server/src/main/webapp/WEB-INF/app/helpers/measures_helper.rb @@ -39,8 +39,10 @@ module MeasuresHelper measure = result.measure(column.metric) if column.period format_variation(measure, :index => column.period, :style => 'light') - else + elsif column.metric.numeric? format_measure(measure) + trend_icon(measure, :empty => true) + else + format_measure(measure) end elsif column.key=='name' diff --git a/sonar-server/src/main/webapp/javascripts/application.js b/sonar-server/src/main/webapp/javascripts/application.js index ccb3314dd39..8cf2fb24167 100644 --- a/sonar-server/src/main/webapp/javascripts/application.js +++ b/sonar-server/src/main/webapp/javascripts/application.js @@ -163,20 +163,10 @@ var Treemap = function (id, sizeMetric, colorMetric) { this.colorMetric = colorMetric; this.breadcrumb = []; treemaps[id] = this; - this.rootNode().height(this.rootNode().width() * 0.6); + this.rootNode().height(this.rootNode().width() * 0.55); this.initNodes(); }; -Treemap.prototype.changeSizeMetric = function (metric) { - this.sizeMetric = metric; - this.load(); - return false; -}; -Treemap.prototype.changeColorMetric = function (metric) { - this.colorMetric = metric; - this.load(); - return false; -}; Treemap.prototype.currentContext = function () { if (this.breadcrumb.length > 0) { return this.breadcrumb[this.breadcrumb.length - 1]; @@ -215,31 +205,33 @@ Treemap.prototype.initNodes = function () { }); }); $j('#tm-' + this.id).find('[rid]').each(function (index) { - this.on("contextmenu", function (event) { - event.preventDefault(); - // right click - if (self.breadcrumb.length > 1) { - self.breadcrumb.pop(); + this.on("contextmenu", function (event) { + event.stopPropagation(); + event.preventDefault(); + // right click + if (self.breadcrumb.length > 1) { + self.breadcrumb.pop(); + self.load(); + } else { + $j("#tm-loading-" + self.id).show(); + location.reload(); + } + return false; + }); + + this.on("click", function (event) { + var source = $j(this); + var rid = source.attr('rid'); + var has_leaves = !!(source.attr('l')); + if (!has_leaves) { + var context = new TreemapContext(rid, source.text()); + self.breadcrumb.push(context); self.load(); - } else { - location.reload(); } - return false; - }); - this.on("click", function (event) { - var source = $j(this); - var rid = source.attr('rid'); - var has_leaves = !!(source.attr('l')); - if (!has_leaves) { - var context = new TreemapContext(rid, source.text()); - self.breadcrumb.push(context); - self.load(); - } - } - ); - } - ); + } + ) + }); }; (function ($j) { diff --git a/sonar-server/src/main/webapp/stylesheets/layout.css b/sonar-server/src/main/webapp/stylesheets/layout.css index ad42bfad1b0..e65d973ceee 100644 --- a/sonar-server/src/main/webapp/stylesheets/layout.css +++ b/sonar-server/src/main/webapp/stylesheets/layout.css @@ -275,7 +275,6 @@ ul.sidebar select, ul.sidebar input { } .page-split-right { - position: relative; display: block; margin: 0; vertical-align: top; -- 2.39.5