summaryrefslogtreecommitdiffstats
path: root/src/main
diff options
context:
space:
mode:
authorJoel Johnson <mrjoel@lixil.net>2015-07-01 01:15:02 -0600
committerJoel Johnson <mrjoel@lixil.net>2015-07-01 11:15:53 -0600
commite4dd827ce401144136d270059296108e51707205 (patch)
tree219f4b7a82ce6546646ec950c3169dfca63992ec /src/main
parent124fd6e639b0bc43f3714134d6dead77895fd490 (diff)
downloadgitblit-e4dd827ce401144136d270059296108e51707205.tar.gz
gitblit-e4dd827ce401144136d270059296108e51707205.zip
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