Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Atlasteam, Jira, plugin JsIncluder. Set assignee. For https://atlasteam.ru/?p=1925
(function ($) {
setAssignee('admin');
function setAssignee(name) {
var setValue = name;
var $field = $("#assignee");
$.get(AJS.params.baseURL + "/rest/api/latest/user", {
username: setValue
}, function (data) {
$("#assignee-single-select").remove();
var option = $("#assignee").find("option[value=\"" + setValue + "\"]");
if (option.length === 0) {
option = $("<option></option>");
option.text(data.displayName);
option.attr("value", data.name);
option.attr("data-field-text", data.displayName);
option.attr("data-icon", data.avatarUrls["16x16"]);
option.attr("data-field-label", AJS.format(
"{0} - {1} ({2})",
data.displayName,
data.emailAddress,
data.name
));
$("#assignee-group-suggested").append(option);
}
$field.val(setValue);
option.attr("selected", "selected");
var picker = new JIRA.AssigneePicker({
element: $field,
editValue: setValue
});
$("#assignee").trigger('set-selection-value', setValue);
});
}
})(AJS.$)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.