]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-3416 Add possibility to have a title on the time machine widget
authorFabrice Bellingard <bellingard@gmail.com>
Fri, 22 Jun 2012 16:11:12 +0000 (18:11 +0200)
committerFabrice Bellingard <bellingard@gmail.com>
Fri, 22 Jun 2012 16:11:12 +0000 (18:11 +0200)
plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/widgets/TimeMachineWidget.java
plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/time_machine.html.erb

index 73c6dd8848b0531980f5b5ddf3548938712125b3..47f2f63c562c86161f7d68a387c4ed834aed7d8d 100644 (file)
@@ -26,23 +26,22 @@ import org.sonar.api.web.WidgetProperties;
 import org.sonar.api.web.WidgetProperty;
 import org.sonar.api.web.WidgetPropertyType;
 
-@WidgetCategory({ "History" })
-@WidgetProperties(
-    {
-        @WidgetProperty(key = "numberOfColumns", type = WidgetPropertyType.INTEGER, defaultValue = "3"),
-        @WidgetProperty(key = "displaySparkLine", type = WidgetPropertyType.BOOLEAN),
-        @WidgetProperty(key = "metric1", type = WidgetPropertyType.METRIC, defaultValue = "ncloc"),
-        @WidgetProperty(key = "metric2", type = WidgetPropertyType.METRIC),
-        @WidgetProperty(key = "metric3", type = WidgetPropertyType.METRIC),
-        @WidgetProperty(key = "metric4", type = WidgetPropertyType.METRIC),
-        @WidgetProperty(key = "metric5", type = WidgetPropertyType.METRIC),
-        @WidgetProperty(key = "metric6", type = WidgetPropertyType.METRIC),
-        @WidgetProperty(key = "metric7", type = WidgetPropertyType.METRIC),
-        @WidgetProperty(key = "metric8", type = WidgetPropertyType.METRIC),
-        @WidgetProperty(key = "metric9", type = WidgetPropertyType.METRIC),
-        @WidgetProperty(key = "metric10", type = WidgetPropertyType.METRIC)
-    }
-)
+@WidgetCategory({"History"})
+@WidgetProperties({
+  @WidgetProperty(key = "title", type = WidgetPropertyType.STRING),
+  @WidgetProperty(key = "numberOfColumns", type = WidgetPropertyType.INTEGER, defaultValue = "3"),
+  @WidgetProperty(key = "displaySparkLine", type = WidgetPropertyType.BOOLEAN),
+  @WidgetProperty(key = "metric1", type = WidgetPropertyType.METRIC, defaultValue = "ncloc"),
+  @WidgetProperty(key = "metric2", type = WidgetPropertyType.METRIC),
+  @WidgetProperty(key = "metric3", type = WidgetPropertyType.METRIC),
+  @WidgetProperty(key = "metric4", type = WidgetPropertyType.METRIC),
+  @WidgetProperty(key = "metric5", type = WidgetPropertyType.METRIC),
+  @WidgetProperty(key = "metric6", type = WidgetPropertyType.METRIC),
+  @WidgetProperty(key = "metric7", type = WidgetPropertyType.METRIC),
+  @WidgetProperty(key = "metric8", type = WidgetPropertyType.METRIC),
+  @WidgetProperty(key = "metric9", type = WidgetPropertyType.METRIC),
+  @WidgetProperty(key = "metric10", type = WidgetPropertyType.METRIC)
+})
 public class TimeMachineWidget extends AbstractRubyTemplate implements RubyRailsWidget {
   public String getId() {
     return "time_machine";
@@ -56,4 +55,4 @@ public class TimeMachineWidget extends AbstractRubyTemplate implements RubyRails
   protected String getTemplatePath() {
     return "/org/sonar/plugins/core/widgets/time_machine.html.erb";
   }
-}
\ No newline at end of file
+}
index 9a9b8ee12e432cbb8331a28c0f05db8c751bf582..3c00988eae91b1f93441282e4504adaa3123dd85 100644 (file)
    display_sparkline = !sparkline_urls_by_row.empty?
 %>
 
+<% if widget_properties["title"] %>
+  <div style="position: absolute">
+    <h3><%= h(widget_properties["title"]) -%></h3>
+  </div>
+<% end %>
+
 <div style="overflow: auto;font-size: 12px;padding: 1px;">
   <table class="table table-bordered">