2

我正在将我的 Jira 从 4.3.2 升级到 5.1.8。我有我的记者字段作为几个转换的只读字段。

我也想让这个记者字段在 Jira 5.1.8 中只读。但是当我为 Jira 5.1.8 即 Behavior Plugin 0.5.3 安装兼容版本时。那么记者字段或任何其他用户选择器不会被设为只读。

这是行为插件的错误。谁能告诉我解决方法?

任何帮助都将是可观的......

提前致谢。

雷努

4

2 回答 2

2

更新

你是如何应用这个的?在浏览器控制台上运行时,这应该可以完成工作:

AJS.$("#reporter-field").attr("disabled", true);

但是当将其输入到字段描述中时,请使用

<script type="text/javascript">
  AJS.$(document).ready(function() {
    AJS.$("#reporter-field").attr("disabled", true);
  });
</script>

您可以通过以下方式应用此脚本:

  • 转到 View Field Configuration并编辑该reporter字段并将此代码添加为描述。
  • 将其添加到自定义字段描述中。这个自定义字段应该出现在该reporter字段所在的每个屏幕上。
  • 将其添加到Announcement Banner描述中

这将使该reporter字段在所有屏幕中都是只读的。要禁用快速编辑选项,请将其添加到Announcement Banner说明中:

<script type="text/javascript">
  AJS.$(document).ready(function() {
    AJS.$("#reporter-val").removeClass("editable-field inactive");
    AJS.$("#reporter-val .icon-edit-sml").remove();
  });
</script>

编辑

要将其限制为仅针对特定转换,您可以:

  • 仅将自定义字段添加到特定的转换屏幕并将其添加到脚本的描述中。
  • 仅在特定的过渡屏幕上执行脚本:

例如,仅将其应用于Resolve Issue

if (AJS.$("#workflow-transition-5-dialog .aui-popup-heading").text().indexOf("Resolve Issue") >= 0) {
    AJS.$("#reporter-field").attr("disabled", true);;
}

原帖

您可以使用 jQuery 轻松实现此目的。在客户提交页面中,单击Edit所需的字段,然后在description输入 jQuery 代码下,如下所示:

要禁用该字段:

<script type="text/javascript">
  AJS.$(document).ready(function() {
    AJS.$("#customfield_10001").attr("disabled", true);
  });
</script>

使其只读:

<script type="text/javascript">
  AJS.$(document).ready(function() {
    AJS.$("#customfield_10001").attr("readonly", true);
  });
</script>

编辑

我刚刚注意到您打算禁用reporter,这不是自定义字段,并且无法添加description

作为一种解决方法,您可以创建一个自定义字段,不管是哪个(如果您的页面中已经有一个,它就可以解决问题),然后#customfield_10001换成reporter

<script type="text/javascript">
  AJS.$(document).ready(function() {
    AJS.$("#reporter-field").attr("disabled", true);
  });
</script>
于 2013-01-15T09:51:33.267 回答
1

您正在尝试在行为插件中将记者字段设置为只读。我想这是插件中的一个错误。我建议您编写一个 groovy 脚本,该脚本将使用 setHelpText(String helptext) 将帮助文本添加到报告字段。帮助文本将是下面的 javascript 。您需要将其作为字符串转义:)

<script type="text/javascript">
    AJS.$(document).ready(function() {
        AJS.$("#reporter-field").attr("disabled", true);
    });
</script>

希望这可以帮助

于 2013-01-23T10:23:04.123 回答