Parent: [042431] (diff)

Child: [ce5ad5] (diff)

Download this file

project.scala.html    97 lines (80 with data), 3.7 kB

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
@(project: org.ossmeter.repository.model.Project)
@import org.ossmeter.repository.model.MetricProviderType
@import org.ossmeter.repository.model.eclipse.EclipseProject
@main(project.getName() + " | OSSMETER") {
<section id="projectheader" class="row">
<div class="span8">
<!--img src="http://eclipse.org/epsilon/img/slideshow/images/epsilon.png" style="float:left; height:50px;"/--><h1>@project.getName()</h1>
<p>@project.getDescription()</p>
</div>
<!-- </section>
<section id="summary" style="border:1px solid #eee; padding:10px;font-size:10pt"> -->
<div class="span4">
<h3>Summary</h3>
<!--p>born: <span class="card-title">@project.getYear()</span></p>
<p>active: <span class="card-title">@if(!project.getActive()) { No } Yes</span></p-->
@if(project.isInstanceOf[EclipseProject]) {
<p><i class="icon-home"></i> <span class="card-title">Eclipse Foundation project</span></p>
<!--p>status: <span class="card-title">@project.asInstanceOf[EclipseProject].getStatus()</span></p-->
<p><i class="icon-user"></i> <span class="card-title">@project.asInstanceOf[EclipseProject].getCommitters().length committers</span></p>
<p class="url"><i class="icon-globe"></i> <a href="@project.asInstanceOf[EclipseProject].getHomePage()">Website</a></p>
}
</div>
</section>
<section id="metrics">
<h3>Metrics</h3>
<i class="icon-th-large"></i> &nbsp;<i class="icon-th-list"></i>
</section>
<script type="text/javascript" src="https://www.google.com/jsapi"></script>
<script>
// Initialise
google.load('visualization', '1.0', {'packages':['corechart']});
google.setOnLoadCallback(loadInitialMetrics);
var data;
var containerId = 0;
function loadInitialMetrics() {
var mps = [@for(metric <- project.getMetricProviderData()) {@if(metric.getType().equals(MetricProviderType.HISTORIC)){ "@metric.getMetricProviderId()", }}];
// FIXME: This is here for debug only
// mps = ["totalloc","totalloc"]
for (mp in mps) {
createContainerAndLoadMetric(mps[mp]);
}
}
function createContainerAndLoadMetric(metricId) {
var contId = "metric-container-" + containerId;
containerId++;
$("#metrics").append('<article id="' + contId + '"class="metric-container row"><div class="span4"><h4 id="metric-'+contId+'-name"></h4><p id="metric-'+contId+'-summary"></p></div><div class="span8" id="'+contId+'-viz"><img src="@routes.Assets.at("images/loading.gif")"/></div></article>');
loadMetric(metricId, contId);
}
function loadMetric(metricId,contId) {
$.get("@project.getShortName()/m/"+metricId,
function (data, textStatus, jqXHR) {
$("#metric-"+contId+"-name").text(data.friendlyName);
$("#metric-"+contId+"-summary").text(data.summary);
var options = data.options;
options.fontName = "Helvetica";
options.lineWidth = 2;
options.width = "90%";
options.height = 200;
options.legend = {position:"in", textStyle : {color : "#bbb"}};
options.hAxis.baselineColor = '#ccc';
options.hAxis.textStyle = {color : '#ccc'};
options.hAxis.gridlines = {color : '#fff'};
options.hAxis.titleTextStyle = {color : "#aaa"};
options.vAxis.baselineColor = '#ccc';
options.vAxis.textStyle = {color : '#ccc'};
options.vAxis.gridlines = {color : '#fff'};
options.vAxis.titleTextStyle = {color : "#aaa"};
// Create and draw chart wrapper
var wrapper = new google.visualization.ChartWrapper({
chartType: data.chartType,
dataTable: data.datatable,
options: options,
containerId: contId+"-viz"
});
wrapper.draw();
},
"json");
}
</script>
}