Hello,
I've created a glossary where each page is a definition that is in an excerpt macro. I'd like to display these terms as pop-ups in documents. How do I create a user macro to do this? I know it can be done. Any suggestions?
Thanks much!
Community moderators have prevented the ability to post new answers.
Quick prototype with user macro:
## Macro title: tooltipme ## Macro has a body: Y ## Body processing: Rendered ## Output: Selected output option ## ## Developed by: Vertuna LLC ## Date created: 11/01/2015 ## This is an example macro ## @param Name:title=Tooltip name|type=string|required=true|desc=JS ID for your tooltip element ## @param Text:title=Link text|type=string|required=true|desc=Link text <a id="${paramName}Link" href="#">$paramText</a> <script type="text/javascript"> AJS.$(document).ready(function() { AJS.$("#${paramName}Link").attr('original-title', AJS.$("#${paramName}").html()); AJS.$("#${paramName}Link").tooltip({html:true}); }); </script> <div id="$paramName" style="display:none"> $body <div>
Make sure "Rendered" option is selected as output.
And when you add this macro to the page put excerpt include macro as it's macro body.
Basically it can make tooltip if anything you give it as input.
You will need to alter the CSS styles a bit, as by default, the tooltips are rendered on a dark background and this is probably not what are you looking for.
Configuration on page
tooltip-config.png
View mode
tooltip.png
Sash, thanks for the prototype. Unfortunately, I wasn't able to get it to work. I'm on version 5.4.2. Is your code compatible with that version? I created the macro per our instructions and selected rendered. Once created, I could only add the tooltip macro to the page when a "Tooltip name" and "Link Text" are entered. For "tooltip name" I added the name of the term I want defined. For "link text", I added the tiny link to the excerpt page to include. Once I did that, I added the "excerpt include" macro to the body of the tooptip and filled it out as usual. After saving the page, though, nothing happened. The link displayed, but nothing popped up. If you could please provide information and examples of what I should put in the "Tooltip name" and "Link Text" fields, that might help resolve the problem. I'm not even sure why those fields are necessary. How exactly did you get this macro to work? It would be a lifesaver if I could get it to function the way you discribe. I even like that the definition displays with a black background with white text. Kind regards, Rosemary
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Just retried it with Confluence 5.4.2 and it works the way it should. See updated answer above with the screenshot attached
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hmm, I wonder if it's a RefinedWiki issue. I'll have to play around with this because your solution is what I want. I'll select yours as the answer even though I haven't gotten it to work yet. Thanks so much for your help! Much appreciated. :)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Sash, I tried it again and it worked! I realized from looking at your screenshot that all I had to do was put in the name of the page that contains the excerpt and not the actual tiny link. Your image cleared everything up. Thanks again for the macro. You have serious made my day. :)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hey, Sash, I can only have one tooltip that works on a page. For example, if I have 4 different terms on a page that are pulling excerpts to display in Tooltipme, only the first one works. I even copied the first one that works and pasted it at the bottom of the page. When I saved the page, the first tool tip worked (tooltipme). But the copy at the bottom of the page didn't work. Do you know what I need to add to the macro to have unlimited tooltips display on a page?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Give different names ("Name:" parameter)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
That did the trick. Thanks again.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Just the ending <div> should have the opening slash: </div>, otherwise is brakes.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Sash [ConfiForms], one more question - the tooltip is limited by width, and I can't stretch it to make it wider - some content may have limited. How could it be widened?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I lifted some code from other Atlassian Answers, this is my frankenstine. You could use .renderConfluenceMacro("{excerpt-include:$parampage|nopanel=true}")
instead of course as well.
I can create an "index" of pages, and lift them as tool tips.
The issue I've run into so far is that " "
" and " '
" can break this.
## Installed by: ## Date Installed: ## @param page:title=Page|type=confluence-content|required=true|desc=Find page to include content from. #foreach ($p in $parampage.split(":")) #set ($pagename = $p) #end <style> .tipsy-inner { max-width: 400px !important; text-align: left !important; } </style> <script type="text/javascript"> AJS.$(document).ready(function(){ AJS.$('.includetip').filter(function() { return AJS.$(this).offset().left >= AJS.$(window).width() / 2; }) .tooltip({ html:true, gravity: 'e' }); AJS.$('.includetip').filter(function() { return AJS.$(this).offset().left < AJS.$(window).width() / 2; }) .tooltip({ html:true, gravity: 'w' }); }); </script> <a class="includetip" style="text-decoration:none; border-bottom:1px solid;" title='$action.getHelper().renderConfluenceMacro("{include:$parampage}")'>$pagename</a>
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@R Donato,
Are you thinking of something like PopView here? (See example in-line in the linked page.)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi, Justin, thanks for providing the link. But it looks like the excerpt text has to be added to the macro. I want to avoid that since the pages are already created. We want to avoid having to copy and paste definitions in multiple places and/or macros. We just want to call the definition and have it display in a pop-up. I think for one-offs, this macro would be a good tool to use. Thanks for your suggestion.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi R ... honestly, wasn't sure since it'd been a while since I tried that. The content that was on the linked page was old and not updated when Confluence (which website is running on) and plugin was updated to 5.4.1. It is updated/fixed now. It does work how you are saying, I think, if understanding right. The example for "Sneeches - Abdominal Stars" page (title) just required inserting the macro (no wiki-markup) and selecting the page reference. It automatically pulled rest of the parameters, including the tooltip text (you do not need to put in an excerpt). You can edit the tooltip text, caption, tooltip width later also if you want. See the screenshot. You know, we would be open to improving this, so feedback is welcome. This was AppFusions' *very first* plugin in April 2010, so it's sorta historically novel to us. :)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks for the response and for all your suggestions! I'll play with the macro and send over some feedback. Anything to improve Confluence functionality is appreciated. cheers!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Sash,
I didn't explain what I want very well. I want to create a user macro that displays an excerpt as a tool-tip for definitions from the glossary.
Unless I've misunderstood what you've written, your suggestion doesn't provide the pop-up functionality for individual terms that I can use in documents.
Thanks anyway though.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
It could be done without a user macro
You can create a page that has a excerpt that references excerpts from you glossary pages (like a master excerpt :-) )
And then can reference that page (with master excerpt) from your documents. Kind of excerpt of excerpts. Just tried in Confluence, and it works fine
Sounds like inception, but works
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Community moderators have prevented the ability to post new answers.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.