From 357109c5a5518db5925f49a6700a87e7ed30ca14 Mon Sep 17 00:00:00 2001
From: James Moger <james.moger@gitblit.com>
Date: Wed, 28 Dec 2011 16:19:29 -0500
Subject: [PATCH] Unit testing. Documentation.
---
src/com/gitblit/wicket/pages/TreePage.java | 26 ++++++++++++++++----------
1 files changed, 16 insertions(+), 10 deletions(-)
diff --git a/src/com/gitblit/wicket/pages/TreePage.java b/src/com/gitblit/wicket/pages/TreePage.java
index ac84e73..7fc91ee 100644
--- a/src/com/gitblit/wicket/pages/TreePage.java
+++ b/src/com/gitblit/wicket/pages/TreePage.java
@@ -26,6 +26,7 @@
import org.apache.wicket.markup.repeater.data.DataView;
import org.apache.wicket.markup.repeater.data.ListDataProvider;
import org.eclipse.jgit.lib.Constants;
+import org.eclipse.jgit.lib.FileMode;
import org.eclipse.jgit.lib.Repository;
import org.eclipse.jgit.revwalk.RevCommit;
@@ -70,12 +71,14 @@
if (path.lastIndexOf('/') > -1) {
parentPath = path.substring(0, path.lastIndexOf('/'));
}
- PathModel model = new PathModel("..", parentPath, 0, 40000, objectId);
+ PathModel model = new PathModel("..", parentPath, 0, FileMode.TREE.getBits(), objectId);
model.isParentPath = true;
paths.add(0, model);
}
final ByteFormat byteFormat = new ByteFormat();
+
+ final String baseUrl = WicketUtils.getGitblitURL(getRequest());
// changed paths list
ListDataProvider<PathModel> pathsDp = new ListDataProvider<PathModel>(paths);
@@ -91,7 +94,8 @@
item.add(WicketUtils.newBlankImage("pathIcon"));
item.add(new Label("pathSize", ""));
item.add(new LinkPanel("pathName", null, entry.name, TreePage.class,
- newPathParameter(entry.path)));
+ WicketUtils
+ .newPathParameter(repositoryName, entry.commitId, entry.path)));
item.add(new Label("pathLinks", ""));
} else {
if (entry.isTree()) {
@@ -99,7 +103,8 @@
item.add(WicketUtils.newImage("pathIcon", "folder_16x16.png"));
item.add(new Label("pathSize", ""));
item.add(new LinkPanel("pathName", "list", entry.name, TreePage.class,
- newPathParameter(entry.path)));
+ WicketUtils.newPathParameter(repositoryName, entry.commitId,
+ entry.path)));
// links
Fragment links = new Fragment("pathLinks", "treeLinks", this);
@@ -109,17 +114,17 @@
links.add(new BookmarkablePageLink<Void>("history", HistoryPage.class,
WicketUtils.newPathParameter(repositoryName, entry.commitId,
entry.path)));
- links.add(new ExternalLink("zip", DownloadZipServlet.asLink(getRequest()
- .getRelativePathPrefixToContextRoot(), repositoryName, objectId,
- entry.path)).setVisible(GitBlit.getBoolean(
- Keys.web.allowZipDownloads, true)));
+ links.add(new ExternalLink("zip", DownloadZipServlet.asLink(baseUrl,
+ repositoryName, objectId, entry.path)).setVisible(GitBlit
+ .getBoolean(Keys.web.allowZipDownloads, true)));
item.add(links);
} else {
// blob link
item.add(WicketUtils.getFileImage("pathIcon", entry.name));
item.add(new Label("pathSize", byteFormat.format(entry.size)));
item.add(new LinkPanel("pathName", "list", entry.name, BlobPage.class,
- newPathParameter(entry.path)));
+ WicketUtils.newPathParameter(repositoryName, entry.commitId,
+ entry.path)));
// links
Fragment links = new Fragment("pathLinks", "blobLinks", this);
@@ -128,8 +133,9 @@
entry.path)));
links.add(new BookmarkablePageLink<Void>("raw", RawPage.class, WicketUtils
.newPathParameter(repositoryName, entry.commitId, entry.path)));
- links.add(new BookmarkablePageLink<Void>("blame", BlobPage.class)
- .setEnabled(false));
+ links.add(new BookmarkablePageLink<Void>("blame", BlamePage.class,
+ WicketUtils.newPathParameter(repositoryName, entry.commitId,
+ entry.path)));
links.add(new BookmarkablePageLink<Void>("history", HistoryPage.class,
WicketUtils.newPathParameter(repositoryName, entry.commitId,
entry.path)));
--
Gitblit v1.9.1