Skip to content

Add sorting capability to HTML render #350

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 7 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/CodeCoverage/Report/HTML.php
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@ private function copyFiles($target)
copy($this->templatePath . 'js/jquery.min.js', $dir . 'jquery.min.js');
copy($this->templatePath . 'js/nv.d3.min.js', $dir . 'nv.d3.min.js');
copy($this->templatePath . 'js/respond.min.js', $dir . 'respond.min.js');
copy($this->templatePath . 'js/list.min.js', $dir . 'list.min.js');
}

/**
Expand Down
4 changes: 4 additions & 0 deletions src/CodeCoverage/Report/HTML/Renderer/Template/css/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -120,3 +120,7 @@ svg text {
overflow-x:hidden;
overflow-y:scroll;
}

.pointer {
cursor:pointer;
}
28 changes: 22 additions & 6 deletions src/CodeCoverage/Report/HTML/Renderer/Template/directory.html.dist
Original file line number Diff line number Diff line change
Expand Up @@ -23,21 +23,21 @@
</div>
</div>
</header>
<div class="container">
<div class="container" id="container_table">
<table class="table table-bordered">
<thead>
<tr>
<td>&nbsp;</td>
<td colspan="9"><div align="center"><strong>Code Coverage</strong></div></td>
</tr>
<tr>
<td>&nbsp;</td>
<td colspan="3"><div align="center"><strong>Lines</strong></div></td>
<td colspan="3"><div align="center"><strong>Functions and Methods</strong></div></td>
<td colspan="3"><div align="center"><strong>Classes and Traits</strong></div></td>
<td><strong class="sort pointer" data-sort="name">Name</strong></td>
<td colspan="3"><div align="center"><strong class="sort pointer" data-sort="lines_executed_percent">Lines</strong></div></td>
<td colspan="3"><div align="center"><strong class="sort pointer" data-sort="methods_tested_percent">Functions and Methods</strong></div></td>
<td colspan="3"><div align="center"><strong class="sort pointer" data-sort="classes_tested_percent">Classes and Traits</strong></div></td>
</tr>
</thead>
<tbody>
<tbody class="list">
{{items}}
</tbody>
</table>
Expand All @@ -57,5 +57,21 @@
<script src="{{path_to_root}}js/jquery.min.js" type="text/javascript"></script>
<script src="{{path_to_root}}js/bootstrap.min.js" type="text/javascript"></script>
<script src="{{path_to_root}}js/holder.min.js" type="text/javascript"></script>
<script src="{{path_to_root}}js/list.min.js" type="text/javascript"></script>
<script type="text/javascript">
var options = {
valueNames: [
'name',
'lines_executed_percent',
'methods_tested_percent',
'classes_tested_percent'
]
};

// Remove sort on first line (the summary)
$('#container_table tbody tr:first td').removeClass(options.valueNames.join(' '));

new List('container_table', options);
</script>
</body>
</html>
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
<tr>
<td class="{{lines_level}}">{{icon}}{{name}}</td>
<td class="{{lines_level}} name">{{icon}}{{name}}</td>
<td class="{{lines_level}} big">{{lines_bar}}</td>
<td class="{{lines_level}} small"><div align="right">{{lines_executed_percent}}</div></td>
<td class="{{lines_level}} small lines_executed_percent"><div align="right">{{lines_executed_percent}}</div></td>
<td class="{{lines_level}} small"><div align="right">{{lines_number}}</div></td>
<td class="{{methods_level}} big">{{methods_bar}}</td>
<td class="{{methods_level}} small"><div align="right">{{methods_tested_percent}}</div></td>
<td class="{{methods_level}} small methods_tested_percent"><div align="right">{{methods_tested_percent}}</div></td>
<td class="{{methods_level}} small"><div align="right">{{methods_number}}</div></td>
<td class="{{classes_level}} big">{{classes_bar}}</td>
<td class="{{classes_level}} small"><div align="right">{{classes_tested_percent}}</div></td>
<td class="{{classes_level}} small classes_tested_percent"><div align="right">{{classes_tested_percent}}</div></td>
<td class="{{classes_level}} small"><div align="right">{{classes_number}}</div></td>
</tr>

Loading