Created
February 15, 2015 15:50
-
-
Save onozaty/ebaee1b4e1d03b772932 to your computer and use it in GitHub Desktop.
Change default status by tracker (Redmine view customize plugin)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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