diff options
author | Robert Speicher <rspeicher@gmail.com> | 2015-11-25 04:38:36 +0300 |
---|---|---|
committer | Robert Speicher <rspeicher@gmail.com> | 2015-11-25 04:38:36 +0300 |
commit | 637e64c24472a06b32091cb45f1b81260c5e6ec0 (patch) | |
tree | d1915c0cde4bf8751cd493e1250d81f0c892d9e8 /app/assets/javascripts/project.js.coffee | |
parent | 1d80cd315e403e02f85a99c35eb9e83f4d829f8d (diff) |
Clean up the Git protocol switcher JS
Also re-adds the `.clone` updating that was removed accidentally.
Thanks, tests!
Diffstat (limited to 'app/assets/javascripts/project.js.coffee')
-rw-r--r-- | app/assets/javascripts/project.js.coffee | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/app/assets/javascripts/project.js.coffee b/app/assets/javascripts/project.js.coffee index d37a00bdedc..ec919f0cd67 100644 --- a/app/assets/javascripts/project.js.coffee +++ b/app/assets/javascripts/project.js.coffee @@ -1,11 +1,19 @@ class @Project constructor: -> - # Git clone panel switcher - cloneHolder = $('.git-clone-holder') - if cloneHolder.length - $('.js-protocol-switch', cloneHolder).click -> - $('.js-protocol-switch', cloneHolder).toggleClass('active') - $('#project_clone').val($(@).data('clone')) + # Git protocol switcher + $('.js-protocol-switch').click -> + return if $(@).hasClass('active') + + # Toggle 'active' for both buttons + $('.js-protocol-switch').toggleClass('active') + + url = $(@).data('clone') + + # Update the input field + $('#project_clone').val(url) + + # Update the command line instructions + $('.clone').text(url) # Ref switcher $('.project-refs-select').on 'change', -> |