How to add a version table to a page
To add a table of all versions of the current project you can add the following to your storage format template:
<table><colgroup><col /><col /><col /><col /><col /></colgroup> <tbody> <tr> <th>Version</th> <th>Status</th> <th>Start date</th> <th>Release date</th> <th>Description</th></tr> #set($versions = $issue.getProjectObject().getVersions()) #if(! $versions.isEmpty()) #foreach($version in $versions) <tr> <td>$!version.getName()</td> #if($version.isReleased()) <td>Released</td> #else <td>Unreleased</td> #end <td>$!fieldHelper.getDateOnlyAsString($version.getStartDate())</td> <td>$!fieldHelper.getDateOnlyAsString($version.getReleaseDate())</td> <td>$!version.getDescription()</td></tr> #end #end </tbody></table>
This will result in the following table in Confluence:
For the above page the following was used for the page title:
[$issue.getProjectObject().getKey()] $issue.getProjectObject().getName() - Versions
You can even add nicer formatting for the status by using the Confluence status macro. The template would than look like this:
<table><colgroup><col /><col /><col /><col /><col /></colgroup> <tbody> <tr> <th>Version</th> <th>Status</th> <th>Start date</th> <th>Release date</th> <th>Description</th></tr> #set($versions = $issue.getProjectObject().getVersions()) #if(! $versions.isEmpty()) #foreach($version in $versions) <tr> <td>$!version.getName()</td> #if($version.isReleased()) <td><div class="content-wrapper"> <p><ac:structured-macro ac:name="status" ac:schema-version="1" ac:macro-id="$macroHelper.newId()"><ac:parameter ac:name="subtle">true</ac:parameter><ac:parameter ac:name="colour">Green</ac:parameter><ac:parameter ac:name="title">Released</ac:parameter></ac:structured-macro></p></div></td> #else <td><div class="content-wrapper"> <p><ac:structured-macro ac:name="status" ac:schema-version="1" ac:macro-id="$macroHelper.newId()"><ac:parameter ac:name="subtle">true</ac:parameter><ac:parameter ac:name="colour">Blue</ac:parameter><ac:parameter ac:name="title">Unreleased</ac:parameter></ac:structured-macro></p></div></td> #end <td>$!fieldHelper.getDateOnlyAsString($version.getStartDate())</td> <td>$!fieldHelper.getDateOnlyAsString($version.getReleaseDate())</td> <td>$!version.getDescription()</td></tr> #end #end </tbody></table>
And the resulting page in Confluence:
If the table should only contain the versions of the current issue replace #set($versions = $issue.getProjectObject().getVersions())
in the template with #set($versions = $issue.getFixVersions())