From: James Moger Date: Thu, 13 Mar 2014 14:43:54 +0000 (-0400) Subject: Set tooltip for truncated tag and branch messages X-Git-Tag: v1.4.1~6^2 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=refs%2Ftickets%2F31%2F31%2F1;p=gitblit.git Set tooltip for truncated tag and branch messages --- diff --git a/src/main/java/com/gitblit/wicket/panels/BranchesPanel.java b/src/main/java/com/gitblit/wicket/panels/BranchesPanel.java index 28751fab..6a7873ea 100644 --- a/src/main/java/com/gitblit/wicket/panels/BranchesPanel.java +++ b/src/main/java/com/gitblit/wicket/panels/BranchesPanel.java @@ -133,7 +133,7 @@ public class BranchesPanel extends BasePanel { CommitPage.class, WicketUtils.newObjectParameter(model.name, entry.getName())); if (!shortMessage.equals(trimmedMessage)) { - WicketUtils.setHtmlTooltip(shortlog, shortMessage); + shortlog.setTooltip(shortMessage); } item.add(shortlog); diff --git a/src/main/java/com/gitblit/wicket/panels/LinkPanel.java b/src/main/java/com/gitblit/wicket/panels/LinkPanel.java index cdcf574f..06159ac3 100644 --- a/src/main/java/com/gitblit/wicket/panels/LinkPanel.java +++ b/src/main/java/com/gitblit/wicket/panels/LinkPanel.java @@ -113,4 +113,9 @@ public class LinkPanel extends Panel { c.add(new SimpleAttributeModifier("rel", "nofollow")); } + public void setTooltip(String tooltip) { + Component c = get("link"); + c.add(new SimpleAttributeModifier("title", tooltip)); + } + } diff --git a/src/main/java/com/gitblit/wicket/panels/TagsPanel.java b/src/main/java/com/gitblit/wicket/panels/TagsPanel.java index 1e06a7fc..9f3987be 100644 --- a/src/main/java/com/gitblit/wicket/panels/TagsPanel.java +++ b/src/main/java/com/gitblit/wicket/panels/TagsPanel.java @@ -96,9 +96,13 @@ public class TagsPanel extends BasePanel { if (linkClass.equals(BlobPage.class)) { // Blob Tag Object item.add(WicketUtils.newImage("tagIcon", "file_16x16.png")); - item.add(new LinkPanel("tagDescription", "list", message, TagPage.class, + LinkPanel messageLink = new LinkPanel("tagDescription", "list", message, TagPage.class, WicketUtils.newObjectParameter(repositoryName, entry.getObjectId() - .getName()))); + .getName())); + if (!entry.getShortMessage().equals(message)) { + messageLink.setTooltip(entry.getShortMessage()); + } + item.add(messageLink); Fragment fragment = new Fragment("tagLinks", "blobLinks", this); fragment.add(new BookmarkablePageLink("tag", TagPage.class, WicketUtils @@ -118,9 +122,13 @@ public class TagsPanel extends BasePanel { // Standard Tag Object if (entry.isAnnotatedTag()) { item.add(WicketUtils.newImage("tagIcon", "tag_16x16.png")); - item.add(new LinkPanel("tagDescription", "list", message, TagPage.class, + LinkPanel messageLink = new LinkPanel("tagDescription", "list", message, TagPage.class, WicketUtils.newObjectParameter(repositoryName, entry.getObjectId() - .getName()))); + .getName())); + if (!message.equals(entry.getShortMessage())) { + messageLink.setTooltip(entry.getShortMessage()); + } + item.add(messageLink); Fragment fragment = new Fragment("tagLinks", "annotatedLinks", this); fragment.add(new BookmarkablePageLink("tag", TagPage.class,