I am creating a new plugin. And it requires a menu to be added to the page. I don't the plugin to be dependent on some other plugin.
How to create a new menu parallel to 'Add', 'Tools' etc. on a Page?
Community moderators have prevented the ability to post new answers.
Some Javascript like this...
<script>
AJS.toInit(function(){
AJS.$('#navigation .ajs-menu-bar').prepend('<li class="ajs-button normal"><a id="answersLink" href="https://answers.atlassian.com/" class="edit"><span>Answers</span></a></li>');
});
</script>
...would add a link to this website next to the Edit button/link.
This idea looks good. It should work. While I was trying I am stuck into another problem. Here I have asked that question - https://answers.atlassian.com/questions/3054/javascript-inclusion
Please respond if you have an answer.
Thanks & Regards.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
This worked. Thanks.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thank you, that helped me a lot. But now I'm stuck in adding a whole drop-down-menu this way
(I want to show a list of spaces tagged with label xyz, thats a usermacro)
## @param 0:title=Label|type=string|required=true|desc=Label der Spaces #set($labelmanager=$action.getLabelManager()) #set($label=$labelmanager.getLabel($param0) ) #set($spaces=$labelmanager.getSpacesWithLabel($label) ) ## build HTML for menu #set( $Q = '"' ) ## now we can use ${Q} #set ($myhtml = "<li class=${Q}ajs-menu-item normal${Q}><a id=${Q}space-menu-link${Q} class=${Q}action trigger ajs-menu-title${Q} href=${Q}#${Q}><span><span>Spaceliste</span></span></a><div class=${Q}ajs-drop-down assistive${Q}>") #foreach( $space in $spaces) #set ($myhtml = $myhtml + "<ul><li>" + $action.getHelper().renderConfluenceMacro("[$space.getName()|$space.getKey():]") + "</li></ul>") #end #set ($myhtml = $myhtml + "</ul></div></li>") <script> // add menu item AJS.toInit(function(){ AJS.$('#navigation .ajs-menu-bar').prepend('$myhtml'); // re-initialize drop down so that the new item is triggered, too, but how? //AJS.$("#ajs-menu-bar").dropDown("Standard"); }); </script>
I had to deal with some "velocity quoting hell", but found a workaround (see above) ;-)
If I add "assistive" to the class, the menu is closed by default, but does not "open" on click.
(if I leave out "assistive", the menu is always open which is not very useful)
What is the missing brick?
Thanks in advance for hint, it seems that you are the confluence-master of DOM manipulation! ;-)
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.
This will create a section within existing menus - Add, Tools etc. What I want is to create a new menu parallel to Add, Tools.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Jangid, I am trying out for something similar like this. If you have acheived doing it, could you please guide me how to do it?
Thanks in advance
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Suraiya,
I did it as suggested by David (first answer). But to make it work in 4.0 and gel smoothly with existing menu, I had to write a lot of javascript code. But the basic concept remains the same.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Jangid,
could you share your javascript code with us?
Thanks a lot in advance!
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.