diff options
author | Jose Ivan Vargas <jvargas@gitlab.com> | 2017-11-10 16:58:55 -0600 |
---|---|---|
committer | Jose Ivan Vargas <jvargas@gitlab.com> | 2017-11-27 09:19:39 -0600 |
commit | 81f2bdfccb6e72ac4b90e6ea24ce24c71e3074cb (patch) | |
tree | cc1eb83cc69d305776fc421808d9fa96497ddee0 | |
parent | 24fadd7c3d0a8f643e9df1c7ae3c1c7e88e8592e (diff) | |
download | gitlab-ce-81f2bdfccb6e72ac4b90e6ea24ce24c71e3074cb.tar.gz |
Removed tooltip from clone dropdown
-rw-r--r-- | app/assets/javascripts/project.js | 31 | ||||
-rw-r--r-- | app/helpers/button_helper.rb | 46 | ||||
-rw-r--r-- | changelogs/unreleased/39455-clone-dropdown-should-not-have-a-tooltip.yml | 5 |
3 files changed, 56 insertions, 26 deletions
diff --git a/app/assets/javascripts/project.js b/app/assets/javascripts/project.js index 36b6a5ed376..8d49ae2e712 100644 --- a/app/assets/javascripts/project.js +++ b/app/assets/javascripts/project.js @@ -17,6 +17,37 @@ export default class Project { $('a', $cloneOptions).on('click', (e) => { const $this = $(e.currentTarget); const url = $this.attr('href'); + const activeText = $this.find('.dropdown-menu-inner-title').text(); + + e.preventDefault(); + + $('.is-active', $cloneOptions).not($this).removeClass('is-active'); + $this.toggleClass('is-active'); + $projectCloneField.val(url); + $cloneBtnText.text(activeText); + + return $('.clone').text(url); + }); + // Ref switcher + this.initRefSwitcher(); + $('.project-refs-select').on('change', function() { + return $(this).parents('form').submit(); + }); + $('.hide-no-ssh-message').on('click', function(e) { + Cookies.set('hide_no_ssh_message', 'false'); + $(this).parents('.no-ssh-key-message').remove(); + return e.preventDefault(); + }); + $('.hide-no-password-message').on('click', function(e) { + Cookies.set('hide_no_password_message', 'false'); + $(this).parents('.no-password-message').remove(); + return e.preventDefault(); + }); + this.projectSelectDropdown(); + + $('a', $cloneOptions).on('click', (e) => { + const $this = $(e.currentTarget); + const url = $this.attr('href'); e.preventDefault(); diff --git a/app/helpers/button_helper.rb b/app/helpers/button_helper.rb index 8e8feeea1d8..fe5abf394a6 100644 --- a/app/helpers/button_helper.rb +++ b/app/helpers/button_helper.rb @@ -57,41 +57,35 @@ module ButtonHelper end def http_clone_button(project, placement = 'right', append_link: true) - klass = 'http-selector' - klass << ' has-tooltip' if current_user.try(:require_extra_setup_for_git_auth?) - protocol = gitlab_config.protocol.upcase - tooltip_title = - if current_user.try(:require_password_creation_for_git?) + protocol_description = + if current_user.try(:require_password_creation?) _("Set a password on your account to pull or push via %{protocol}.") % { protocol: protocol } else _("Create a personal access token on your account to pull or push via %{protocol}.") % { protocol: protocol } end - content_tag (append_link ? :a : :span), protocol, - class: klass, - href: (project.http_url_to_repo if append_link), - data: { - html: true, - placement: placement, - container: 'body', - title: tooltip_title - } + protocol_element_output = content_tag(:strong, protocol, class: 'dropdown-menu-inner-title') + + if current_user.try(:require_password_creation?) || current_user.try(:require_personal_access_token_creation_for_git_auth?) + protocol_element_output << content_tag(:span, protocol_description, class: 'dropdown-menu-inner-content') + end + + content_tag (append_link ? :a : :span), + protocol_element_output, + class: 'http-selector', + href: (project.http_url_to_repo if append_link) end - def ssh_clone_button(project, placement = 'right', append_link: true) - klass = 'ssh-selector' - klass << ' has-tooltip' if current_user.try(:require_ssh_key?) + def ssh_clone_button(project, append_link: true) + ssh_description = _('Add an SSH key to your profile to pull or push via SSH.') + ssh_element_output = content_tag(:strong, 'SSH', class: 'dropdown-menu-inner-title') + ssh_element_output << content_tag(:span, ssh_description, class: 'dropdown-menu-inner-content') if current_user.try(:require_ssh_key?) - content_tag (append_link ? :a : :span), 'SSH', - class: klass, - href: (project.ssh_url_to_repo if append_link), - data: { - html: true, - placement: placement, - container: 'body', - title: _('Add an SSH key to your profile to pull or push via SSH.') - } + content_tag (append_link ? :a : :span), + ssh_element_output, + class: 'ssh-selector', + href: (project.ssh_url_to_repo if append_link) end end diff --git a/changelogs/unreleased/39455-clone-dropdown-should-not-have-a-tooltip.yml b/changelogs/unreleased/39455-clone-dropdown-should-not-have-a-tooltip.yml new file mode 100644 index 00000000000..cb522cb7611 --- /dev/null +++ b/changelogs/unreleased/39455-clone-dropdown-should-not-have-a-tooltip.yml @@ -0,0 +1,5 @@ +--- +title: Removed tooltip from clone dropdown +merge_request: 15334 +author: +type: other |