本文介绍了在用于Jira 5.1.8的Behaviors插件0.5.3中,我无法将Reporter字段设为只读?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在将我的Jira从4.3.2升级到5.1.8.我将我的记者字段作为只读字段进行几次转换.

I am upgrading my Jira from 4.3.2 to 5.1.8. I have my reporter field as read-only field for couple of transitions.

我也想在Jira 5.1.8中将此报告者字段设置为只读.但是当我为Jira 5.1.8安装兼容版本时,即行为插件0.5.3.则报告者字段或任何其他用户选择器都不会设为只读.

I wanted to make this reporter field as read-only in Jira 5.1.8 also. But when I install compatible version for Jira 5.1.8 i.e. Behaviour Plugin 0.5.3. then reporter field or any other user picker is not made as read-only.

这是行为插件的错误.有人可以告诉我解决方法吗?

This is a Bug for Behaviour Plugin.Can anyone please tell me the workaround for this?

任何帮助都是有意义的...

Any help will be appreciable...

预先感谢.

Renu

推荐答案

更新

您如何应用呢?在浏览器控制台上运行时,此操作可以完成:

How are you applying this? when running on the browser console, this should do the job:

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

但是在字段描述中输入

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

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

You can apply this script in the following ways:

  • 转到View Field Configuration并编辑reporter字段,然后将此代码添加为说明.
  • 将其添加到自定义字段描述中.此自定义字段应该出现在reporter字段所在的每个屏幕上.
  • 将其添加到Announcement Banner描述
  • go to View Field Configuration and edit the reporter field and add this code as description.
  • add it to a custom field description. this custom field should be present on every screen that the reporter field is at.
  • add it to the Announcement Banner description

这将使reporter字段在所有屏幕中都只能读取.要禁用快速编辑选项,请将其添加到Announcement Banner描述中:

That will make the reporter field to be read only in all the screens. To disable the quick edit option, add this to the Announcement Banner description:

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

编辑

要仅对特定的转换进行限制,您可以:

To limit this only for specific transitions you can either:

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

例如,仅将其应用于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代码,例如:

You can achieve this easily by using jQuery. In the custome filed page, click Edit on the desired field, than under description enter the jQuery code, something like:

要禁用该字段:

<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.

I've just noticed that you meant to disable reporter, which is not a custom field, and there can't add description to it.

作为一种变通方法,您可以创建一个自定义字段,而不管哪个(如果您已经在页面中准备好一个自定义字段,那么就可以解决问题),只需将#customfield_10001替换为reporter:

As a workaround, you can create a custom field, doesn't matter which (if you allready have one in your page it will do the trick), and just swap #customfield_10001 for reporter:

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

这篇关于在用于Jira 5.1.8的Behaviors插件0.5.3中,我无法将Reporter字段设为只读?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-30 20:54