I am trying to render a Confluence macro inside an Inline Dialog (AUI).
I finally got this working in Safari but not in Firefox (something to do with "alert" function i guess?). Is there a simpler or any other way to do this or how to get this workin also in Firefox ? The code below is pasted from my theme plugins "main.vmd" where i m trying to get this inline dialog working.
<!--hidden div element contains rendered macro --> <div id="favhidden" style="display:none!important;"> $helper.renderConfluenceMacro("{favpages:maxResults=$maxFavouritePages}")) </div> <!-- link that opens up the inline dialog --> <li><a id="hoverLink-10" href="#">Suosikkisivuni</a></li> <script type="text/javascript"> // first remove all line breaks from rendered macro var nrivistr = favhidden.innerHTML; var uusistr = nrivistr.replace( new RegExp( "\\n", "g" ),"" ); window.onload = function() { AJS.InlineDialog(AJS.$("#hoverLink-10"), 10, function(contents, trigger, showPopup){ contents.html('<div id="favresults" style="padding: 15px 10px;">' + uusistr + '</div>'); showPopup(); },{onHover:false, hideDelay:500, isRelativeToMouse:true, useLiveEvents:true}).bind('beforeShow', function() { alert( uusistr) } ); } </script>
-- Thanks
Community moderators have prevented the ability to post new answers.
I'm doing the same thing at the moment with the following strategy:
- using Velocity, render the content of the Inline Dialog somewhere on the page in a container with "display: none"
- onload, assign the Inline Dialog and append a clone of the container with JavaScript
Look at the following code:
(function($) { AJS.toInit(function() { var generateDialog = function($contentDiv, trigger, doShowPopup) { var $contents = $('#my-dialog-container').clone(); // where the stuff is you want to show in the dialog $contents.show(); $contentDiv.empty(); $contentDiv.append($contents); doShowPopup(); }, dialog = AJS.InlineDialog( $('#my-dialog-trigger-link'), 'my-dialog-id', generateDialog, { /* options, if you need */ }); }); }(jQuery));
However, if you need fresh content for the dialog, you must do some Ajax and return the rendered Velocity template from the server. Isn't very difficult either.
Hope that helps!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.