]> source.dussan.org Git - gitblit.git/commitdiff
Tweaking forks page
authorJames Moger <james.moger@gitblit.com>
Tue, 2 Oct 2012 02:29:56 +0000 (22:29 -0400)
committerJames Moger <james.moger@gitblit.com>
Tue, 2 Oct 2012 02:29:56 +0000 (22:29 -0400)
resources/gitblit.css
src/com/gitblit/wicket/GitBlitWebApp.properties
src/com/gitblit/wicket/pages/ForksPage.html
src/com/gitblit/wicket/pages/ForksPage.java

index 66387d1ea49b32b91870116556516481aef180f5..1d17dc84e8508ff4cd57d91470a1dc804fe60d0c 100644 (file)
@@ -173,6 +173,13 @@ navbar div>ul .menu-dropdown li a:hover,.nav .menu-dropdown li a:hover,.navbar d
        padding: 2px 0px;\r
 }\r
 \r
+.forkSource .forks, .forkEntry .forks {\r
+       font-size: 10px;\r
+       padding-left: 5px;\r
+       text-decoration: underline;\r
+       vertical-align: middle;\r
+}\r
+\r
 div.page_footer {\r
        clear: both;\r
        height: 17px;\r
index 50c43fec8496694dfbf20d89109663a78fce3c21..d30f57103af0398320b8b1619f957378be818ac1 100644 (file)
@@ -332,4 +332,5 @@ gb.canFork = can fork
 gb.canForkDescription = user is permitted to fork authorized repositories\r
 gb.myFork = view my fork\r
 gb.forksProhibited = forks prohibited\r
-gb.forksProhibitedWarning = this repository forbids forks
\ No newline at end of file
+gb.forksProhibitedWarning = this repository forbids forks\r
+gb.noForks = {0} has no forks
\ No newline at end of file
index 68f848951d3f000673671c62332a3ec9a8619812..f59f9ca25313a8d1fea9aeb8de06781b9778a4d9 100644 (file)
@@ -8,17 +8,26 @@
 <wicket:extend>\r
 \r
        <div class="forkSource">\r
-               <b><span class="repositorySwatch" wicket:id="forkSourceSwatch"></span></b>\r
-               <span wicket:id="forkSourceAvatar" style="vertical-align: baseline;"></span>\r
-               <span wicket:id="forkSourceProject">[a project]</span> / <span wicket:id="forkSource">[a fork]</span> \r
+               <div>\r
+                       <b><span class="repositorySwatch" wicket:id="forkSourceSwatch"></span></b>\r
+                       <span wicket:id="forkSourceAvatar" style="vertical-align: baseline;"></span>\r
+                       <span wicket:id="forkSourceProject">[a project]</span> / <span wicket:id="forkSource">[a fork]</span>\r
+               </div> \r
+               <div style="padding-left:32px;" wicket:id="forkSourceOrigin">[origin repository]</div>\r
        </div>\r
        \r
        <div wicket:id="fork">\r
-               <div class="forkEntry">\r
+               <div class="forkEntry" style="margin-left:32px;">\r
                        <span wicket:id="anAvatar" style="vertical-align: baseline;"></span>\r
                        <span wicket:id="aProject">[a project]</span> / <span wicket:id="aFork">[a fork]</span>\r
+                       <span wicket:id="anIcon" class="forks"></span>\r
                </div>\r
        </div>\r
+       \r
+       <wicket:fragment wicket:id="originFragment">\r
+               <p class="originRepository"><wicket:message key="gb.forkedFrom">[forked from]</wicket:message> <span wicket:id="originRepository">[origin repository]</span></p>\r
+       </wicket:fragment>\r
+       \r
 </wicket:extend>       \r
 </body>\r
 </html>
\ No newline at end of file
index 54c2c82adf43a8a89b0f5d318b809d87431735f3..44f0ed14de8833eb5033db5355ed8ff651ef9ab0 100644 (file)
  */\r
 package com.gitblit.wicket.pages;\r
 \r
+import java.text.MessageFormat;\r
 import java.util.ArrayList;\r
 import java.util.List;\r
 \r
 import org.apache.wicket.Component;\r
 import org.apache.wicket.PageParameters;\r
 import org.apache.wicket.markup.html.basic.Label;\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
@@ -98,6 +100,27 @@ public class ForksPage extends RepositoryPage {
                        // user can not view the origin\r
                        add(new Label("forkSource", StringUtils.stripDotGit(source)));\r
                }\r
+               \r
+               // superOrigin?\r
+               if (StringUtils.isEmpty(origin.originRepository)) {\r
+                       // origin is root\r
+                       add(new Label("forkSourceOrigin").setVisible(false));\r
+               } else {\r
+                       // origin has an origin\r
+                       RepositoryModel superOrigin = GitBlit.self().getRepositoryModel(origin.originRepository);\r
+                       if (!user.canViewRepository(superOrigin)) {\r
+                               // show superOrigin repository without link\r
+                               Fragment forkFrag = new Fragment("forkSourceOrigin", "originFragment", this);\r
+                               forkFrag.add(new Label("originRepository", StringUtils.stripDotGit(superOrigin.name)));\r
+                               add(forkFrag);\r
+                       } else {\r
+                               // link to superOrigin repository\r
+                               Fragment forkFrag = new Fragment("forkSourceOrigin", "originFragment", this);\r
+                               forkFrag.add(new LinkPanel("originRepository", null, StringUtils.stripDotGit(superOrigin.name), \r
+                                       SummaryPage.class, WicketUtils.newRepositoryParameter(superOrigin.name)));\r
+                               add(forkFrag);\r
+                       }\r
+               }\r
 \r
                // only display user-accessible forks\r
                List<RepositoryModel> forks = new ArrayList<RepositoryModel>();\r
@@ -129,7 +152,15 @@ public class ForksPage extends RepositoryPage {
                                String repo = StringUtils.getLastPathElement(fork.name);\r
                                item.add(new LinkPanel("aFork", null, StringUtils.stripDotGit(repo), SummaryPage.class, WicketUtils.newRepositoryParameter(fork.name)));\r
                                \r
-                               WicketUtils.setCssStyle(item, "margin-left:25px;");\r
+                               if (ArrayUtils.isEmpty(fork.forks)) {\r
+                                       // repository is a leaf\r
+                                       Component icon = new Label("anIcon", "<i class=\"icon-leaf\" ></i>").setEscapeModelStrings(false);\r
+                                       WicketUtils.setHtmlTooltip(icon, MessageFormat.format(getString("gb.noForks"), fork.name));\r
+                                       item.add(icon);\r
+                               } else {\r
+                                       // show forks link\r
+                                       item.add(new LinkPanel("anIcon", null, "(" + getString("gb.forks") + ")", ForksPage.class, WicketUtils.newRepositoryParameter(fork.name)));\r
+                               }\r
                        }\r
                };\r
                \r