Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Speicher <rspeicher@gmail.com>2015-11-25 04:38:36 +0300
committerRobert Speicher <rspeicher@gmail.com>2015-11-25 04:38:36 +0300
commit637e64c24472a06b32091cb45f1b81260c5e6ec0 (patch)
treed1915c0cde4bf8751cd493e1250d81f0c892d9e8 /app/assets/javascripts/project.js.coffee
parent1d80cd315e403e02f85a99c35eb9e83f4d829f8d (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.coffee20
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', ->