diff options
author | James Moger <james.moger@gitblit.com> | 2011-06-02 22:40:23 -0400 |
---|---|---|
committer | James Moger <james.moger@gitblit.com> | 2011-06-02 22:40:23 -0400 |
commit | a125cf6876e0edc5a2498df57a9df06d60b1f572 (patch) | |
tree | 7e0757213e7b69c7e97c0fe7ac4b7e2edfc41b81 /src/com/gitblit/wicket/pages/CommitPage.java | |
parent | 793f76563d4bb3f58fa62ff53985e20561c6e330 (diff) | |
download | gitblit-a125cf6876e0edc5a2498df57a9df06d60b1f572.tar.gz gitblit-a125cf6876e0edc5a2498df57a9df06d60b1f572.zip |
Unit testing. Start of git-notes display feature.
Diffstat (limited to 'src/com/gitblit/wicket/pages/CommitPage.java')
-rw-r--r-- | src/com/gitblit/wicket/pages/CommitPage.java | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/src/com/gitblit/wicket/pages/CommitPage.java b/src/com/gitblit/wicket/pages/CommitPage.java index bc0d8792..3af9cf1d 100644 --- a/src/com/gitblit/wicket/pages/CommitPage.java +++ b/src/com/gitblit/wicket/pages/CommitPage.java @@ -18,6 +18,7 @@ package com.gitblit.wicket.pages; import java.util.ArrayList;
import java.util.List;
+import org.apache.wicket.Component;
import org.apache.wicket.PageParameters;
import org.apache.wicket.markup.html.basic.Label;
import org.apache.wicket.markup.html.link.BookmarkablePageLink;
@@ -33,8 +34,10 @@ import org.eclipse.jgit.revwalk.RevCommit; import com.gitblit.DownloadZipServlet;
import com.gitblit.GitBlit;
import com.gitblit.Keys;
+import com.gitblit.models.GitNote;
import com.gitblit.models.PathModel.PathChangeModel;
import com.gitblit.utils.JGitUtils;
+import com.gitblit.utils.StringUtils;
import com.gitblit.utils.JGitUtils.SearchType;
import com.gitblit.wicket.WicketUtils;
import com.gitblit.wicket.panels.CommitHeaderPanel;
@@ -112,6 +115,27 @@ public class CommitPage extends RepositoryPage { addFullText("fullMessage", c.getFullMessage(), true);
+ // git notes
+ List<GitNote> notes = JGitUtils.getNotesOnCommit(r, c);
+ ListDataProvider<GitNote> notesDp = new ListDataProvider<GitNote>(notes);
+ DataView<GitNote> notesView = new DataView<GitNote>("notes", notesDp) {
+ private static final long serialVersionUID = 1L;
+
+ public void populateItem(final Item<GitNote> item) {
+ GitNote entry = item.getModelObject();
+ Component c = new LinkPanel("refName", null, entry.notesRef.displayName,
+ CommitPage.class, newCommitParameter(entry.notesRef.commit.getName()));
+ WicketUtils.setCssClass(c, "headRef");
+ item.add(c);
+ item.add(createPersonPanel("authorName", entry.notesRef.commit.getAuthorIdent(), SearchType.AUTHOR));
+ item.add(WicketUtils.createTimestampLabel("authorDate",
+ entry.notesRef.commit.getAuthorIdent().getWhen(), getTimeZone()));
+ item.add(new Label("noteContent", StringUtils.breakLinesForHtml(entry.content)).setEscapeModelStrings(false));
+ }
+ };
+ add(notesView.setVisible(notes.size() > 0));
+
+
// changed paths list
List<PathChangeModel> paths = JGitUtils.getFilesInCommit(r, c);
add(new CommitLegendPanel("commitLegend", paths));
|