automatically check the "patch proposed" checkbox on .patch upload

This commit is contained in:
Frédéric Péters 2016-11-03 14:25:25 +01:00
parent 8c0d5aa80c
commit 939468a414
1 changed files with 16 additions and 0 deletions

View File

@ -105,4 +105,20 @@ $(function() {
}
}
});
if ($('#attachments_fields').length) {
var observer = new MutationObserver(function(mutations) {
mutations.forEach(function(mutation) {
console.log(mutation);
$('input.filename.readonly').each(function(idx, elem) {
var filename = $(elem).val();
var extension = filename.substring(filename.lastIndexOf('.'));
if (extension == '.patch') {
$('#issue_custom_field_values_2').prop('checked', true);
}
});
});
});
var target = $('#attachments_fields')[0];
observer.observe(target, {attributes: false, childList: true, characterData: false});
}
});