JIRA描述默认值设置

JIRA描述默认值设置

Setting a Default Value in the Description Field

(在 6.3.6 版本上验证通过)

The content on this page relates to platforms which are not supported by JIRA. Consequently, Atlassian cannot guarantee providing any support for it. Please be aware that this material is provided for your information only and using it is done so at your own risk.

 

This page describes how to set a Default Value for the Description field in JIRA. There's a feature request for this at JRA-4812. Please watch and vote on the issue if this is important to you.

There are workarounds to add this functionality. The modification does not persist if you upgrade JIRA so you'll have to re-apply these steps again in the future. Here are directions to set a default value for your Description field in JIRA:

1、Locate and backup the file: WEB-INF/classes/templates/jira/issue/field/description-edit.vm

2、Open that file:

#controlHeader ($action $field.id $i18n.getText($field.nameKey) $fieldLayoutItem.required $displayParameters.get('noHeader'))

## setup some additional parameters

$!rendererParams.put("rows", "12")

$!rendererParams.put("wrap", "virtual")

## let the renderer display the edit component

$rendererDescriptor.getEditVM($!description, $!issue.key, $!fieldLayoutItem.rendererType, $!field.id, $!field.name, $rendererParams, false)

#controlFooter ($action $fieldLayoutItem.getFieldDescription() $displayParameters.get('noHeader'))

3、Add a section like this:

#if($description == '')
#set ($description = 'Put stuff here:')
#end

So, ultimately it should look something like:

#controlHeader ($action $field.id $i18n.getText($field.nameKey) $fieldLayoutItem.required $displayParameters.get('noHeader'))

## setup some additional parameters

$!rendererParams.put("rows", "12")

$!rendererParams.put("wrap", "virtual")

#if($description == '')

#set ($description = 'Put stuff here:')
#end
## let the renderer display the edit component

$rendererDescriptor.getEditVM($!description, $!issue.key, $!fieldLayoutItem.rendererType, $!field.id, $!field.name, $rendererParams, false)

#controlFooter ($action $fieldLayoutItem.getFieldDescription() $displayParameters.get('noHeader'))

 

4、Restart your JIRA instance.

 

  • Adding multi-line values

If you wish to display in the description a default value of: 

1Step 1

2

3Step 2

4​

5Step 3

you'll need to tweak the above instructions a bit:

 

#set ($description = "Step 1\
\
Step 2\
\
Step 3")
#set ($description = $description.replace('\',' '))

OK,修改完成后,到前台创建问题的界面,刷新一下,点击创建,效果有了。

  • 实践证明

如将”Step 1…” 替换成输入中文,生效后,界面将会直接显示乱码或者报错,这个。。。该怎么解决这个问题?待研究。如哪位童鞋知道有解决方法,请告之一下,谢谢。

  • 替换方案

方案吧,也简单,不用中文,直接用英文。。。目前只能使用英文格式暂时先用着,如下:

#if($description == '')
#set ($description = "[Prerequisite]\
1.\
[Step]\
1.\
2.\
3.\
[Actual Result]\
1.\
2.\
3.\
[Expected Result]\
1.\
2.\
3.")
#set ($description = $description.replace('\',' '))
#end

好了,完成,使用没有报错。

  • 参考资料

修改脚本方法参考自官方 https://confluence.atlassian.com/jira/setting-a-default-value-in-the-description-field-166003857.html

转载于:https://www.cnblogs.com/snooper/p/6236680.html

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值