Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Change default status by tracker (Redmine view customize plugin)
// Path pattern: /issues/new
// Type : JavaScript
$(function() {
var trackerChanged = false;
$(document).on('change', '#issue_tracker_id', function() {
trackerChanged = true;
});
var _replaceIssueFormWith = replaceIssueFormWith;
replaceIssueFormWith = function(html){
_replaceIssueFormWith(html);
if (trackerChanged) {
setDefalutStatus();
}
trackerChanged = false;
};
var setDefalutStatus = function() {
var statusId = $('#issue_status_id').val();
$('#issue_status_id option').removeAttr("selected");
// tracker_id -> default status
switch($('#issue_tracker_id').val()) {
case "1":
case "2":
statusId = "2";
break;
case "3":
statusId = "1";
break;
}
$('#issue_status_id option[value="' + statusId + '"]').attr("selected", "selected");
}
setDefalutStatus();
});
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.