]> source.dussan.org Git - gitblit.git/commitdiff
Refactored more link panels into fragments.
authorJames Moger <james.moger@gitblit.com>
Mon, 11 Apr 2011 13:39:15 +0000 (09:39 -0400)
committerJames Moger <james.moger@gitblit.com>
Mon, 11 Apr 2011 13:39:15 +0000 (09:39 -0400)
14 files changed:
src/com/gitblit/wicket/GitBlitWebApp.properties
src/com/gitblit/wicket/pages/CommitPage.html
src/com/gitblit/wicket/pages/CommitPage.java
src/com/gitblit/wicket/pages/RepositoriesPage.html
src/com/gitblit/wicket/pages/RepositoriesPage.java
src/com/gitblit/wicket/pages/TreePage.html
src/com/gitblit/wicket/pages/TreePage.java
src/com/gitblit/wicket/panels/AdminLinksPanel.html [deleted file]
src/com/gitblit/wicket/panels/AdminLinksPanel.java [deleted file]
src/com/gitblit/wicket/panels/PathBreadcrumbsPanel.java
src/com/gitblit/wicket/panels/TreeBlobLinksPanel.html [deleted file]
src/com/gitblit/wicket/panels/TreeBlobLinksPanel.java [deleted file]
src/com/gitblit/wicket/panels/TreeLinksPanel.html [deleted file]
src/com/gitblit/wicket/panels/TreeLinksPanel.java [deleted file]

index a16ea74c50f94beb2b4b87c6f3da88443eba0f1a..1d7e7bab7ee32b63c1f14db4bf05f4fc9679d462 100644 (file)
@@ -37,4 +37,5 @@ gb.commitdiff = commitdiff
 gb.ticgit = ticgit\r
 gb.pageFirst = first\r
 gb.pagePrevious prev\r
-gb.pageNext = next
\ No newline at end of file
+gb.pageNext = next\r
+gb.parent = parent
\ No newline at end of file
index e49cd5764b42b4a8479a0a12d401b1e224652bcc..e3434c45f189b5c1c2c84e66fdea9b2c3c568355 100644 (file)
@@ -12,7 +12,7 @@
        \r
        <!-- commit nav links -->       \r
        <div class="page_nav2">\r
-               parent: <span wicket:id="parentLink">[parent link]</span> | <span wicket:id="patchLink">[patch link]</span>\r
+               <wicket:message key="gb.parent"></wicket:message>: <span wicket:id="parentLink">[parent link]</span> | <span wicket:id="patchLink">[patch link]</span> | <span wicket:id="commitdiffLink">[commitdiff link]</span>\r
        </div>  \r
        \r
        <!-- shortlog header -->\r
index b0a92b064cbf96bee7e4f36162d0ea39b5bc6dcc..7de03457ef1631aa27b1cbb193b0bbbbaf197ea4 100644 (file)
@@ -9,6 +9,7 @@ import org.apache.wicket.markup.html.link.BookmarkablePageLink;
 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
+import org.apache.wicket.model.StringResourceModel;\r
 import org.eclipse.jgit.lib.Repository;\r
 import org.eclipse.jgit.revwalk.RevCommit;\r
 \r
