我为JIRA实例编写了一些Javascript代码,用于在创建问题时自动填充字段。如果我在新窗口中打开“创建问题”屏幕,它的效果就像预期的那样。 然而,当“创建问题”出现在对话框中时,我的脚本不会运行。 如何使我的脚本能够在“创建问题”对话框屏幕在窗口中打开时运行? 以下是我的代码:
/*
* Automatically fills the summary field of an issue and hides the field at issue creation.
*/
jQuery(document).ready(function($) {
JIRA.bind(JIRA.Events.NEW_CONTENT_ADDED, function (e,context) {
autoFillSummary();
});
autoFillSummary();
// Automatically fill the summary field with a default value.
function autoFillSummary(){
var issueType = $('#issue-create-issue-type').text();
var reporter = $('#reporter').val();
var d = new Date();
d = d.toDateString();
var summaryVal = reporter + " - " + "[ " + d + " ]";
if(issueType === "Job"){
$('#summary').val(summaryVal);
$('#summary').closest('div.field-group').hide();
$('#reporter').closest('div.field-group').hide();
}
}
});
创建问题的对话框ID为create-issue-dialog。非常感谢您提供的任何帮助。