]> source.dussan.org Git - gitblit.git/commitdiff
Improve readability of Gerrit change ref and added tooltip
authorJames Moger <james.moger@gitblit.com>
Fri, 21 Jun 2013 12:30:15 +0000 (08:30 -0400)
committerJames Moger <james.moger@gitblit.com>
Fri, 21 Jun 2013 12:30:15 +0000 (08:30 -0400)
src/main/java/com/gitblit/wicket/GitBlitWebApp.properties
src/main/java/com/gitblit/wicket/panels/RefsPanel.java

index f3c6d71da45d66a732ecb67451f21a71e63a5dbc..34ba138c9f10bd51716d7bb8e95399e4d5921e68 100644 (file)
@@ -496,4 +496,5 @@ gb.reflog = reflog
 gb.active = active
 gb.starred = starred
 gb.owned = owned
-gb.starredAndOwned = starred & owned
\ No newline at end of file
+gb.starredAndOwned = starred & owned
+gb.reviewPatchset = review {0} patchset {1}
\ No newline at end of file
index 7ea353961068642b4c67aaf10ad89c24b2ebcb62..e477b65fae44c6f66489aacea18f454b5a96aed4 100644 (file)
@@ -15,6 +15,7 @@
  */\r
 package com.gitblit.wicket.panels;\r
 \r
+import java.text.MessageFormat;\r
 import java.util.ArrayList;\r
 import java.util.Collections;\r
 import java.util.Comparator;\r
@@ -33,6 +34,7 @@ import org.eclipse.jgit.revwalk.RevCommit;
 \r
 import com.gitblit.Constants;\r
 import com.gitblit.models.RefModel;\r
+import com.gitblit.utils.StringUtils;\r
 import com.gitblit.wicket.WicketUtils;\r
 import com.gitblit.wicket.pages.CommitPage;\r
 import com.gitblit.wicket.pages.LogPage;\r
@@ -99,6 +101,7 @@ public class RefsPanel extends Panel {
                                boolean breakLine = false;\r
                                Class<? extends WebPage> linkClass = CommitPage.class;\r
                                String cssClass = "";\r
+                               String tooltip = "";\r
                                if (name.startsWith(Constants.R_HEADS)) {\r
                                        // local branch\r
                                        linkClass = LogPage.class;\r
@@ -111,6 +114,10 @@ public class RefsPanel extends Panel {
                                } else if (name.startsWith(Constants.R_CHANGES)) {\r
                                        // Gerrit change ref\r
                                        name = name.substring(Constants.R_CHANGES.length());\r
+                                       // strip leading nn/ from nn/#####nn/ps = #####nn-ps\r
+                                       name = name.substring(name.indexOf('/') + 1).replace('/', '-');\r
+                                       String [] values = name.split("-");\r
+                                       tooltip = MessageFormat.format(getString("gb.reviewPatchset"), values[0], values[1]);\r
                                        cssClass = "otherRef";\r
                                } else if (name.startsWith(Constants.R_PULL)) {\r
                                        // Pull Request ref\r
@@ -154,7 +161,11 @@ public class RefsPanel extends Panel {
                                Component c = new LinkPanel("refName", null, name, linkClass,\r
                                                WicketUtils.newObjectParameter(repositoryName, objectid));\r
                                WicketUtils.setCssClass(c, cssClass);\r
-                               WicketUtils.setHtmlTooltip(c, name);\r
+                               if (StringUtils.isEmpty(tooltip)) {\r
+                                       WicketUtils.setHtmlTooltip(c, name);\r
+                               } else {\r
+                                       WicketUtils.setHtmlTooltip(c, tooltip);\r
+                               }\r
                                item.add(c);\r
                                Label lb = new Label("lineBreak", "<br/>");\r
                                lb.setVisible(breakLine);\r