@@ -25,10 +26,8 @@ public class CommitPage extends RepositoryPage {
        public CommitPage(PageParameters params) {\r
                super(params);\r
 \r
-               final String commitId = params.getString("h", "");\r
-\r
                Repository r = getRepository();\r
-               RevCommit c = JGitUtils.getCommit(r, commitId);\r
+               RevCommit c = JGitUtils.getCommit(r, objectId);\r
                \r
                List<String> parents = new ArrayList<String>();\r
                if (c.getParentCount() > 0) {\r
@@ -40,8 +39,10 @@ public class CommitPage extends RepositoryPage {
                // commit page links\r
                if (parents.size() == 0) {\r
                        add(new Label("parentLink", "none"));\r
+                       add(new Label("commitdiffLink", getString("gb.commitdiff")));\r
                } else {\r
                        add(new LinkPanel("parentLink", null, parents.get(0).substring(0, 8), CommitPage.class, newCommitParameter(parents.get(0))));\r
+                       add(new LinkPanel("commitdiffLink", null, new StringResourceModel("gb.commitdiff", this, null), DiffPage.class, WicketUtils.newObjectParameter(repositoryName, objectId)));\r
                }\r
                add(new Label("patchLink", getString("gb.patch")));\r
                \r
index 5a84ee299b22f989acb2464a42db4a29bf5da358..9bcb9b802e32e20215212e9cb6e0ab57cd9d667a 100644 (file)
                        </tr>\r
        </tbody>\r
        </table>\r
+       \r
+       <wicket:fragment wicket:id="adminLinks">\r
+               <!-- page nav links --> \r
+               <div class="page_nav">\r
+                       <a wicket:id="newRepository"><wicket:message key="gb.newRepository"></wicket:message></a> | <a wicket:id="newUser"><wicket:message key="gb.newUser"></wicket:message></a>\r
+               </div>  \r
+       </wicket:fragment>\r
 </wicket:extend>\r
 </body>\r
 </html>
\ No newline at end of file
index 83d675200d48bcfab3f42e35faa7dc9fc536db54..47d4512282c55110ef7510615cc1dfa5e55a91e6 100644 (file)
@@ -10,6 +10,8 @@ import org.apache.wicket.extensions.markup.html.repeater.data.sort.OrderByBorder
 import org.apache.wicket.extensions.markup.html.repeater.util.SortParam;\r
 import org.apache.wicket.extensions.markup.html.repeater.util.SortableDataProvider;\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.panel.Fragment;\r
 import org.apache.wicket.markup.repeater.Item;\r
 import org.apache.wicket.markup.repeater.data.DataView;\r
 import org.apache.wicket.model.IModel;\r
@@ -22,7 +24,6 @@ import com.gitblit.wicket.GitBlitWebApp;
 import com.gitblit.wicket.LinkPanel;\r
 import com.gitblit.wicket.WicketUtils;\r
 import com.gitblit.wicket.models.RepositoryModel;\r
-import com.gitblit.wicket.panels.AdminLinksPanel;\r
 \r
 \r
 public class RepositoriesPage extends BasePage {\r
@@ -31,7 +32,10 @@ public class RepositoriesPage extends BasePage {
                super();\r
                setupPage("", "");\r
                \r
-               add(new AdminLinksPanel("adminPanel").setVisible(StoredSettings.getBoolean("allowAdministration", false)));\r
+               Fragment adminLinks = new Fragment("adminPanel", "adminLinks", this);\r
+               adminLinks.add(new BookmarkablePageLink<Void>("newRepository", RepositoriesPage.class));\r
+               adminLinks.add(new BookmarkablePageLink<Void>("newUser", RepositoriesPage.class));\r
+               add(adminLinks.setVisible(StoredSettings.getBoolean("allowAdministration", false)));\r
                \r
                add(new Label("repositoriesMessage", StoredSettings.getString("repositoriesMessage", "")).setEscapeModelStrings(false));\r
 \r
index 2bfbb992dd53cf7b4f923946b56b3c07d598237e..3eda96b70d8c4bed8741d7649a26e455118508d9 100644 (file)
                        <td><span wicket:id="pathName"></span></td>                     \r
                        <td class="size"><span wicket:id="pathSize">[path size]</span></td>\r
                        <td class="mode"><span wicket:id="pathPermissions">[path permissions]</span></td>\r
-                       <td class="rightAlign"><span wicket:id="treeLinks">[path links]</span></td>\r
+                       <td class="rightAlign"><span wicket:id="pathLinks">[path links]</span></td>\r
                </tr>\r
        </table>\r
 \r
+       <!--  tree links -->\r
+       <wicket:fragment wicket:id="treeLinks">\r
+               <div class="link">\r
+                       <a wicket:id="tree"><wicket:message key="gb.tree"></wicket:message></a> | <a wicket:id="history"><wicket:message key="gb.history"></wicket:message></a>\r
+               </div>\r
+       </wicket:fragment>\r
+       \r
+       <!-- blob links -->\r
+       <wicket:fragment wicket:id="blobLinks">\r
+               <div class="link">\r
+                       <a wicket:id="view"><wicket:message key="gb.view"></wicket:message></a> | <a wicket:id="raw"><wicket:message key="gb.raw"></wicket:message></a> | <a wicket:id="history"><wicket:message key="gb.history"></wicket:message></a>\r
+               </div>  \r
+       </wicket:fragment>\r
+       \r
 </wicket:extend>       \r
 </body>\r
 </html>
\ No newline at end of file
index 493313ee45f45c5a0dbd04658a7d24ac53a049bc..e24033e4a3a2a1dfb54a2db6b2fc7c0f248a71fa 100644 (file)
@@ -4,6 +4,8 @@ import java.util.List;
 \r
 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.panel.Fragment;\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
@@ -17,8 +19,6 @@ import com.gitblit.wicket.RepositoryPage;
 import com.gitblit.wicket.WicketUtils;\r
 import com.gitblit.wicket.models.PathModel;\r
 import com.gitblit.wicket.panels.PathBreadcrumbsPanel;\r
-import com.gitblit.wicket.panels.TreeBlobLinksPanel;\r
-import com.gitblit.wicket.panels.TreeLinksPanel;\r
 \r
 \r
 public class TreePage extends RepositoryPage {\r
@@ -59,22 +59,32 @@ public class TreePage extends RepositoryPage {
                                        // parent .. path\r
                                        item.add(new Label("pathSize", ""));\r
                                        item.add(new LinkPanel("pathName", null, entry.name, TreePage.class, newPathParameter(entry.path)));\r
-                                       item.add(new Label("treeLinks", ""));\r
+                                       item.add(new Label("pathLinks", ""));\r
                                } else {\r
                                        if (entry.isTree()) {\r
                                                // folder/tree link\r
                                                item.add(new Label("pathSize", ""));\r
                                                item.add(new LinkPanel("pathName", null, entry.name, TreePage.class, newPathParameter(entry.path)));\r
-                                               item.add(new TreeLinksPanel("treeLinks", repositoryName, entry));\r
+                                               \r
+                                               // links\r
+                                               Fragment links = new Fragment("pathLinks", "treeLinks", this);\r
+                                               links.add(new BookmarkablePageLink<Void>("tree", TreePage.class, WicketUtils.newPathParameter(repositoryName, entry.commitId, entry.path)));\r
+                                               links.add(new BookmarkablePageLink<Void>("history", TreePage.class).setEnabled(false));\r
+                                               item.add(links);\r
                                        } else {\r
                                                // blob link\r
                                                item.add(new Label("pathSize", byteFormat.format(entry.size)));\r
                                                item.add(new LinkPanel("pathName", "list", entry.name, BlobPage.class, newPathParameter(entry.path)));\r
-                                               item.add(new TreeBlobLinksPanel("treeLinks", repositoryName, entry));\r
+                                               \r
+                                               // links\r
+                                               Fragment links = new Fragment("pathLinks", "blobLinks", this);\r
+                                               links.add(new BookmarkablePageLink<Void>("view", BlobPage.class, WicketUtils.newPathParameter(repositoryName, entry.commitId, entry.path)));\r
+                                               links.add(new BookmarkablePageLink<Void>("raw", BlobPage.class).setEnabled(false));\r
+                                               links.add(new BookmarkablePageLink<Void>("history", BlobPage.class).setEnabled(false));\r
+                                               item.add(links);\r
                                        }\r
                                }\r
-                               String clazz = counter % 2 == 0 ? "dark" : "light";\r
-                               WicketUtils.setCssClass(item, clazz);\r
+                               WicketUtils.setAlternatingBackground(item, counter);\r
                                counter++;\r
                        }\r
                };\r
diff --git a/src/com/gitblit/wicket/panels/AdminLinksPanel.html b/src/com/gitblit/wicket/panels/AdminLinksPanel.html
deleted file mode 100644 (file)
index 9e12823..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">\r
-<html xmlns="http://www.w3.org/1999/xhtml"  \r
-      xmlns:wicket="http://wicket.apache.org/dtds.data/wicket-xhtml1.3-strict.dtd"  \r
-      xml:lang="en"  \r
-      lang="en"> \r
-\r
-<wicket:panel>\r
-       <!-- page nav links --> \r
-       <div class="page_nav">\r
-               <a wicket:id="newRepository"><wicket:message key="gb.newRepository"></wicket:message></a> | <a wicket:id="newUser"><wicket:message key="gb.newUser"></wicket:message></a>\r
-       </div>  \r
-</wicket:panel>\r
-</html>
\ No newline at end of file
diff --git a/src/com/gitblit/wicket/panels/AdminLinksPanel.java b/src/com/gitblit/wicket/panels/AdminLinksPanel.java
deleted file mode 100644 (file)
index 3199447..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-package com.gitblit.wicket.panels;\r
-\r
-import org.apache.wicket.markup.html.link.BookmarkablePageLink;\r
-import org.apache.wicket.markup.html.panel.Panel;\r
-\r
-import com.gitblit.wicket.pages.RepositoriesPage;\r
-\r
-public class AdminLinksPanel extends Panel {\r
-\r
-       private static final long serialVersionUID = 1L;\r
-\r
-       public AdminLinksPanel(String id) {\r
-               super(id);\r
-\r
-               add(new BookmarkablePageLink<Void>("newRepository", RepositoriesPage.class));\r
-               add(new BookmarkablePageLink<Void>("newUser", RepositoriesPage.class));\r
-       }\r
-}
\ No newline at end of file
index d27133ce45d7824c19b48408aac176f9b0b4dc18..974fb9a0ed922af66fa6c4a47efa66cb8e6d723a 100644 (file)
@@ -20,7 +20,7 @@ public class PathBreadcrumbsPanel extends Panel {
 \r
        private final String ROOT = "--ROOT--";\r
 \r
-       public PathBreadcrumbsPanel(String id, final String repositoryName, String pathName, final String commitId) {\r
+       public PathBreadcrumbsPanel(String id, final String repositoryName, String pathName, final String objectId) {\r
                super(id);\r
                List<BreadCrumb> crumbs = new ArrayList<BreadCrumb>();\r
                crumbs.add(new BreadCrumb("[" + repositoryName + "]", ROOT, false));\r
@@ -44,13 +44,13 @@ public class PathBreadcrumbsPanel extends Panel {
                        public void populateItem(final Item<BreadCrumb> item) {\r
                                final BreadCrumb entry = item.getModelObject();\r
                                String path = entry.getPath();\r
-                               String parameters = "p=" + repositoryName + ",h=" + commitId;\r
-                               if (path != null) {\r
-                                       parameters += ",f=" + path;\r
+                               if (entry.isLeaf) {\r
+                                       item.add(new Label("pathLink", entry.name));\r
+                                       item.add(new Label("pathSeparator", "").setVisible(false));\r
+                               } else {\r
+                                       item.add(new LinkPanel("pathLink", null, entry.name, TreePage.class, WicketUtils.newPathParameter(repositoryName, objectId, path)));\r
+                                       item.add(new Label("pathSeparator", "/"));\r
                                }\r
-\r
-                               item.add(new LinkPanel("pathLink", null, entry.name, TreePage.class, WicketUtils.newPathParameter(repositoryName, commitId, path)));\r
-                               item.add(new Label("pathSeparator", entry.isLeaf ? "" : "/"));\r
                        }\r
                };\r
                add(pathsView);\r
diff --git a/src/com/gitblit/wicket/panels/TreeBlobLinksPanel.html b/src/com/gitblit/wicket/panels/TreeBlobLinksPanel.html
deleted file mode 100644 (file)
index 9f5c6a7..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">\r
-<html xmlns="http://www.w3.org/1999/xhtml"  \r
-      xmlns:wicket="http://wicket.apache.org/dtds.data/wicket-xhtml1.3-strict.dtd"  \r
-      xml:lang="en"  \r
-      lang="en"> \r
-\r
-<wicket:panel>\r
-       <div class="link">\r
-               <a wicket:id="view"><wicket:message key="gb.view"></wicket:message></a> | <a wicket:id="raw"><wicket:message key="gb.raw"></wicket:message></a> | <a wicket:id="history"><wicket:message key="gb.history"></wicket:message></a>\r
-       </div>  \r
-</wicket:panel>\r
-</html>
\ No newline at end of file
diff --git a/src/com/gitblit/wicket/panels/TreeBlobLinksPanel.java b/src/com/gitblit/wicket/panels/TreeBlobLinksPanel.java
deleted file mode 100644 (file)
index e1e6f79..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-package com.gitblit.wicket.panels;\r
-\r
-import org.apache.wicket.markup.html.link.BookmarkablePageLink;\r
-import org.apache.wicket.markup.html.panel.Panel;\r
-\r
-import com.gitblit.wicket.WicketUtils;\r
-import com.gitblit.wicket.models.PathModel;\r
-import com.gitblit.wicket.pages.BlobPage;\r
-\r
-\r
-public class TreeBlobLinksPanel extends Panel {\r
-\r
-       private static final long serialVersionUID = 1L;\r
-\r
-       public TreeBlobLinksPanel(String id, String repositoryName, PathModel path) {\r
-               super(id);\r
-               add(new BookmarkablePageLink<Void>("view", BlobPage.class, WicketUtils.newPathParameter(repositoryName, path.commitId, path.path)));\r
-               add(new BookmarkablePageLink<Void>("raw", BlobPage.class).setEnabled(false));\r
-               add(new BookmarkablePageLink<Void>("history", BlobPage.class).setEnabled(false));\r
-       }\r
-}
\ No newline at end of file
diff --git a/src/com/gitblit/wicket/panels/TreeLinksPanel.html b/src/com/gitblit/wicket/panels/TreeLinksPanel.html
deleted file mode 100644 (file)
index 69f3dec..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">\r
-<html xmlns="http://www.w3.org/1999/xhtml"  \r
-      xmlns:wicket="http://wicket.apache.org/dtds.data/wicket-xhtml1.3-strict.dtd"  \r
-      xml:lang="en"  \r
-      lang="en"> \r
-\r
-<wicket:panel>\r
-       <div class="link">\r
-               <a wicket:id="tree"><wicket:message key="gb.tree"></wicket:message></a> | <a wicket:id="history"><wicket:message key="gb.history"></wicket:message></a>\r
-       </div>  \r
-</wicket:panel>\r
-</html>
\ No newline at end of file
diff --git a/src/com/gitblit/wicket/panels/TreeLinksPanel.java b/src/com/gitblit/wicket/panels/TreeLinksPanel.java
deleted file mode 100644 (file)
index 4965004..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-package com.gitblit.wicket.panels;\r
-\r
-import org.apache.wicket.markup.html.link.BookmarkablePageLink;\r
-import org.apache.wicket.markup.html.panel.Panel;\r
-\r
-import com.gitblit.wicket.WicketUtils;\r
-import com.gitblit.wicket.models.PathModel;\r
-import com.gitblit.wicket.pages.TreePage;\r
-\r
-\r
-public class TreeLinksPanel extends Panel {\r
-\r
-       private static final long serialVersionUID = 1L;\r
-\r
-       public TreeLinksPanel(String id, String repositoryName, PathModel path) {\r
-               super(id);\r
-               add(new BookmarkablePageLink<Void>("tree", TreePage.class, WicketUtils.newPathParameter(repositoryName, path.commitId, path.path)));\r
-               add(new BookmarkablePageLink<Void>("history", TreePage.class).setEnabled(false));\r
-       }\r
-}
\ No newline at end of file