]> source.dussan.org Git - gitblit.git/commitdiff
Ref links.
authorJames Moger <james.moger@gitblit.com>
Mon, 11 Apr 2011 21:42:58 +0000 (17:42 -0400)
committerJames Moger <james.moger@gitblit.com>
Mon, 11 Apr 2011 21:42:58 +0000 (17:42 -0400)
12 files changed:
gitblit.properties
src/com/gitblit/wicket/RepositoryPage.java
src/com/gitblit/wicket/WicketUtils.java
src/com/gitblit/wicket/pages/BlobPage.java
src/com/gitblit/wicket/pages/DiffPage.java
src/com/gitblit/wicket/pages/LogPage.java
src/com/gitblit/wicket/pages/TicGitTicketPage.java
src/com/gitblit/wicket/pages/TreePage.java
src/com/gitblit/wicket/panels/LogPanel.java
src/com/gitblit/wicket/panels/RefsPanel.html
src/com/gitblit/wicket/panels/RefsPanel.java
src/com/gitblit/wicket/resources/gitblit.css

index 8ea1cc66ee384602d03c85ef7bd5bf8890ea5de8..839b914b3fe573aebc428d5875713d2c4e164dbd 100644 (file)
@@ -79,7 +79,7 @@ summaryRefsCount = 5
 \r
 # The number of commits to show on each page of a Log\r
 # Value must exceed 0 else default of 50 is used\r
-logPageCommitsCount = 50\r
+logPageCommitCount = 50\r
 \r
 # Registered extensions for google-code-prettify\r
 prettyPrintExtensions = c cpp cs css htm html java js php pl prefs properties py rb sh sql xml vb\r
index 4e849383bfa76ee981cb04e00d2aec9c257812df..05617718be3afd95781947514babb0b0e50ea50e 100644 (file)
@@ -32,8 +32,8 @@ public abstract class RepositoryPage extends BasePage {
                        error("Repository not specified!");\r
                        redirectToInterceptPage(new RepositoriesPage());\r
                }\r
-               repositoryName = params.getString("r", "");\r
-               objectId = params.getString("h", "HEAD");\r
+               repositoryName = WicketUtils.getRepositoryName(params);\r
+               objectId = WicketUtils.getObject(params);\r
 \r
                Repository r = getRepository();\r
 \r
