summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJames Moger <james.moger@gitblit.com>2011-06-08 17:38:11 -0400
committerJames Moger <james.moger@gitblit.com>2011-06-08 17:38:11 -0400
commit716745e2dd9b3925b1229433e7072580206f731e (patch)
treef6cae75aa672c92e77f247b80c9c97fd273a8753 /src
parent1fa5e85b2d208636a6237ef8930f200767165baa (diff)
downloadgitblit-716745e2dd9b3925b1229433e7072580206f731e.tar.gz
gitblit-716745e2dd9b3925b1229433e7072580206f731e.zip
Stubbed out Blame. Added Github banner to site. Documentation.
Diffstat (limited to 'src')
-rw-r--r--src/com/gitblit/wicket/GitBlitWebApp.java4
-rw-r--r--src/com/gitblit/wicket/pages/BlamePage.html39
-rw-r--r--src/com/gitblit/wicket/pages/BlamePage.java97
-rw-r--r--src/com/gitblit/wicket/pages/BlobDiffPage.html2
-rw-r--r--src/com/gitblit/wicket/pages/BlobDiffPage.java3
-rw-r--r--src/com/gitblit/wicket/pages/BlobPage.html2
-rw-r--r--src/com/gitblit/wicket/pages/BlobPage.java6
-rw-r--r--src/com/gitblit/wicket/pages/CommitDiffPage.java5
-rw-r--r--src/com/gitblit/wicket/pages/CommitPage.java22
-rw-r--r--src/com/gitblit/wicket/pages/SummaryPage.java3
-rw-r--r--src/com/gitblit/wicket/pages/TreePage.java5
-rw-r--r--src/com/gitblit/wicket/resources/gitblit.css2
12 files changed, 168 insertions, 22 deletions
diff --git a/src/com/gitblit/wicket/GitBlitWebApp.java b/src/com/gitblit/wicket/GitBlitWebApp.java
index 61b51e86..daf10845 100644
--- a/src/com/gitblit/wicket/GitBlitWebApp.java
+++ b/src/com/gitblit/wicket/GitBlitWebApp.java
@@ -26,6 +26,7 @@ import org.apache.wicket.request.target.coding.MixedParamUrlCodingStrategy;
import com.gitblit.GitBlit;
import com.gitblit.Keys;
+import com.gitblit.wicket.pages.BlamePage;
import com.gitblit.wicket.pages.BlobDiffPage;
import com.gitblit.wicket.pages.BlobPage;
import com.gitblit.wicket.pages.BranchesPage;
@@ -37,11 +38,11 @@ import com.gitblit.wicket.pages.LogPage;
import com.gitblit.wicket.pages.LoginPage;
import com.gitblit.wicket.pages.LogoutPage;
import com.gitblit.wicket.pages.MarkdownPage;
+import com.gitblit.wicket.pages.MetricsPage;
import com.gitblit.wicket.pages.PatchPage;
import com.gitblit.wicket.pages.RawPage;
import com.gitblit.wicket.pages.RepositoriesPage;
import com.gitblit.wicket.pages.SearchPage;
-import com.gitblit.wicket.pages.MetricsPage;
import com.gitblit.wicket.pages.SummaryPage;
import com.gitblit.wicket.pages.TagPage;
import com.gitblit.wicket.pages.TagsPage;
@@ -85,6 +86,7 @@ public class GitBlitWebApp extends WebApplication {
mount("/history", HistoryPage.class, "r", "h", "f");
mount("/search", SearchPage.class);
mount("/metrics", MetricsPage.class, "r");
+ mount("/blame", BlamePage.class, "r", "h", "f");
// setup ticket urls
mount("/tickets", TicketsPage.class, "r");
diff --git a/src/com/gitblit/wicket/pages/BlamePage.html b/src/com/gitblit/wicket/pages/BlamePage.html
new file mode 100644
index 00000000..27ed7345
--- /dev/null
+++ b/src/com/gitblit/wicket/pages/BlamePage.html
@@ -0,0 +1,39 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:wicket="http://wicket.apache.org/dtds.data/wicket-xhtml1.3-strict.dtd"
+ xml:lang="en"
+ lang="en">
+
+<body>
+<wicket:extend>
+
+ <!-- blame nav links -->
+ <div class="page_nav2">
+ <a wicket:id="blobLink"><wicket:message key="gb.view"></wicket:message></a> | <a wicket:id="historyLink"><wicket:message key="gb.history"></wicket:message></a> | <a wicket:id="headLink"><wicket:message key="gb.head"></wicket:message></a> | <a wicket:id="commitLink"><wicket:message key="gb.commit"></wicket:message></a> | <a wicket:id="commitDiffLink"><wicket:message key="gb.commitdiff"></wicket:message></a>
+ </div>
+
+ <!-- commit header -->
+ <div wicket:id="commitHeader">[commit header]</div>
+
+ <!-- breadcrumbs -->
+ <div wicket:id="breadcrumbs">[breadcrumbs]</div>
+
+ <!-- blame content -->
+ <table>
+ <tbody>
+ <tr>
+ <th>Commit</th>
+ <th>Line</th>
+ <th>Data</th>
+ </tr>
+ <tr wicket:id="annotation">
+ <td><span wicket:id="commit"></span></td>
+ <td><span wicket:id="line"></span></td>
+ <td><span wicket:id="data"></span></td>
+ </tr>
+ </tbody>
+ </table>
+
+</wicket:extend>
+</body>
+</html> \ No newline at end of file
diff --git a/src/com/gitblit/wicket/pages/BlamePage.java b/src/com/gitblit/wicket/pages/BlamePage.java
new file mode 100644
index 00000000..dc6aa1f9
--- /dev/null
+++ b/src/com/gitblit/wicket/pages/BlamePage.java
@@ -0,0 +1,97 @@
+/*
+ * Copyright 2011 gitblit.com.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.gitblit.wicket.pages;
+
+import java.io.Serializable;
+import java.util.Arrays;
+import java.util.List;
+
+import org.apache.wicket.PageParameters;
+import org.apache.wicket.markup.html.basic.Label;
+import org.apache.wicket.markup.html.link.BookmarkablePageLink;
+import org.apache.wicket.markup.repeater.Item;
+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.revwalk.RevCommit;
+
+import com.gitblit.wicket.WicketUtils;
+import com.gitblit.wicket.panels.CommitHeaderPanel;
+import com.gitblit.wicket.panels.LinkPanel;
+import com.gitblit.wicket.panels.PathBreadcrumbsPanel;
+
+public class BlamePage extends RepositoryPage {
+
+ public BlamePage(PageParameters params) {
+ super(params);
+
+ final String blobPath = WicketUtils.getPath(params);
+
+ RevCommit commit = getCommit();
+
+ add(new BookmarkablePageLink<Void>("blobLink", BlobPage.class,
+ WicketUtils.newPathParameter(repositoryName, objectId,
+ blobPath)));
+ add(new BookmarkablePageLink<Void>("commitLink", CommitPage.class,
+ WicketUtils.newObjectParameter(repositoryName, objectId)));
+ add(new BookmarkablePageLink<Void>("commitDiffLink", CommitDiffPage.class,
+ WicketUtils.newObjectParameter(repositoryName, objectId)));
+
+ // blame page links
+ add(new BookmarkablePageLink<Void>("headLink", BlamePage.class,
+ WicketUtils.newPathParameter(repositoryName, Constants.HEAD, blobPath)));
+ add(new BookmarkablePageLink<Void>("historyLink", HistoryPage.class,
+ WicketUtils.newPathParameter(repositoryName, objectId, blobPath)));
+
+ add(new CommitHeaderPanel("commitHeader", repositoryName, commit));
+
+ add(new PathBreadcrumbsPanel("breadcrumbs", repositoryName, blobPath, objectId));
+
+ List<BlameLine> blame = Arrays.asList(new BlameLine("HEAD", "1", "Under Construction"));
+ ListDataProvider<BlameLine> blameDp = new ListDataProvider<BlameLine>(blame);
+ DataView<BlameLine> blameView = new DataView<BlameLine>("annotation", blameDp) {
+ private static final long serialVersionUID = 1L;
+
+ public void populateItem(final Item<BlameLine> item) {
+ BlameLine entry = item.getModelObject();
+ item.add(new LinkPanel("commit", "list", entry.objectId, CommitPage.class,
+ newCommitParameter(entry.objectId)));
+ item.add(new Label("line", entry.line));
+ item.add(new Label("data", entry.data));
+ }
+ };
+ add(blameView);
+ }
+
+ @Override
+ protected String getPageName() {
+ return getString("gb.blame");
+ }
+
+ private class BlameLine implements Serializable {
+
+ private static final long serialVersionUID = 1L;
+
+ final String objectId;
+ final String line;
+ final String data;
+ BlameLine(String objectId, String line, String data) {
+ this.objectId = objectId;
+ this.line = line;
+ this.data = data;
+ }
+ }
+}
diff --git a/src/com/gitblit/wicket/pages/BlobDiffPage.html b/src/com/gitblit/wicket/pages/BlobDiffPage.html
index 4818aa8c..c6336429 100644
--- a/src/com/gitblit/wicket/pages/BlobDiffPage.html
+++ b/src/com/gitblit/wicket/pages/BlobDiffPage.html
@@ -9,7 +9,7 @@
<!-- blob nav links -->
<div class="page_nav2">
- <span wicket:id="blameLink">[blame link]</span> | <a wicket:id="historyLink"><wicket:message key="gb.history"></wicket:message></a> | <a wicket:id="patchLink"><wicket:message key="gb.patch"></wicket:message></a> | <a wicket:id="commitLink"><wicket:message key="gb.commit"></wicket:message></a> | <a wicket:id="commitDiffLink"><wicket:message key="gb.commitdiff"></wicket:message></a>
+ <a wicket:id="blameLink"><wicket:message key="gb.blame"></wicket:message></a> | <a wicket:id="historyLink"><wicket:message key="gb.history"></wicket:message></a> | <a wicket:id="patchLink"><wicket:message key="gb.patch"></wicket:message></a> | <a wicket:id="commitLink"><wicket:message key="gb.commit"></wicket:message></a> | <a wicket:id="commitDiffLink"><wicket:message key="gb.commitdiff"></wicket:message></a>
</div>
<!-- commit header -->
diff --git a/src/com/gitblit/wicket/pages/BlobDiffPage.java b/src/com/gitblit/wicket/pages/BlobDiffPage.java
index a8f8b3c1..d86d2e63 100644
--- a/src/com/gitblit/wicket/pages/BlobDiffPage.java
+++ b/src/com/gitblit/wicket/pages/BlobDiffPage.java
@@ -66,7 +66,8 @@ public class BlobDiffPage extends RepositoryPage {
WicketUtils.newObjectParameter(repositoryName, objectId)));
// diff page links
- add(new Label("blameLink", getString("gb.blame")));
+ add(new BookmarkablePageLink<Void>("blameLink", BlamePage.class,
+ WicketUtils.newPathParameter(repositoryName, objectId, blobPath)));
add(new BookmarkablePageLink<Void>("historyLink", HistoryPage.class,
WicketUtils.newPathParameter(repositoryName, objectId, blobPath)));
diff --git a/src/com/gitblit/wicket/pages/BlobPage.html b/src/com/gitblit/wicket/pages/BlobPage.html
index 52374437..3c851419 100644
--- a/src/com/gitblit/wicket/pages/BlobPage.html
+++ b/src/com/gitblit/wicket/pages/BlobPage.html
@@ -18,7 +18,7 @@
<!-- blob nav links -->
<div class="page_nav2">
- <span wicket:id="blameLink">[blame link]</span> | <a wicket:id="historyLink"><wicket:message key="gb.history"></wicket:message></a> | <a wicket:id="rawLink"><wicket:message key="gb.raw"></wicket:message></a> | <a wicket:id="headLink"><wicket:message key="gb.head"></wicket:message></a>
+ <a wicket:id="blameLink"><wicket:message key="gb.blame"></wicket:message></a> | <a wicket:id="historyLink"><wicket:message key="gb.history"></wicket:message></a> | <a wicket:id="rawLink"><wicket:message key="gb.raw"></wicket:message></a> | <a wicket:id="headLink"><wicket:message key="gb.head"></wicket:message></a>
</div>
<!-- commit header -->
diff --git a/src/com/gitblit/wicket/pages/BlobPage.java b/src/com/gitblit/wicket/pages/BlobPage.java
index 3c5c8e04..47c8ca82 100644
--- a/src/com/gitblit/wicket/pages/BlobPage.java
+++ b/src/com/gitblit/wicket/pages/BlobPage.java
@@ -45,7 +45,8 @@ public class BlobPage extends RepositoryPage {
if (StringUtils.isEmpty(blobPath)) {
// blob by objectid
- add(new Label("blameLink", getString("gb.blame")).setEnabled(false));
+ add(new BookmarkablePageLink<Void>("blameLink", BlamePage.class,
+ WicketUtils.newPathParameter(repositoryName, objectId, blobPath)).setEnabled(false));
add(new BookmarkablePageLink<Void>("historyLink", HistoryPage.class).setEnabled(false));
add(new BookmarkablePageLink<Void>("rawLink", RawPage.class,
WicketUtils.newPathParameter(repositoryName, objectId, blobPath)));
@@ -74,7 +75,8 @@ public class BlobPage extends RepositoryPage {
RevCommit commit = JGitUtils.getCommit(r, objectId);
// blob page links
- add(new Label("blameLink", getString("gb.blame")));
+ add(new BookmarkablePageLink<Void>("blameLink", BlamePage.class,
+ WicketUtils.newPathParameter(repositoryName, objectId, blobPath)));
add(new BookmarkablePageLink<Void>("historyLink", HistoryPage.class,
WicketUtils.newPathParameter(repositoryName, objectId, blobPath)));
add(new BookmarkablePageLink<Void>("rawLink", RawPage.class,
diff --git a/src/com/gitblit/wicket/pages/CommitDiffPage.java b/src/com/gitblit/wicket/pages/CommitDiffPage.java
index 4815b2c7..3abcf131 100644
--- a/src/com/gitblit/wicket/pages/CommitDiffPage.java
+++ b/src/com/gitblit/wicket/pages/CommitDiffPage.java
@@ -98,9 +98,10 @@ public class CommitDiffPage extends RepositoryPage {
newPathParameter(entry.path)));
item.add(new BookmarkablePageLink<Void>("view", BlobPage.class,
newPathParameter(entry.path)));
- item.add(new BookmarkablePageLink<Void>("blame", BlobPage.class).setEnabled(false));
+ item.add(new BookmarkablePageLink<Void>("blame", BlamePage.class,
+ newPathParameter(entry.path)));
item.add(new BookmarkablePageLink<Void>("history", HistoryPage.class,
- newPathParameter(entry.path)).setEnabled(!entry.changeType.equals(ChangeType.ADD) && !entry.changeType.equals(ChangeType.DELETE)));
+ newPathParameter(entry.path)).setEnabled(!entry.changeType.equals(ChangeType.ADD)));
WicketUtils.setAlternatingBackground(item, counter);
counter++;
diff --git a/src/com/gitblit/wicket/pages/CommitPage.java b/src/com/gitblit/wicket/pages/CommitPage.java
index 7b5fdbe0..d9ff1b78 100644
--- a/src/com/gitblit/wicket/pages/CommitPage.java
+++ b/src/com/gitblit/wicket/pages/CommitPage.java
@@ -125,15 +125,16 @@ public class CommitPage extends RepositoryPage {
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(), SearchType.AUTHOR));
- item.add(WicketUtils.createTimestampLabel("authorDate",
- entry.notesRef.getAuthorIdent().getWhen(), getTimeZone()));
- item.add(new Label("noteContent", StringUtils.breakLinesForHtml(entry.content)).setEscapeModelStrings(false));
+ item.add(createPersonPanel("authorName", entry.notesRef.getAuthorIdent(),
+ SearchType.AUTHOR));
+ item.add(WicketUtils.createTimestampLabel("authorDate", entry.notesRef
+ .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));
@@ -157,12 +158,15 @@ public class CommitPage extends RepositoryPage {
}
item.add(new BookmarkablePageLink<Void>("diff", BlobDiffPage.class,
- newPathParameter(entry.path)).setEnabled(!entry.changeType.equals(ChangeType.ADD) && !entry.changeType.equals(ChangeType.DELETE)));
+ newPathParameter(entry.path)).setEnabled(!entry.changeType
+ .equals(ChangeType.ADD) && !entry.changeType.equals(ChangeType.DELETE)));
item.add(new BookmarkablePageLink<Void>("view", BlobPage.class,
newPathParameter(entry.path)));
- item.add(new BookmarkablePageLink<Void>("blame", BlobPage.class).setEnabled(false));
+ item.add(new BookmarkablePageLink<Void>("blame", BlamePage.class,
+ newPathParameter(entry.path)));
item.add(new BookmarkablePageLink<Void>("history", HistoryPage.class,
- newPathParameter(entry.path)).setEnabled(!entry.changeType.equals(ChangeType.ADD)));
+ newPathParameter(entry.path)).setEnabled(!entry.changeType
+ .equals(ChangeType.ADD)));
WicketUtils.setAlternatingBackground(item, counter);
counter++;
diff --git a/src/com/gitblit/wicket/pages/SummaryPage.java b/src/com/gitblit/wicket/pages/SummaryPage.java
index 03b1b1c7..37b0bcff 100644
--- a/src/com/gitblit/wicket/pages/SummaryPage.java
+++ b/src/com/gitblit/wicket/pages/SummaryPage.java
@@ -203,11 +203,10 @@ public class SummaryPage extends RepositoryPage {
metrics.get(metrics.size() / 2).name, metrics.get(metrics.size() - 1).name });
provider.addAxis(dateAxis);
- ChartAxis commitAxis = new ChartAxis(ChartAxisType.LEFT);
+ ChartAxis commitAxis = new ChartAxis(ChartAxisType.LEFT);
commitAxis.setLabels(new String[] { "",
String.valueOf((int) WicketUtils.maxValue(metrics)) });
provider.addAxis(commitAxis);
-
provider.setLineStyles(new LineStyle[] { new LineStyle(2, 4, 0), new LineStyle(0, 4, 1) });
provider.addShapeMarker(new ShapeMarker(MarkerType.CIRCLE, Color.BLUE, 1, -1, 5));
diff --git a/src/com/gitblit/wicket/pages/TreePage.java b/src/com/gitblit/wicket/pages/TreePage.java
index f7962664..68eecf0f 100644
--- a/src/com/gitblit/wicket/pages/TreePage.java
+++ b/src/com/gitblit/wicket/pages/TreePage.java
@@ -129,8 +129,9 @@ public class TreePage extends RepositoryPage {
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)));
diff --git a/src/com/gitblit/wicket/resources/gitblit.css b/src/com/gitblit/wicket/resources/gitblit.css
index a0ab10ab..7c896dff 100644
--- a/src/com/gitblit/wicket/resources/gitblit.css
+++ b/src/com/gitblit/wicket/resources/gitblit.css
@@ -737,7 +737,7 @@ span .tagRef a:hover, span .headRef a:hover, span .localBranch a:hover, span .re
}
span .otherRef {
- background-color: #80ccdd;
+ background-color: #b0e0f0;
border-color: #80aaaa;
}