Mercurial > hg > soundsoftware-site
annotate public/javascripts/repository_navigation.js @ 1022:f2ec92061fca browsing
Merge from live branch
author | Chris Cannam <chris.cannam@soundsoftware.ac.uk> |
---|---|
date | Tue, 13 Nov 2012 10:35:40 +0000 |
parents | 513646585e45 |
children | 433d4f72a19b |
rev | line source |
---|---|
Chris@0 | 1 Event.observe(window,'load',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@0 | 6 var branch_selected = $('branch') && $('rev').getValue() == $('branch').getValue(); |
Chris@0 | 7 var tag_selected = $('tag') && $('rev').getValue() == $('tag').getValue(); |
Chris@0 | 8 if (branch_selected || tag_selected) { |
Chris@0 | 9 $('rev').setValue(''); |
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@0 | 16 $$('#branch,#tag').each(function(e) { |
Chris@0 | 17 e.observe('change',function(e) { |
Chris@0 | 18 $('rev').setValue(e.element().getValue()); |
Chris@0 | 19 $$('#branch,#tag').invoke('disable'); |
Chris@0 | 20 e.element().parentNode.submit(); |
Chris@0 | 21 $$('#branch,#tag').invoke('enable'); |
Chris@0 | 22 }); |
Chris@0 | 23 }); |
Chris@0 | 24 |
Chris@0 | 25 /* |
Chris@0 | 26 Disable the branch/tag dropdowns before submitting the revision form |
Chris@0 | 27 */ |
Chris@0 | 28 $('rev').observe('keydown', function(e) { |
Chris@0 | 29 if (e.keyCode == 13) { |
Chris@0 | 30 $$('#branch,#tag').invoke('disable'); |
Chris@0 | 31 e.element().parentNode.submit(); |
Chris@0 | 32 $$('#branch,#tag').invoke('enable'); |
Chris@0 | 33 } |
Chris@0 | 34 }); |
Chris@0 | 35 }) |