@@ -64,7 +64,7 @@ public abstract class RepositoryPage extends BasePage {
        }\r
 \r
        protected void addRefs(Repository r, RevCommit c) {\r
-               add(new RefsPanel("refsPanel", r, c));\r
+               add(new RefsPanel("refsPanel", repositoryName,  c, JGitUtils.getAllRefs(r)));\r
        }\r
 \r
        protected void addFullText(String wicketId, String text, boolean substituteRegex) {\r
index bc1f441e21835333e48df1b6c76a29cfc4b970e4..126c37de7af4ca93c1b2177749d36ad26a91c1b6 100644 (file)
@@ -103,6 +103,22 @@ public class WicketUtils {
                return new PageParameters("r=" + repositoryName + ",h=" + objectId + ",page=" + pageNumber);\r
        }\r
        \r
+       public static String getRepositoryName(PageParameters params) {\r
+               return params.getString("r", "");\r
+       }\r
+\r
+       public static String getObject(PageParameters params) {\r
+               return params.getString("h", "");\r
+       }\r
+\r
+       public static String getPath(PageParameters params) {\r
+               return params.getString("f", null);\r
+       }\r
+\r
+       public static int getPage(PageParameters params) {\r
+               return params.getInt("page", 1); // index from 1\r
+       }\r
+\r
        public static Label createDateLabel(String wicketId, Date date, TimeZone timeZone) {\r
                DateFormat df = new SimpleDateFormat(StoredSettings.getString("datestampShortFormat", "MM/dd/yy"));\r
                if (timeZone != null) {\r
index 78429362a74bac2089d749689dcdbbbdfb68591f..7d7259a0e8a17685c21338fbf6a9e7addb20a804 100644 (file)
@@ -22,7 +22,7 @@ public class BlobPage extends RepositoryPage {
        public BlobPage(PageParameters params) {\r
                super(params);\r
 \r
-               final String blobPath = params.getString("f", null);\r
+               final String blobPath = WicketUtils.getPath(params);\r
 \r
                Repository r = getRepository();\r
                RevCommit commit = JGitUtils.getCommit(r, objectId);\r
index 1e6065b3ec2ab257f14d6c6009ec491bdb174320..1912c42d98148ffa66d2a6a978a58805a198c1b4 100644 (file)
@@ -8,6 +8,7 @@ import org.eclipse.jgit.revwalk.RevCommit;
 import com.gitblit.utils.JGitUtils;\r
 import com.gitblit.wicket.LinkPanel;\r
 import com.gitblit.wicket.RepositoryPage;\r
+import com.gitblit.wicket.WicketUtils;\r
 import com.gitblit.wicket.panels.PathBreadcrumbsPanel;\r
 \r
 public class DiffPage extends RepositoryPage {\r
@@ -15,7 +16,7 @@ public class DiffPage extends RepositoryPage {
        public DiffPage(PageParameters params) {\r
                super(params);\r
 \r
-               final String blobPath = params.getString("f", null);\r
+               final String blobPath = WicketUtils.getPath(params);\r
 \r
                Repository r = getRepository();\r
                RevCommit commit = JGitUtils.getCommit(r, objectId);\r
index f9449ad9c4c33e26bdbd4fcc5dd280879420b8ad..cd75df9cc9fbda6ad86333ebcff493a8443c9bab 100644 (file)
@@ -12,7 +12,7 @@ public class LogPage extends RepositoryPage {
        public LogPage(PageParameters params) {\r
                super(params);\r
 \r
-               int pageNumber = params.getInt("page", 1); // index from 1\r
+               int pageNumber = WicketUtils.getPage(params);\r
                int prevPage = Math.max(0, pageNumber - 1);\r
                int nextPage = pageNumber + 1;\r
 \r
index 5d3ceb48090c2645a7c60b770933e4596710594d..5cdc4a7b6ff559b2d5b3d07ca2e95c8bdb72cff1 100644 (file)
@@ -19,7 +19,7 @@ public class TicGitTicketPage extends RepositoryPage {
        public TicGitTicketPage(PageParameters params) {\r
                super(params);\r
 \r
-               final String ticketFolder = params.getString("f", "");\r
+               final String ticketFolder = WicketUtils.getPath(params);\r
 \r
                Repository r = getRepository();\r
                TicGitTicket t = JGitUtils.getTicGitTicket(r, ticketFolder);\r
index e24033e4a3a2a1dfb54a2db6b2fc7c0f248a71fa..90e0a65d0c9506f2cd0ac061056d6ee3365deebc 100644 (file)
@@ -26,7 +26,7 @@ public class TreePage extends RepositoryPage {
        public TreePage(PageParameters params) {\r
                super(params);\r
 \r
-               final String basePath = params.getString("f", null);\r
+               final String basePath = WicketUtils.getPath(params);\r
 \r
                Repository r = getRepository();\r
                RevCommit commit = JGitUtils.getCommit(r, objectId);\r
index 17b01db4281efd143bbf2a158ebe7e1d1bac0a6d..e496ed06048171654d263324056520189bd0a4b7 100644 (file)
@@ -33,7 +33,7 @@ public class LogPanel extends Panel {
        public LogPanel(String wicketId, final String repositoryName, String objectId, Repository r, int limit, int pageOffset) {\r
                super(wicketId);\r
                boolean pageResults = limit <= 0;\r
-               int itemsPerPage = StoredSettings.getInteger("logPageCommitsCount", 50);\r
+               int itemsPerPage = StoredSettings.getInteger("logPageCommitCount", 50);\r
                if (itemsPerPage <= 1) {\r
                        itemsPerPage = 50;\r
                }\r
@@ -81,7 +81,7 @@ public class LogPanel extends Panel {
                                }\r
                                item.add(shortlog);\r
 \r
-                               item.add(new RefsPanel("commitRefs", entry, allRefs));\r
+                               item.add(new RefsPanel("commitRefs", repositoryName, entry, allRefs));\r
 \r
                                item.add(new BookmarkablePageLink<Void>("view", CommitPage.class, WicketUtils.newObjectParameter(repositoryName, entry.getName())));\r
                                item.add(new BookmarkablePageLink<Void>("diff", DiffPage.class, WicketUtils.newObjectParameter(repositoryName, entry.getName())));\r
index 4012ab1f3281e58a2f28033462e2a086d173e9e0..5d301931d7b061b15258b35c6bb0fc5434fef174 100644 (file)
@@ -5,7 +5,7 @@
       lang="en"> \r
 \r
 <wicket:panel>\r
-       <span class="refs" wicket:id="ref">\r
+       <span wicket:id="ref">\r
                <span wicket:id="refName">ref</span>\r
        </span> \r
 </wicket:panel>\r
index 5dec57feb2f31412201cb02db56c176cdec50f16..bfdf50c4bddd21c1e848f62cbcb07266c80a0bfd 100644 (file)
@@ -13,28 +13,27 @@ import org.apache.wicket.markup.repeater.data.DataView;
 import org.apache.wicket.markup.repeater.data.ListDataProvider;\r
 import org.eclipse.jgit.lib.Constants;\r
 import org.eclipse.jgit.lib.ObjectId;\r
-import org.eclipse.jgit.lib.Repository;\r
 import org.eclipse.jgit.revwalk.RevCommit;\r
 \r
-import com.gitblit.utils.JGitUtils;\r
+import com.gitblit.wicket.LinkPanel;\r
 import com.gitblit.wicket.WicketUtils;\r
+import com.gitblit.wicket.pages.LogPage;\r
+import com.gitblit.wicket.pages.TagPage;\r
 \r
 \r
 public class RefsPanel extends Panel {\r
 \r
        private static final long serialVersionUID = 1L;\r
 \r
-       public RefsPanel(String id, Repository r, RevCommit c) {\r
-               this(id, c, JGitUtils.getAllRefs(r));\r
-       }\r
-       \r
-       public RefsPanel(String id, RevCommit c, Map<ObjectId, List<String>> refs) {\r
+       public RefsPanel(String id, final String repositoryName, RevCommit c, Map<ObjectId, List<String>> refs) {\r
                super(id);\r
                List<String> refNames = refs.get(c.getId());\r
                if (refNames == null) {\r
                        refNames = new ArrayList<String>();\r
                }\r
                Collections.sort(refNames);\r
+               refNames.remove(Constants.HEAD);\r
+               \r
                ListDataProvider<String> refsDp = new ListDataProvider<String>(refNames);\r
                DataView<String> refsView = new DataView<String>("ref", refsDp) {\r
                        private static final long serialVersionUID = 1L;\r
@@ -43,19 +42,23 @@ public class RefsPanel extends Panel {
                                Component c = null;\r
                                if (entry.startsWith(Constants.R_HEADS)) {\r
                                        // local head\r
-                                       c = new Label("refName", entry.substring(Constants.R_HEADS.length()));\r
+                                       c = new LinkPanel("refName", null, entry.substring(Constants.R_HEADS.length()), LogPage.class, WicketUtils.newObjectParameter(repositoryName, entry));\r
+//                                     c = new Label("refName", entry.substring(Constants.R_HEADS.length()));\r
                                        WicketUtils.setCssClass(c, "head");\r
                                } else if (entry.startsWith(Constants.R_REMOTES)) {\r
                                        // remote head\r
-                                       c = new Label("refName", entry.substring(Constants.R_REMOTES.length()));\r
+                                       c = new LinkPanel("refName", null, entry.substring(Constants.R_REMOTES.length()), LogPage.class, WicketUtils.newObjectParameter(repositoryName, entry));\r
+//                                     c = new Label("refName", entry.substring(Constants.R_REMOTES.length()));\r
                                        WicketUtils.setCssClass(c, "ref");\r
                                } else if (entry.startsWith(Constants.R_TAGS)) {\r
                                        // tag\r
-                                       c = new Label("refName", entry.substring(Constants.R_TAGS.length()));\r
+//                                     c = new BookmarkablePageLink<Void>("refName", TagPage.class, WicketUtils.newObjectParameter(repositoryName, entry));\r
+                                       c = new LinkPanel("refName", null, entry.substring(Constants.R_TAGS.length()), TagPage.class, WicketUtils.newObjectParameter(repositoryName, entry));\r
+                                       //c = new Label("refName", entry.substring(Constants.R_TAGS.length()));\r
                                        WicketUtils.setCssClass(c, "tag");\r
                                } else {\r
                                        // other\r
-                                       c = new Label("refName", entry);                                        \r
+                                       c = new Label("refName", entry);\r
                                }\r
                                WicketUtils.setHtmlTitle(c, entry);\r
                                item.add(c);\r
index 6c754323d19a15835d84d2ca280fa27277ac6577..4587f7804baf9771c4f3ad0473ebad58292b9c9e 100644 (file)
@@ -409,41 +409,38 @@ td.rightAlign {
        text-align: right;\r
 }\r
 \r
-span.refs span {\r
+span .tag, span .head, span .ref {\r
        padding: 0px 4px;\r
        font-family: sans-serif;\r
-       font-size: 70%;\r
        font-weight: normal;\r
        border: 1px solid;\r
-       background-color: #ffaaff;\r
-       border-color: #ffccff #ff00ee #ff00ee #ffccff;\r
        color: black;\r
 }\r
 \r
-span.refs span a {\r
+span .tag a, span .head a, span .ref a {\r
        text-decoration: none;\r
        color: inherit;\r
 }\r
 \r
-span.refs span a:hover {\r
-       text-decoration: underline;\r
+span .tag a:hover, span .head a:hover, span .ref a:hover {\r
+       color: inherit;\r
 }\r
 \r
-span.refs span.indirect {\r
-       font-style: italic;\r
+span .tag a span, span .head a span, span .ref a span {\r
+       font-size: 9px;\r
 }\r
 \r
-span.refs span.ref {\r
+span .ref {\r
        background-color: #aaaaff;\r
        border-color: #ccccff #0033cc #0033cc #ccccff;\r
 }\r
 \r
-span.refs span.tag {\r
+span .tag {\r
        background-color: #ffffaa;\r
        border-color: #ffffcc #ffee00 #ffee00 #ffffcc;\r
 }\r
 \r
-span.refs span.head {\r
+span .head {\r
        background-color: #aaffaa;\r
        border-color: #ccffcc #00cc33 #00cc33 #ccffcc;\r
 }
\ No newline at end of file