diff options
author | Phil Hughes <me@iamphill.com> | 2017-07-25 11:56:41 +0100 |
---|---|---|
committer | Phil Hughes <me@iamphill.com> | 2017-07-25 11:56:41 +0100 |
commit | 205090fcfb741884215723281dfb0afb56efbbfb (patch) | |
tree | ba1e4ffdeb5757e055dcc862d8d022eb4c48d62d /app/assets/javascripts/project.js | |
parent | e43bda0ebb56991f9f128946fefed375a695eac1 (diff) | |
download | gitlab-ce-205090fcfb741884215723281dfb0afb56efbbfb.tar.gz |
Removed inline JS in shared HAML files
Diffstat (limited to 'app/assets/javascripts/project.js')
-rw-r--r-- | app/assets/javascripts/project.js | 29 |
1 files changed, 15 insertions, 14 deletions
diff --git a/app/assets/javascripts/project.js b/app/assets/javascripts/project.js index 738e710deb9..a3f7d69b98d 100644 --- a/app/assets/javascripts/project.js +++ b/app/assets/javascripts/project.js @@ -6,21 +6,22 @@ import Cookies from 'js-cookie'; (function() { this.Project = (function() { function Project() { - $('ul.clone-options-dropdown a').click(function() { - var url; - if ($(this).hasClass('active')) { - return; - } - $('.active').not($(this)).removeClass('active'); - $(this).toggleClass('active'); - url = $("#project_clone").val(); - $('#project_clone').val(url); + const $cloneOptions = $('ul.clone-options-dropdown'); + const $projectCloneField = $('#project_clone'); + const $cloneBtnText = $('a.clone-dropdown-btn span'); + + $('a', $cloneOptions).on('click', (e) => { + const $this = $(e.currentTarget); + const url = $this.attr('href'); + + e.preventDefault(); + + $('.active', $cloneOptions).not($this).removeClass('active'); + $this.toggleClass('active'); + $projectCloneField.val(url); + $cloneBtnText.text($this.text()); + return $('.clone').text(url); - // Git protocol switcher - // Remove the active class for all buttons (ssh, http, kerberos if shown) - // Add the active class for the clicked button - // Update the input field - // Update the command line instructions }); // Ref switcher this.initRefSwitcher(); |