summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJames Moger <james.moger@gitblit.com>2013-09-18 11:21:00 -0400
committerJames Moger <james.moger@gitblit.com>2013-09-18 11:31:01 -0400
commit67b82a67335cc24b3cadf3e31de097b21294b244 (patch)
treec37046ab51b46a397e9e4040943e7179ca8bc3ef
parent0250286553ca93406bfaa976d6aae61e76a9d55f (diff)
downloadgitblit-67b82a67335cc24b3cadf3e31de097b21294b244.tar.gz
gitblit-67b82a67335cc24b3cadf3e31de097b21294b244.zip
Added GitNotes to the commitdiff page
-rw-r--r--src/main/java/com/gitblit/wicket/pages/CommitDiffPage.html24
-rw-r--r--src/main/java/com/gitblit/wicket/pages/CommitDiffPage.java25
2 files changed, 49 insertions, 0 deletions
diff --git a/src/main/java/com/gitblit/wicket/pages/CommitDiffPage.html b/src/main/java/com/gitblit/wicket/pages/CommitDiffPage.html
index 7437d2ed..7fd3857f 100644
--- a/src/main/java/com/gitblit/wicket/pages/CommitDiffPage.html
+++ b/src/main/java/com/gitblit/wicket/pages/CommitDiffPage.html
@@ -18,6 +18,22 @@
<!-- full message -->
<div wicket:id="fullMessage">[commit message]</div>
+ <!-- git notes -->
+ <table class="gitnotes">
+ <tr wicket:id="notes">
+ <td class="info">
+ <table>
+ <tr><td><span wicket:id="refName"></span></td></tr>
+ <tr><td><span class="sha1" wicket:id="authorName"></span></td></tr>
+ <tr><td><span class="sha1" wicket:id="authorDate"></span></td></tr>
+ </table>
+ <!-- Note Author Gravatar -->
+ <span style="vertical-align: top;" wicket:id="noteAuthorAvatar" />
+ </td>
+ <td class="message"><span class="sha1" wicket:id="noteContent"></span></td>
+ </tr>
+ </table>
+
<!-- commit legend -->
<div class="hidden-phone" style="text-align:right;" wicket:id="commitLegend"></div>
@@ -38,6 +54,14 @@
<!-- diff content -->
<pre style="padding-top:10px;" wicket:id="diffText">[diff text]</pre>
+
+ <wicket:fragment wicket:id="fullPersonIdent">
+ <span wicket:id="personName"></span><span wicket:id="personAddress"></span>
+ </wicket:fragment>
+
+ <wicket:fragment wicket:id="partialPersonIdent">
+ <span wicket:id="personName"></span>
+ </wicket:fragment>
</wicket:extend>
</body>
diff --git a/src/main/java/com/gitblit/wicket/pages/CommitDiffPage.java b/src/main/java/com/gitblit/wicket/pages/CommitDiffPage.java
index 4c802d74..eb672164 100644
--- a/src/main/java/com/gitblit/wicket/pages/CommitDiffPage.java
+++ b/src/main/java/com/gitblit/wicket/pages/CommitDiffPage.java
@@ -16,6 +16,7 @@
package com.gitblit.wicket.pages;
import java.util.ArrayList;
+import java.util.Arrays;
import java.util.List;
import org.apache.wicket.PageParameters;
@@ -29,8 +30,10 @@ import org.eclipse.jgit.diff.DiffEntry.ChangeType;
import org.eclipse.jgit.lib.Repository;
import org.eclipse.jgit.revwalk.RevCommit;
+import com.gitblit.Constants;
import com.gitblit.GitBlit;
import com.gitblit.models.PathModel.PathChangeModel;
+import com.gitblit.models.GitNote;
import com.gitblit.models.SubmoduleModel;
import com.gitblit.utils.DiffUtils;
import com.gitblit.utils.DiffUtils.DiffOutputType;
@@ -40,7 +43,9 @@ import com.gitblit.wicket.CacheControl.LastModified;
import com.gitblit.wicket.WicketUtils;
import com.gitblit.wicket.panels.CommitHeaderPanel;
import com.gitblit.wicket.panels.CommitLegendPanel;
+import com.gitblit.wicket.panels.GravatarImage;
import com.gitblit.wicket.panels.LinkPanel;
+import com.gitblit.wicket.panels.RefsPanel;
@CacheControl(LastModified.BOOT)
public class CommitDiffPage extends RepositoryPage {
@@ -77,6 +82,26 @@ public class CommitDiffPage extends RepositoryPage {
addFullText("fullMessage", commit.getFullMessage());
+ // git notes
+ List<GitNote> notes = JGitUtils.getNotesOnCommit(r, commit);
+ 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();
+ item.add(new RefsPanel("refName", repositoryName, Arrays.asList(entry.notesRef)));
+ item.add(createPersonPanel("authorName", entry.notesRef.getAuthorIdent(),
+ Constants.SearchType.AUTHOR));
+ item.add(new GravatarImage("noteAuthorAvatar", entry.notesRef.getAuthorIdent()));
+ item.add(WicketUtils.createTimestampLabel("authorDate", entry.notesRef
+ .getAuthorIdent().getWhen(), getTimeZone(), getTimeUtils()));
+ item.add(new Label("noteContent", GitBlit.self().processPlainCommitMessage(repositoryName,
+ entry.content)).setEscapeModelStrings(false));
+ }
+ };
+ add(notesView.setVisible(notes.size() > 0));
+
// changed paths list
List<PathChangeModel> paths = JGitUtils.getFilesInCommit(r, commit);