Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save todesking/465326 to your computer and use it in GitHub Desktop.
Save todesking/465326 to your computer and use it in GitHub Desktop.
Set default values on creating Redmine ticket
// ==UserScript==
// @name redmine_set_default_values_on_new_ticket
// @namespace http://d.hatena.ne.jp/gnarl/
// @include */issues/new*
// ==/UserScript==
(function() {
var SET_ASSIGNED_TO_IF_ONLY_ONE_USER=true;
var DEFAULT_TRACKER='2';
var footer=document.getElementById('footer');
if(!footer || !footer.childNodes[1] || footer.childNodes[1].href != 'http://www.redmine.org/')
return;
if(SET_ASSIGNED_TO_IF_ONLY_ONE_USER) {
var issue_assigned_to=document.getElementById('issue_assigned_to_id');
var users=issue_assigned_to.getElementsByTagName('option');
if(users.length==2) {
issue_assigned_to.value=users[1].value;
}
}
if(DEFAULT_TRACKER) {
var issue_tracker=document.getElementById('issue_tracker_id');
issue_tracker.value=DEFAULT_TRACKER;
}
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment