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.
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.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.