diff --git a/javascripts/theme.js b/javascripts/theme.js index ff83fe5..03548b3 100644 --- a/javascripts/theme.js +++ b/javascripts/theme.js @@ -107,6 +107,19 @@ function alter_new_issue_page() { return false; } }); + $('input#issue_subject').on('change', function(evt) { + var val = $(this).val(); + var uppercases = val.match(/[A-Z]/g).length; + var all_letters = val.match(/[^\s+]/g).length; + var ratio = uppercases / all_letters; + if (ratio > 0.6) { // more than 60% of uppercase letters + // change to lower case + $(this).val(val.toLowerCase()); + // and disable high priority values + $('#issue_priority_id option + option + option').attr('disabled', true); + } + return true; + }); } $(function() {