summaryrefslogtreecommitdiffstats
path: root/src/main
diff options
context:
space:
mode:
authorJames Moger <james.moger@gmail.com>2015-07-04 16:21:05 -0400
committerJames Moger <james.moger@gmail.com>2015-07-04 16:21:05 -0400
commitfd651cdfb065c50bbd622fa57386a8c0a050eeec (patch)
tree57b614f4b90e3d84cd6e00e81f30cb702202a9ca /src/main
parent7c4d074a3cc3c204a135ae9aa69b5314980ea8b4 (diff)
parente4dd827ce401144136d270059296108e51707205 (diff)
downloadgitblit-fd651cdfb065c50bbd622fa57386a8c0a050eeec.tar.gz
gitblit-fd651cdfb065c50bbd622fa57386a8c0a050eeec.zip
Merge pull request #284 from mrjoel/mrjoel-useshortrefs
prefer shortened refs for cleaner/shorter URLs
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/com/gitblit/wicket/panels/BranchesPanel.java28
-rw-r--r--src/main/java/com/gitblit/wicket/panels/DigestsPanel.java4
2 files changed, 14 insertions, 18 deletions
diff --git a/src/main/java/com/gitblit/wicket/panels/BranchesPanel.java b/src/main/java/com/gitblit/wicket/panels/BranchesPanel.java
index 4bf00f8a..7a564aa5 100644
--- a/src/main/java/com/gitblit/wicket/panels/BranchesPanel.java
+++ b/src/main/java/com/gitblit/wicket/panels/BranchesPanel.java
@@ -114,11 +114,13 @@ public class BranchesPanel extends BasePanel {
public void populateItem(final Item<RefModel> item) {
final RefModel entry = item.getModelObject();
+ PageParameters shortUniqRef = WicketUtils.newObjectParameter(model.name,
+ Repository.shortenRefName(entry.getName()));
+
item.add(WicketUtils.createDateLabel("branchDate", entry.getDate(), getTimeZone(), getTimeUtils()));
item.add(new LinkPanel("branchName", "list name", StringUtils.trimString(
- entry.displayName, 28), LogPage.class, WicketUtils.newObjectParameter(
- model.name, entry.getName())));
+ entry.displayName, 28), LogPage.class, shortUniqRef));
String author = entry.getAuthorIdent().getName();
LinkPanel authorLink = new LinkPanel("branchAuthor", "list", author,
@@ -131,8 +133,7 @@ public class BranchesPanel extends BasePanel {
String shortMessage = entry.getShortMessage();
String trimmedMessage = StringUtils.trimString(shortMessage, Constants.LEN_SHORTLOG);
LinkPanel shortlog = new LinkPanel("branchLog", "list subject", trimmedMessage,
- CommitPage.class, WicketUtils.newObjectParameter(model.name,
- entry.getName()));
+ CommitPage.class, shortUniqRef);
if (!shortMessage.equals(trimmedMessage)) {
shortlog.setTooltip(shortMessage);
}
@@ -140,27 +141,22 @@ public class BranchesPanel extends BasePanel {
if (maxCount <= 0) {
Fragment fragment = new Fragment("branchLinks", showDelete? "branchPageAdminLinks" : "branchPageLinks", this);
- fragment.add(new BookmarkablePageLink<Void>("log", LogPage.class, WicketUtils
- .newObjectParameter(model.name, entry.getName())));
- fragment.add(new BookmarkablePageLink<Void>("tree", TreePage.class, WicketUtils
- .newObjectParameter(model.name, entry.getName())));
+ fragment.add(new BookmarkablePageLink<Void>("log", LogPage.class, shortUniqRef));
+ fragment.add(new BookmarkablePageLink<Void>("tree", TreePage.class, shortUniqRef));
String rawUrl = RawServlet.asLink(getContextUrl(), model.name, Repository.shortenRefName(entry.getName()), null);
- fragment.add(new ExternalLink("raw", rawUrl));
- fragment.add(new BookmarkablePageLink<Void>("metrics", MetricsPage.class,
- WicketUtils.newObjectParameter(model.name, entry.getName())));
+ fragment.add(new ExternalLink("raw", rawUrl));
+ fragment.add(new BookmarkablePageLink<Void>("metrics", MetricsPage.class, shortUniqRef));
fragment.add(new ExternalLink("syndication", SyndicationServlet.asLink(
getRequest().getRelativePathPrefixToContextRoot(), model.name,
- entry.getName(), 0)));
+ Repository.shortenRefName(entry.getName()), 0)));
if (showDelete) {
fragment.add(createDeleteBranchLink(model, entry));
}
item.add(fragment);
} else {
Fragment fragment = new Fragment("branchLinks", "branchPanelLinks", this);
- fragment.add(new BookmarkablePageLink<Void>("log", LogPage.class, WicketUtils
- .newObjectParameter(model.name, entry.getName())));
- fragment.add(new BookmarkablePageLink<Void>("tree", TreePage.class, WicketUtils
- .newObjectParameter(model.name, entry.getName())));
+ fragment.add(new BookmarkablePageLink<Void>("log", LogPage.class, shortUniqRef));
+ fragment.add(new BookmarkablePageLink<Void>("tree", TreePage.class, shortUniqRef));
String rawUrl = RawServlet.asLink(getContextUrl(), model.name, Repository.shortenRefName(entry.getName()), null);
fragment.add(new ExternalLink("raw", rawUrl));
item.add(fragment);
diff --git a/src/main/java/com/gitblit/wicket/panels/DigestsPanel.java b/src/main/java/com/gitblit/wicket/panels/DigestsPanel.java
index d901945d..0c80f997 100644
--- a/src/main/java/com/gitblit/wicket/panels/DigestsPanel.java
+++ b/src/main/java/com/gitblit/wicket/panels/DigestsPanel.java
@@ -166,7 +166,7 @@ public class DigestsPanel extends BasePanel {
} else if (isTag) {
// link to tag
logItem.add(new LinkPanel("refChanged", null, shortRefName,
- TagPage.class, WicketUtils.newObjectParameter(change.repository, fullRefName)));
+ TagPage.class, WicketUtils.newObjectParameter(change.repository, shortRefName)));
} else if (isTicket) {
// link to ticket
logItem.add(new LinkPanel("refChanged", null, shortRefName,
@@ -174,7 +174,7 @@ public class DigestsPanel extends BasePanel {
} else {
// link to tree
logItem.add(new LinkPanel("refChanged", null, shortRefName,
- TreePage.class, WicketUtils.newObjectParameter(change.repository, fullRefName)));
+ TreePage.class, WicketUtils.newObjectParameter(change.repository, shortRefName)));
}
// to/from/etc