How to have fixed space in Confluence menu?

JulienLembo March 25, 2015

Can't find where to have space links outside dropdown.

3 answers

1 accepted

1 vote
Answer accepted
JulienLembo April 2, 2015

Sans titre.png

I finally reached my goal and made a dropdown menu. I had to tweak the file 

/opt/atlassian/confluence/confluence/decorators/includes/aui-header-primary.vm

and added the following content.

 

<ul class="aui-nav">
#menuMacros_renderHeaderLeftImageLinks()

#set ( $spaceLabel1 = $action.labelManager.getLabel( "team:service-siège" ) )


#if($spaceLabel1)
#set ( $spacesdep = $action.labelManager.getSpacesWithLabel($spaceLabel1) )
<li>
<a id="myspace-menu-link" class="aui-nav-link aui-dropdown2-trigger" href="#" aria-haspopup="true" aria-owns="myspace-menu-link-content" title="departementssiege"><span class="browse">Départements Siège</span><span class="aui-icon-dropdown"></span></a>
</li>
<div id="myspace-menu-link-content" class="aui-dropdown2 aui-style-default aui-dropdown2-in-header" aria-hidden="true" data-dropdown2-alignment="left" style="left: 93.5px; top: 145px; display: none;">
<div class="aui-dropdown2-section" id="recent-spaces-section">
<ul>
#foreach ($space in $spacesdep)
#if ($permissionHelper.canView($action.remoteUser, $space))
<li><a href="$req.contextPath/display/$space.key"> $space.name</a></li>
#end
#end
</ul>
</div>
</div>
#end

 

#if ($spaceLabel1)
<script>
AJS.toInit(function(){
AJS.$('#space-menu-link').remove();
AJS.$('#people-directory-link').remove();
AJS.$('#create-page-button').appendTo(".aui-header-primary .aui-nav");
});
</script>
#end

 

 

Now, each space that are categorized as "service-siège" will appear in the dropdown menu

No expensive plug-in (like theme builder) needed (but you ll probably have to apply the modification on each update )

 

1 vote
Guilherme Nedel [Atlassian]
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
March 25, 2015

Hello Julien, try this:

&lt;script&gt;
AJS.toInit(function(){
    AJS.$('.aui-header-primary .aui-nav').append('&lt;li&gt;&lt;a href="http://www.atlassian.com" class=" aui-nav-imagelink"&gt;Atlassian&lt;/a&gt;&lt;/li&gt;');
});
&lt;/script&gt;

source

0 votes
JulienLembo March 25, 2015

Hi, 

Thanks for your quick reply, It is almost what i m looking for.

 

Is there a function to get "spaces" links. I can't set them with fixed url since not all links should be available

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events