summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJames Moger <james.moger@gitblit.com>2011-04-11 17:42:58 -0400
committerJames Moger <james.moger@gitblit.com>2011-04-11 17:42:58 -0400
commit7d35e227475bb4a6ba185788cc663e38822c15f8 (patch)
tree486cd95b73b387820d1ba9dac6e4e277530a5948
parent66c29a66638066c3c56cdcbd423d5c7874b73a27 (diff)
downloadgitblit-7d35e227475bb4a6ba185788cc663e38822c15f8.tar.gz
gitblit-7d35e227475bb4a6ba185788cc663e38822c15f8.zip
Ref links.
-rw-r--r--gitblit.properties2
-rw-r--r--src/com/gitblit/wicket/RepositoryPage.java6
-rw-r--r--src/com/gitblit/wicket/WicketUtils.java16
-rw-r--r--src/com/gitblit/wicket/pages/BlobPage.java2
-rw-r--r--src/com/gitblit/wicket/pages/DiffPage.java3
-rw-r--r--src/com/gitblit/wicket/pages/LogPage.java2
-rw-r--r--src/com/gitblit/wicket/pages/TicGitTicketPage.java2
-rw-r--r--src/com/gitblit/wicket/pages/TreePage.java2
-rw-r--r--src/com/gitblit/wicket/panels/LogPanel.java4
-rw-r--r--src/com/gitblit/wicket/panels/RefsPanel.html2
-rw-r--r--src/com/gitblit/wicket/panels/RefsPanel.java25
-rw-r--r--src/com/gitblit/wicket/resources/gitblit.css21
12 files changed, 52 insertions, 35 deletions
diff --git a/gitblit.properties b/gitblit.properties
index 8ea1cc66..839b914b 100644
--- a/gitblit.properties
+++ b/gitblit.properties
@@ -79,7 +79,7 @@ summaryRefsCount = 5
# The number of commits to show on each page of a Log
# Value must exceed 0 else default of 50 is used
-logPageCommitsCount = 50
+logPageCommitCount = 50
# Registered extensions for google-code-prettify
prettyPrintExtensions = c cpp cs css htm html java js php pl prefs properties py rb sh sql xml vb
diff --git a/src/com/gitblit/wicket/RepositoryPage.java b/src/com/gitblit/wicket/RepositoryPage.java
index 4e849383..05617718 100644
--- a/src/com/gitblit/wicket/RepositoryPage.java
+++ b/src/com/gitblit/wicket/RepositoryPage.java
@@ -32,8 +32,8 @@ public abstract class RepositoryPage extends BasePage {
error("Repository not specified!");
redirectToInterceptPage(new RepositoriesPage());
}
- repositoryName = params.getString("r", "");
- objectId = params.getString("h", "HEAD");
+ repositoryName = WicketUtils.getRepositoryName(params);
+ objectId = WicketUtils.getObject(params);
Repository r = getRepository();
@@ -64,7 +64,7 @@ public abstract class RepositoryPage extends BasePage {
}
protected void addRefs(Repository r, RevCommit c) {
- add(new RefsPanel("refsPanel", r, c));
+ add(new RefsPanel("refsPanel", repositoryName, c, JGitUtils.getAllRefs(r)));
}
protected void addFullText(String wicketId, String text, boolean substituteRegex) {
diff --git a/src/com/gitblit/wicket/WicketUtils.java b/src/com/gitblit/wicket/WicketUtils.java
index bc1f441e..126c37de 100644
--- a/src/com/gitblit/wicket/WicketUtils.java
+++ b/src/com/gitblit/wicket/WicketUtils.java
@@ -103,6 +103,22 @@ public class WicketUtils {
return new PageParameters("r=" + repositoryName + ",h=" + objectId + ",page=" + pageNumber);
}
+ public static String getRepositoryName(PageParameters params) {
+ return params.getString("r", "");
+ }
+
+ public static String getObject(PageParameters params) {
+ return params.getString("h", "");
+ }
+
+ public static String getPath(PageParameters params) {
+ return params.getString("f", null);
+ }
+
+ public static int getPage(PageParameters params) {
+ return params.getInt("page", 1); // index from 1
+ }
+
public static Label createDateLabel(String wicketId, Date date, TimeZone timeZone) {
DateFormat df = new SimpleDateFormat(StoredSettings.getString("datestampShortFormat", "MM/dd/yy"));
if (timeZone != null) {
diff --git a/src/com/gitblit/wicket/pages/BlobPage.java b/src/com/gitblit/wicket/pages/BlobPage.java
index 78429362..7d7259a0 100644
--- a/src/com/gitblit/wicket/pages/BlobPage.java
+++ b/src/com/gitblit/wicket/pages/BlobPage.java
@@ -22,7 +22,7 @@ public class BlobPage extends RepositoryPage {
public BlobPage(PageParameters params) {
super(params);
- final String blobPath = params.getString("f", null);
+ final String blobPath = WicketUtils.getPath(params);
Repository r = getRepository();
RevCommit commit = JGitUtils.getCommit(r, objectId);
diff --git a/src/com/gitblit/wicket/pages/DiffPage.java b/src/com/gitblit/wicket/pages/DiffPage.java
index 1e6065b3..1912c42d 100644
--- a/src/com/gitblit/wicket/pages/DiffPage.java
+++ b/src/com/gitblit/wicket/pages/DiffPage.java
@@ -8,6 +8,7 @@ import org.eclipse.jgit.revwalk.RevCommit;
import com.gitblit.utils.JGitUtils;
import com.gitblit.wicket.LinkPanel;
import com.gitblit.wicket.RepositoryPage;
+import com.gitblit.wicket.WicketUtils;
import com.gitblit.wicket.panels.PathBreadcrumbsPanel;
public class DiffPage extends RepositoryPage {
@@ -15,7 +16,7 @@ public class DiffPage extends RepositoryPage {
public DiffPage(PageParameters params) {
super(params);
- final String blobPath = params.getString("f", null);
+ final String blobPath = WicketUtils.getPath(params);
Repository r = getRepository();
RevCommit commit = JGitUtils.getCommit(r, objectId);
diff --git a/src/com/gitblit/wicket/pages/LogPage.java b/src/com/gitblit/wicket/pages/LogPage.java
index f9449ad9..cd75df9c 100644
--- a/src/com/gitblit/wicket/pages/LogPage.java
+++ b/src/com/gitblit/wicket/pages/LogPage.java
@@ -12,7 +12,7 @@ public class LogPage extends RepositoryPage {
public LogPage(PageParameters params) {
super(params);
- int pageNumber = params.getInt("page", 1); // index from 1
+ int pageNumber = WicketUtils.getPage(params);
int prevPage = Math.max(0, pageNumber - 1);
int nextPage = pageNumber + 1;
diff --git a/src/com/gitblit/wicket/pages/TicGitTicketPage.java b/src/com/gitblit/wicket/pages/TicGitTicketPage.java
index 5d3ceb48..5cdc4a7b 100644
--- a/src/com/gitblit/wicket/pages/TicGitTicketPage.java
+++ b/src/com/gitblit/wicket/pages/TicGitTicketPage.java
@@ -19,7 +19,7 @@ public class TicGitTicketPage extends RepositoryPage {
public TicGitTicketPage(PageParameters params) {
super(params);
- final String ticketFolder = params.getString("f", "");
+ final String ticketFolder = WicketUtils.getPath(params);
Repository r = getRepository();
TicGitTicket t = JGitUtils.getTicGitTicket(r, ticketFolder);
diff --git a/src/com/gitblit/wicket/pages/TreePage.java b/src/com/gitblit/wicket/pages/TreePage.java
index e24033e4..90e0a65d 100644
--- a/src/com/gitblit/wicket/pages/TreePage.java
+++ b/src/com/gitblit/wicket/pages/TreePage.java
@@ -26,7 +26,7 @@ public class TreePage extends RepositoryPage {
public TreePage(PageParameters params) {
super(params);
- final String basePath = params.getString("f", null);
+ final String basePath = WicketUtils.getPath(params);
Repository r = getRepository();
RevCommit commit = JGitUtils.getCommit(r, objectId);
diff --git a/src/com/gitblit/wicket/panels/LogPanel.java b/src/com/gitblit/wicket/panels/LogPanel.java
index 17b01db4..e496ed06 100644
--- a/src/com/gitblit/wicket/panels/LogPanel.java
+++ b/src/com/gitblit/wicket/panels/LogPanel.java
@@ -33,7 +33,7 @@ public class LogPanel extends Panel {
public LogPanel(String wicketId, final String repositoryName, String objectId, Repository r, int limit, int pageOffset) {
super(wicketId);
boolean pageResults = limit <= 0;
- int itemsPerPage = StoredSettings.getInteger("logPageCommitsCount", 50);
+ int itemsPerPage = StoredSettings.getInteger("logPageCommitCount", 50);
if (itemsPerPage <= 1) {
itemsPerPage = 50;
}
@@ -81,7 +81,7 @@ public class LogPanel extends Panel {
}
item.add(shortlog);
- item.add(new RefsPanel("commitRefs", entry, allRefs));
+ item.add(new RefsPanel("commitRefs", repositoryName, entry, allRefs));
item.add(new BookmarkablePageLink<Void>("view", CommitPage.class, WicketUtils.newObjectParameter(repositoryName, entry.getName())));
item.add(new BookmarkablePageLink<Void>("diff", DiffPage.class, WicketUtils.newObjectParameter(repositoryName, entry.getName())));
diff --git a/src/com/gitblit/wicket/panels/RefsPanel.html b/src/com/gitblit/wicket/panels/RefsPanel.html
index 4012ab1f..5d301931 100644
--- a/src/com/gitblit/wicket/panels/RefsPanel.html
+++ b/src/com/gitblit/wicket/panels/RefsPanel.html
@@ -5,7 +5,7 @@
lang="en">
<wicket:panel>
- <span class="refs" wicket:id="ref">
+ <span wicket:id="ref">
<span wicket:id="refName">ref</span>
</span>
</wicket:panel>
diff --git a/src/com/gitblit/wicket/panels/RefsPanel.java b/src/com/gitblit/wicket/panels/RefsPanel.java
index 5dec57fe..bfdf50c4 100644
--- a/src/com/gitblit/wicket/panels/RefsPanel.java
+++ b/src/com/gitblit/wicket/panels/RefsPanel.java
@@ -13,28 +13,27 @@ 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.ObjectId;
-import org.eclipse.jgit.lib.Repository;
import org.eclipse.jgit.revwalk.RevCommit;
-import com.gitblit.utils.JGitUtils;
+import com.gitblit.wicket.LinkPanel;
import com.gitblit.wicket.WicketUtils;
+import com.gitblit.wicket.pages.LogPage;
+import com.gitblit.wicket.pages.TagPage;
public class RefsPanel extends Panel {
private static final long serialVersionUID = 1L;
- public RefsPanel(String id, Repository r, RevCommit c) {
- this(id, c, JGitUtils.getAllRefs(r));
- }
-
- public RefsPanel(String id, RevCommit c, Map<ObjectId, List<String>> refs) {
+ public RefsPanel(String id, final String repositoryName, RevCommit c, Map<ObjectId, List<String>> refs) {
super(id);
List<String> refNames = refs.get(c.getId());
if (refNames == null) {
refNames = new ArrayList<String>();
}
Collections.sort(refNames);
+ refNames.remove(Constants.HEAD);
+
ListDataProvider<String> refsDp = new ListDataProvider<String>(refNames);
DataView<String> refsView = new DataView<String>("ref", refsDp) {
private static final long serialVersionUID = 1L;
@@ -43,19 +42,23 @@ public class RefsPanel extends Panel {
Component c = null;
if (entry.startsWith(Constants.R_HEADS)) {
// local head
- c = new Label("refName", entry.substring(Constants.R_HEADS.length()));
+ c = new LinkPanel("refName", null, entry.substring(Constants.R_HEADS.length()), LogPage.class, WicketUtils.newObjectParameter(repositoryName, entry));
+// c = new Label("refName", entry.substring(Constants.R_HEADS.length()));
WicketUtils.setCssClass(c, "head");
} else if (entry.startsWith(Constants.R_REMOTES)) {
// remote head
- c = new Label("refName", entry.substring(Constants.R_REMOTES.length()));
+ c = new LinkPanel("refName", null, entry.substring(Constants.R_REMOTES.length()), LogPage.class, WicketUtils.newObjectParameter(repositoryName, entry));
+// c = new Label("refName", entry.substring(Constants.R_REMOTES.length()));
WicketUtils.setCssClass(c, "ref");
} else if (entry.startsWith(Constants.R_TAGS)) {
// tag
- c = new Label("refName", entry.substring(Constants.R_TAGS.length()));
+// c = new BookmarkablePageLink<Void>("refName", TagPage.class, WicketUtils.newObjectParameter(repositoryName, entry));
+ c = new LinkPanel("refName", null, entry.substring(Constants.R_TAGS.length()), TagPage.class, WicketUtils.newObjectParameter(repositoryName, entry));
+ //c = new Label("refName", entry.substring(Constants.R_TAGS.length()));
WicketUtils.setCssClass(c, "tag");
} else {
// other
- c = new Label("refName", entry);
+ c = new Label("refName", entry);
}
WicketUtils.setHtmlTitle(c, entry);
item.add(c);
diff --git a/src/com/gitblit/wicket/resources/gitblit.css b/src/com/gitblit/wicket/resources/gitblit.css
index 6c754323..4587f780 100644
--- a/src/com/gitblit/wicket/resources/gitblit.css
+++ b/src/com/gitblit/wicket/resources/gitblit.css
@@ -409,41 +409,38 @@ td.rightAlign {
text-align: right;
}
-span.refs span {
+span .tag, span .head, span .ref {
padding: 0px 4px;
font-family: sans-serif;
- font-size: 70%;
font-weight: normal;
border: 1px solid;
- background-color: #ffaaff;
- border-color: #ffccff #ff00ee #ff00ee #ffccff;
color: black;
}
-span.refs span a {
+span .tag a, span .head a, span .ref a {
text-decoration: none;
color: inherit;
}
-span.refs span a:hover {
- text-decoration: underline;
+span .tag a:hover, span .head a:hover, span .ref a:hover {
+ color: inherit;
}
-span.refs span.indirect {
- font-style: italic;
+span .tag a span, span .head a span, span .ref a span {
+ font-size: 9px;
}
-span.refs span.ref {
+span .ref {
background-color: #aaaaff;
border-color: #ccccff #0033cc #0033cc #ccccff;
}
-span.refs span.tag {
+span .tag {
background-color: #ffffaa;
border-color: #ffffcc #ffee00 #ffee00 #ffffcc;
}
-span.refs span.head {
+span .head {
background-color: #aaffaa;
border-color: #ccffcc #00cc33 #00cc33 #ccffcc;
} \ No newline at end of file