Mercurial > hg > soundsoftware-site
annotate public/javascripts/repository_navigation.js @ 1466:834828a14f2b bug_598
Close obsolete branch bug_598
author | Chris Cannam |
---|---|
date | Fri, 21 Jun 2013 14:51:55 +0100 |
parents | 433d4f72a19b |
children |
rev | line source |
---|---|
Chris@1115 | 1 $(document).ready(function() { |
Chris@0 | 2 /* |
Chris@0 | 3 If we're viewing a tag or branch, don't display it in the |
Chris@0 | 4 revision box |
Chris@0 | 5 */ |
Chris@1115 | 6 var branch_selected = $('#branch').length > 0 && $('#rev').val() == $('#branch').val(); |
Chris@1115 | 7 var tag_selected = $('#tag').length > 0 && $('#rev').val() == $('#tag').val(); |
Chris@0 | 8 if (branch_selected || tag_selected) { |
Chris@1115 | 9 $('#rev').val(''); |
Chris@0 | 10 } |
Chris@0 | 11 |
Chris@0 | 12 /* |
Chris@0 | 13 Copy the branch/tag value into the revision box, then disable |
Chris@0 | 14 the dropdowns before submitting the form |
Chris@0 | 15 */ |
Chris@1115 | 16 $('#branch,#tag').change(function() { |
Chris@1115 | 17 $('#rev').val($(this).val()); |
Chris@1115 | 18 $('#branch,#tag').attr('disabled', true); |
Chris@1115 | 19 $(this).parent().submit(); |
Chris@1115 | 20 $('#branch,#tag').removeAttr('disabled'); |
Chris@0 | 21 }); |
Chris@0 | 22 |
Chris@0 | 23 /* |
Chris@0 | 24 Disable the branch/tag dropdowns before submitting the revision form |
Chris@0 | 25 */ |
Chris@1115 | 26 $('#rev').keydown(function(e) { |
Chris@0 | 27 if (e.keyCode == 13) { |
Chris@1115 | 28 $('#branch,#tag').attr('disabled', true); |
Chris@1115 | 29 $(this).parent().submit(); |
Chris@1115 | 30 $('#branch,#tag').removeAttr('disabled'); |
Chris@0 | 31 } |
Chris@0 | 32 }); |
Chris@0 | 33 }) |