Skip to content

Instantly share code, notes, and snippets.

@onozaty
Created February 15, 2015 15:50
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save onozaty/ebaee1b4e1d03b772932 to your computer and use it in GitHub Desktop.
Save onozaty/ebaee1b4e1d03b772932 to your computer and use it in GitHub Desktop.
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