Skip to content

Commit

Permalink
Improved navigation to files of class
Browse files Browse the repository at this point in the history
  • Loading branch information
danielpalme committed Nov 4, 2016
1 parent da1a151 commit ba82de5
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
5 changes: 3 additions & 2 deletions ReportGenerator.Reporting/Rendering/HtmlRenderer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ internal class HtmlRenderer : RendererBase, IReportRenderer, IDisposable
<html data-ng-app=""coverageApp"">
<head>
<meta charset=""utf-8"" />
<meta http-equiv=""X-UA-Compatible"" content=""IE=EDGE,chrome=1"" />
<title>{0} - {1}</title>
<link href=""https://fonts.googleapis.com/css?family=Open+Sans"" rel=""stylesheet"">
{2}
Expand Down Expand Up @@ -179,7 +180,7 @@ public void TestMethods(IEnumerable<TestMethod> testMethods, IDictionary<int, IE
foreach (var codeElement in item.Value)
{
this.reportTextWriter.WriteLine(
"<a class=\"{0}\" href=\"#file{1}_line{2}\" data-ng-click=\"navigateToCodeElement('#file{1}_line{2}')\" title=\"{3}\">{3}</a><br />",
"<a class=\"{0}\" href=\"#file{1}_line{2}\" data-ng-click=\"navigateToHash('#file{1}_line{2}')\" title=\"{3}\">{3}</a><br />",
codeElement.Type == CodeElementType.Method ? "method" : "property",
item.Key,
codeElement.Line,
Expand Down Expand Up @@ -413,7 +414,7 @@ public void KeyValueRow(string key, string value)
/// <param name="files">The files.</param>
public void KeyValueRow(string key, IEnumerable<string> files)
{
string value = string.Join("<br />", files.Select(v => string.Format(CultureInfo.InvariantCulture, "<a href=\"#{0}\">{1}</a>", WebUtility.HtmlEncode(ReplaceNonLetterChars(v)), WebUtility.HtmlEncode(v))));
string value = string.Join("<br />", files.Select(v => string.Format(CultureInfo.InvariantCulture, "<a href=\"#{0}\" data-ng-click=\"navigateToHash('#{0}')\">{1}</a>", WebUtility.HtmlEncode(ReplaceNonLetterChars(v)), WebUtility.HtmlEncode(v))));

this.reportTextWriter.WriteLine(
"<tr><th>{0}</th><td>{1}</td></tr>",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ function DetailViewCtrl($scope, $window) {
}
};

$scope.navigateToCodeElement = function (hash) {
$scope.navigateToHash = function (hash) {
// Prevent history entries when selecting methods/properties
if ($window.history !== undefined && $window.history.replaceState !== undefined) {
$window.history.replaceState(undefined, undefined, hash);
Expand Down

0 comments on commit ba82de5

Please sign in to comment.