Last active
December 22, 2015 15:49
-
-
Save codec/6494771 to your computer and use it in GitHub Desktop.
Create a table including child pages and likes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## @noparams | |
## wtf, seriously!? | |
#set($containerManagerClass = $action.class.forName('com.atlassian.spring.container.ContainerManager')) | |
#set($getInstanceMethod = $containerManagerClass.getDeclaredMethod('getInstance',null)) | |
#set($containerManager = $getInstanceMethod.invoke(null,null)) | |
#set($containerContext = $containerManager.containerContext) | |
## now what we actually need ... | |
#set($likeManager = $containerContext.getComponent('likeManager')) | |
#set($childpages = $content.getChildren()) | |
<table class="aui aui-table-sortable"> | |
<thead> | |
<tr> | |
<th class="aui-table-column-unsortable">Session</th> | |
<th>Likes</th> | |
</tr> | |
</thead> | |
<tbody> | |
#foreach($childpage in $childpages) | |
#set($macro = "{excerpt-include:${content.spaceKey}:${childpage.getTitle()}|nopanel=true}") | |
<tr> | |
<td> | |
<h3><a href="$generalUtil.getPageUrl($childpage)">$childpage.getTitle()</a></h3> | |
<p> | |
${action.getHelper().renderConfluenceMacro($macro)} | |
</p> | |
</td> | |
<td>$likeManager.getLikes($childpage).size()</td> | |
</tr> | |
#end | |
</tbody> | |
</table> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment