From 51ef4603e0e24d128e195202daf3b9e8d21038cc Mon Sep 17 00:00:00 2001 From: James Moger Date: Thu, 13 Mar 2014 10:43:54 -0400 Subject: [PATCH] Set tooltip for truncated tag and branch messages --- .../com/gitblit/wicket/panels/BranchesPanel.java | 2 +- .../com/gitblit/wicket/panels/LinkPanel.java | 5 +++++ .../com/gitblit/wicket/panels/TagsPanel.java | 16 ++++++++++++---- 3 files changed, 18 insertions(+), 5 deletions(-) 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, -- 2.39.5