how to add version description as title to versions-edit.vm

Michael Aglas February 19, 2018

We'd like to add the versions description as title to according velocity template versions-edit.vm as it is done at the components-edit.vm with components description. Unfortunately, it doesn't work. Any suggestions how to adapt the versions-edit.vm to add the description here? We could not find a way to access the version description so far.
We expected to simply use $version.description, but title will always be empty in this case.
We are currently using JIRA 7.2.7.

2 answers

1 accepted

0 votes
Answer accepted
Dave C
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
March 1, 2018

A velocity template can only access what's in the velocity context, so if the description isn't present it won't be able to accessed. Looking at JIRA in com.atlassian.jira.issue.fields.AbstractVersionsSystemField#getEditHtml it gets the versions from com.atlassian.jira.issue.fields.AbstractVersionsSystemField#getPossibleVersions, which only appears use com.atlassian.jira.project.VersionProxy and puts versions in the context using this object. Looking at both of those constructors:

public VersionProxy(Version version) {
this.key = version.getId().longValue();
this.value = version.getName();
}

public VersionProxy(long key, String value) {
this.key = key;
this.value = value;
}

They only have key and value - if you want to get description in you'll likely have to modify the class to inject the description and rebuild JIRA. An alternative might to be to put a JS hack in that gets it and pop it into the DOM. I'm not too sure what the best (if there is a 'best') way of doing that would be.

Michael Aglas March 5, 2018

Until now it wasn't clear that it is not possible to access this data from velocity... so thanks for the hint. I expected to have it available as it is the case at the component system field. So I don't see a benefit handling all the fields differently.

0 votes
Pedro Felgueiras
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.
February 19, 2018

Hi @Michael Aglas

 

Do you have restarted your instance?  

 

After editing a *.vm file you have to restart the instance so the changes affects the interface. 

 

Best regards, 

Pedro Felgueiras 

Michael Aglas February 19, 2018

yes, of course

Suggest an answer

Log in or Sign up to answer