]> source.dussan.org Git - gitblit.git/commitdiff
Fix submodule links on commit, comitdiff, and tree page (issue-178)
authorJames Moger <james.moger@gitblit.com>
Sun, 13 Jan 2013 21:49:37 +0000 (16:49 -0500)
committerJames Moger <james.moger@gitblit.com>
Sun, 13 Jan 2013 21:49:37 +0000 (16:49 -0500)
src/com/gitblit/wicket/pages/CommitDiffPage.java
src/com/gitblit/wicket/pages/CommitPage.java
src/com/gitblit/wicket/pages/TreePage.java

index 585ce8e34cc43da1b2ff981d74abc6364348658b..3ad70742706f153b97af3c2182144a723dd8a722 100644 (file)
  */
 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<Void>("patch", PatchPage.class, WicketUtils
-                                                       .newPathParameter(submodulePath, entry.objectId, entry.path)).setEnabled(false));
+                                       item.add(new ExternalLink("patch", "").setEnabled(false));
                                        item.add(new BookmarkablePageLink<Void>("view", CommitPage.class, WicketUtils
                                                        .newObjectParameter(submodulePath, entry.objectId)).setEnabled(hasSubmodule));
-                                       item.add(new BookmarkablePageLink<Void>("blame", BlamePage.class, WicketUtils
-                                                       .newPathParameter(submodulePath, entry.objectId, entry.path)).setEnabled(false));
+                                       item.add(new ExternalLink("blame", "").setEnabled(false));
                                        item.add(new BookmarkablePageLink<Void>("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<Void>("patch", PatchPage.class, WicketUtils
index 17621ad00497427b6c9fa6278bbc9fb8dbd2b23a..c5a24c8d86ada91556a16fa744b8e01f266812bd 100644 (file)
@@ -22,6 +22,7 @@ import java.util.List;
 import org.apache.wicket.PageParameters;\r
 import org.apache.wicket.markup.html.basic.Label;\r
 import org.apache.wicket.markup.html.link.BookmarkablePageLink;\r
+import org.apache.wicket.markup.html.link.ExternalLink;\r
 import org.apache.wicket.markup.repeater.Item;\r
 import org.apache.wicket.markup.repeater.data.DataView;\r
 import org.apache.wicket.markup.repeater.data.ListDataProvider;\r
@@ -184,16 +185,14 @@ public class CommitPage extends RepositoryPage {
                                if (entry.isSubmodule()) {\r
                                        // submodule                                    \r
                                        item.add(new BookmarkablePageLink<Void>("diff", BlobDiffPage.class, WicketUtils\r
-                                                       .newPathParameter(submodulePath, entry.objectId, entry.path))\r
-                                                       .setEnabled(false));\r
+                                                       .newPathParameter(repositoryName, entry.commitId, entry.path))\r
+                                                       .setEnabled(!entry.changeType.equals(ChangeType.ADD)));\r
                                        item.add(new BookmarkablePageLink<Void>("view", CommitPage.class, WicketUtils\r
                                                        .newObjectParameter(submodulePath, entry.objectId)).setEnabled(hasSubmodule));\r
-                                       item.add(new BookmarkablePageLink<Void>("blame", BlamePage.class, WicketUtils\r
-                                                       .newPathParameter(submodulePath, entry.objectId, entry.path))\r
-                                                       .setEnabled(false));\r
+                                       item.add(new ExternalLink("blame", "").setEnabled(false));\r
                                        item.add(new BookmarkablePageLink<Void>("history", HistoryPage.class, WicketUtils\r
-                                                       .newPathParameter(submodulePath, entry.objectId, entry.path))\r
-                                                       .setEnabled(hasSubmodule));\r
+                                                       .newPathParameter(repositoryName, entry.commitId, entry.path))\r
+                                                       .setEnabled(!entry.changeType.equals(ChangeType.ADD)));\r
                                } else {\r
                                        // tree or blob\r
                                        item.add(new BookmarkablePageLink<Void>("diff", BlobDiffPage.class, WicketUtils\r
index b8ce7b489199077351719205b8aa522caabadc1c..bc27f0c2d310bb99bafe7e8540cc3d82fe2aa2b5 100644 (file)
@@ -137,8 +137,8 @@ public class TreePage extends RepositoryPage {
                                                                WicketUtils.newPathParameter(submodulePath, submoduleId,\r
                                                                                "")).setEnabled(hasSubmodule));\r
                                                links.add(new BookmarkablePageLink<Void>("history", HistoryPage.class,\r
-                                                               WicketUtils.newPathParameter(submodulePath, submoduleId,\r
-                                                                               "")).setEnabled(hasSubmodule));\r
+                                                               WicketUtils.newPathParameter(repositoryName, entry.commitId,\r
+                                                                               entry.path)));\r
                                                links.add(new CompressedDownloadsPanel("compressedLinks", baseUrl,\r
                                                                submodulePath, submoduleId, "").setEnabled(hasSubmodule));\r
                                                item.add(links);                                                \r