can i get a list of spaces specifying its category using velocity?

Javier Rodriguez August 28, 2015

I got this one but i just want a certain group of spaces.

#foreach ($space in $spaceManager.getAllSpaces())
    #if($space.getKey() == "TDS")
        <li><a href=$space.getUrlPath()>$space.getName()</a></li>
    #end
#end

4 answers

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

1 vote
xpauls
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
August 28, 2015
#set($labelNames = ["label1", "label2", "label3"])
#foreach ($label in $labelManager.getTeamLabels())
    #if($labelNames.indexOf($label.getName()) > -1)
		#foreach($space in $labelManager.getSpacesWithLabel($label))
        	<li><a href=$space.getUrlPath()>$space.getName()</a></li>
		#end
    #end
#end
1 vote
xpauls
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
August 28, 2015
#set($group = ["TDS", "TDS2", "TDS3"])
#foreach ($space in $spaceManager.getAllSpaces())
    #if($group.indexOf($space.getKey()) > -1)
        <li><a href=$space.getUrlPath()>$space.getName()</a></li>
    #end
#end
0 votes
Javier Rodriguez August 31, 2015

thank you! your answers were very useful to figure out some things, at the end i did this.

 

#foreach ($space in $spaceManager.getAllSpaces())
    #foreach($label in $space.getDescription().getLabels())
        #if ($label == "ips_menu")
            <p>$space.getKey()</p>
        #end
    #end
#end

Now the user just need to add a category to our spaces and they don't need to worry about code, that's what i wanted.

0 votes
Javier Rodriguez August 28, 2015

Ok it worked but what i'm looking for it's something that let the user create a new space with a category label which let me access them without changing my code each time a new space is created.

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

TAGS
AUG Leaders

Atlassian Community Events