From: James Moger Date: Sun, 13 Jan 2013 21:49:37 +0000 (-0500) Subject: Fix submodule links on commit, comitdiff, and tree page (issue-178) X-Git-Tag: v1.2.1~7 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=9cc56a1f60eff2ce1db40b7078eab92e78602e1c;p=gitblit.git Fix submodule links on commit, comitdiff, and tree page (issue-178) --- diff --git a/src/com/gitblit/wicket/pages/CommitDiffPage.java b/src/com/gitblit/wicket/pages/CommitDiffPage.java index 585ce8e3..3ad70742 100644 --- a/src/com/gitblit/wicket/pages/CommitDiffPage.java +++ b/src/com/gitblit/wicket/pages/CommitDiffPage.java @@ -15,14 +15,14 @@ */ package com.gitblit.wicket.pages; +import java.text.MessageFormat; import java.util.ArrayList; import java.util.List; -import java.text.MessageFormat; - 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.html.link.ExternalLink; import org.apache.wicket.markup.repeater.Item; import org.apache.wicket.markup.repeater.data.DataView; import org.apache.wicket.markup.repeater.data.ListDataProvider; @@ -150,15 +150,12 @@ public class CommitDiffPage extends RepositoryPage { // quick links if (entry.isSubmodule()) { // submodule - item.add(new BookmarkablePageLink("patch", PatchPage.class, WicketUtils - .newPathParameter(submodulePath, entry.objectId, entry.path)).setEnabled(false)); + item.add(new ExternalLink("patch", "").setEnabled(false)); item.add(new BookmarkablePageLink("view", CommitPage.class, WicketUtils .newObjectParameter(submodulePath, entry.objectId)).setEnabled(hasSubmodule)); - item.add(new BookmarkablePageLink("blame", BlamePage.class, WicketUtils - .newPathParameter(submodulePath, entry.objectId, entry.path)).setEnabled(false)); + item.add(new ExternalLink("blame", "").setEnabled(false)); item.add(new BookmarkablePageLink("history", HistoryPage.class, WicketUtils - .newPathParameter(submodulePath, entry.objectId, entry.path)) - .setEnabled(hasSubmodule)); + .newPathParameter(repositoryName, entry.commitId, entry.path))); } else { // tree or blob item.add(new BookmarkablePageLink("patch", PatchPage.class, WicketUtils diff --git a/src/com/gitblit/wicket/pages/CommitPage.java b/src/com/gitblit/wicket/pages/CommitPage.java index 17621ad0..c5a24c8d 100644 --- a/src/com/gitblit/wicket/pages/CommitPage.java +++ b/src/com/gitblit/wicket/pages/CommitPage.java @@ -22,6 +22,7 @@ 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.html.link.ExternalLink; import org.apache.wicket.markup.repeater.Item; import org.apache.wicket.markup.repeater.data.DataView; import org.apache.wicket.markup.repeater.data.ListDataProvider; @@ -184,16 +185,14 @@ public class CommitPage extends RepositoryPage { if (entry.isSubmodule()) { // submodule item.add(new BookmarkablePageLink("diff", BlobDiffPage.class, WicketUtils - .newPathParameter(submodulePath, entry.objectId, entry.path)) - .setEnabled(false)); + .newPathParameter(repositoryName, entry.commitId, entry.path)) + .setEnabled(!entry.changeType.equals(ChangeType.ADD))); item.add(new BookmarkablePageLink("view", CommitPage.class, WicketUtils .newObjectParameter(submodulePath, entry.objectId)).setEnabled(hasSubmodule)); - item.add(new BookmarkablePageLink("blame", BlamePage.class, WicketUtils - .newPathParameter(submodulePath, entry.objectId, entry.path)) - .setEnabled(false)); + item.add(new ExternalLink("blame", "").setEnabled(false)); item.add(new BookmarkablePageLink("history", HistoryPage.class, WicketUtils - .newPathParameter(submodulePath, entry.objectId, entry.path)) - .setEnabled(hasSubmodule)); + .newPathParameter(repositoryName, entry.commitId, entry.path)) + .setEnabled(!entry.changeType.equals(ChangeType.ADD))); } else { // tree or blob item.add(new BookmarkablePageLink("diff", BlobDiffPage.class, WicketUtils diff --git a/src/com/gitblit/wicket/pages/TreePage.java b/src/com/gitblit/wicket/pages/TreePage.java index b8ce7b48..bc27f0c2 100644 --- a/src/com/gitblit/wicket/pages/TreePage.java +++ b/src/com/gitblit/wicket/pages/TreePage.java @@ -137,8 +137,8 @@ public class TreePage extends RepositoryPage { WicketUtils.newPathParameter(submodulePath, submoduleId, "")).setEnabled(hasSubmodule)); links.add(new BookmarkablePageLink("history", HistoryPage.class, - WicketUtils.newPathParameter(submodulePath, submoduleId, - "")).setEnabled(hasSubmodule)); + WicketUtils.newPathParameter(repositoryName, entry.commitId, + entry.path))); links.add(new CompressedDownloadsPanel("compressedLinks", baseUrl, submodulePath, submoduleId, "").setEnabled(hasSubmodule)); item.add(links);