Skip to content

Commit 3c97320

Browse files
committed
enable sorting for the classes table
1 parent abb5ae1 commit 3c97320

File tree

1 file changed

+15
-18
lines changed

1 file changed

+15
-18
lines changed

scalac-scoverage-plugin/src/main/scala/scoverage/report/ScoverageHtmlWriter.scala

Lines changed: 15 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -57,10 +57,7 @@ class ScoverageHtmlWriter(sourceDirectory: File, outputDir: File) {
5757
<title id='title'>
5858
{filename}
5959
</title>
60-
<link rel="stylesheet" href="http://netdna.bootstrapcdn.com/bootstrap/3.0.3/css/bootstrap.min.css"/>
61-
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
62-
<script src="http://netdna.bootstrapcdn.com/bootstrap/3.0.3/js/bootstrap.min.js"></script>
63-
<script src="http://cdnjs.cloudflare.com/ajax/libs/jquery.tablesorter/2.18.3/addons/pager/jquery.tablesorter.pager.min.js"></script>
60+
{plugins}
6461
<style>
6562
{css}
6663
</style>
@@ -135,21 +132,13 @@ class ScoverageHtmlWriter(sourceDirectory: File, outputDir: File) {
135132
| overflow: hidden;
136133
|}""".stripMargin
137134

138-
val tableScript = """$(document).ready(function() {$("#packages").tablesorter();});"""
139-
140135
<head>
141136
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
142137
<title id='title'>Scoverage Code Coverage</title>
143-
<link rel="stylesheet" href="http://netdna.bootstrapcdn.com/bootstrap/3.0.3/css/bootstrap.min.css"/>
144-
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
145-
<script src="http://netdna.bootstrapcdn.com/bootstrap/3.0.3/js/bootstrap.min.js"></script>
146-
<script src="http://cdnjs.cloudflare.com/ajax/libs/jquery.tablesorter/2.18.3/addons/pager/jquery.tablesorter.pager.min.js"></script>
138+
{plugins}
147139
<style>
148140
{css}
149141
</style>
150-
<script>
151-
{tableScript}
152-
</script>
153142
</head>
154143
}
155144

@@ -282,10 +271,7 @@ class ScoverageHtmlWriter(sourceDirectory: File, outputDir: File) {
282271
<title id='title'>
283272
Scoverage Code Coverage
284273
</title>
285-
<link rel="stylesheet" href="http://netdna.bootstrapcdn.com/bootstrap/3.0.3/css/bootstrap.min.css"/>
286-
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
287-
<script src="http://netdna.bootstrapcdn.com/bootstrap/3.0.3/js/bootstrap.min.js"></script>
288-
<script src="http://cdnjs.cloudflare.com/ajax/libs/jquery.tablesorter/2.18.3/addons/pager/jquery.tablesorter.pager.min.js"></script>
274+
{plugins}
289275
</head>
290276
<body style="font-family: monospace;">
291277
<table class="table table-striped" style="font-size: 13px">
@@ -314,7 +300,7 @@ class ScoverageHtmlWriter(sourceDirectory: File, outputDir: File) {
314300
}
315301

316302
def risks(coverage: Coverage, limit: Int) = {
317-
<table id="packages" class="table table-striped" style="font-size: 12px">
303+
<table class="tablesorter table table-striped" style="font-size: 12px">
318304
<thead>
319305
<tr>
320306
<th>
@@ -535,5 +521,16 @@ class ScoverageHtmlWriter(sourceDirectory: File, outputDir: File) {
535521
</tr>
536522
</table>
537523
}
524+
525+
def plugins = {
526+
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
527+
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/jquery.tablesorter/2.20.1/css/theme.default.min.css" type="text/css"/>
528+
<script src="http://cdnjs.cloudflare.com/ajax/libs/jquery.tablesorter/2.20.1/js/jquery.tablesorter.min.js"></script>
529+
<link rel="stylesheet" href="http://netdna.bootstrapcdn.com/bootstrap/3.0.3/css/bootstrap.min.css" type="text/css"/>
530+
<script src="http://netdna.bootstrapcdn.com/bootstrap/3.0.3/js/bootstrap.min.js"></script>
531+
<script type="text/javascript">
532+
{xml.Unparsed("""$(document).ready(function() {$(".tablesorter").tablesorter();});""")}
533+
</script>
534+
}
538535
}
539536

0 commit comments

Comments
 (0)