diff options
author | James Moger <james.moger@gitblit.com> | 2013-09-19 08:13:48 -0400 |
---|---|---|
committer | James Moger <james.moger@gitblit.com> | 2013-09-19 08:13:48 -0400 |
commit | 4f0f65fed0613cd69eba1cb8a80d0d18d0a79983 (patch) | |
tree | 0dcbd7935c1c621ab949afa4ac82954519747ecf /src/main/java/com/gitblit/wicket/pages/BlobPage.java | |
parent | 6de953137ce26e380f88b77876394d3c6fbdd766 (diff) | |
download | gitblit-4f0f65fed0613cd69eba1cb8a80d0d18d0a79983.tar.gz gitblit-4f0f65fed0613cd69eba1cb8a80d0d18d0a79983.zip |
Reverse line links in blob view (issue-309)
Diffstat (limited to 'src/main/java/com/gitblit/wicket/pages/BlobPage.java')
-rw-r--r-- | src/main/java/com/gitblit/wicket/pages/BlobPage.java | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/main/java/com/gitblit/wicket/pages/BlobPage.java b/src/main/java/com/gitblit/wicket/pages/BlobPage.java index b104df2d..b9f64304 100644 --- a/src/main/java/com/gitblit/wicket/pages/BlobPage.java +++ b/src/main/java/com/gitblit/wicket/pages/BlobPage.java @@ -174,7 +174,7 @@ public class BlobPage extends RepositoryPage { sb.append("<!-- start nums column -->");
sb.append("<td id=\"nums\">");
sb.append("<pre>");
- String numPattern = "<span id=\"L{0}\" class=\"num\">{0}</span>\n";
+ String numPattern = "<span id=\"L{0}\" class=\"jump\"></span><a href=\"#L{0}\">{0}</a>\n";
for (int i = 0; i < lines.length; i++) {
sb.append(MessageFormat.format(numPattern, "" + (i + 1)));
}
@@ -194,10 +194,13 @@ public class BlobPage extends RepositoryPage { sb.append("<table width=\"100%\"><tbody>");
- String linePattern = "<tr class=\"{0}\"><td><a href=\"#L{2}\">{1}</a>\r</tr>";
+ String linePattern = "<tr class=\"{0}\"><td><div><span class=\"line\">{1}</span></div>\r</tr>";
for (int i = 0; i < lines.length; i++) {
String line = lines[i].replace('\r', ' ');
String cssClass = (i % 2 == 0) ? "even" : "odd";
+ if (StringUtils.isEmpty(line.trim())) {
+ line = " ";
+ }
sb.append(MessageFormat.format(linePattern, cssClass, line, "" + (i + 1)));
}
sb.append("</tbody></table></pre>");
|