Commit 2e2f0675 authored by Jose Ivan Vargas's avatar Jose Ivan Vargas

UX adjustments and spec corrections

parent d19019ec
...@@ -29,36 +29,6 @@ export default class Project { ...@@ -29,36 +29,6 @@ export default class Project {
return $('.clone').text(url); return $('.clone').text(url);
}); });
// Ref switcher // 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();
$('.is-active', $cloneOptions).not($this).removeClass('is-active');
$this.toggleClass('is-active');
$projectCloneField.val(url);
$cloneBtnText.text($this.text());
return $('.clone').text(url);
});
// Ref switcher
Project.initRefSwitcher(); Project.initRefSwitcher();
$('.project-refs-select').on('change', function() { $('.project-refs-select').on('change', function() {
return $(this).parents('form').submit(); return $(this).parents('form').submit();
......
...@@ -406,6 +406,10 @@ ...@@ -406,6 +406,10 @@
.clone-dropdown-btn { .clone-dropdown-btn {
background-color: $white-light; background-color: $white-light;
} }
.clone-options-dropdown {
min-width: 240px;
}
} }
.project-repo-buttons { .project-repo-buttons {
......
...@@ -30,9 +30,9 @@ module ApplicationSettingsHelper ...@@ -30,9 +30,9 @@ module ApplicationSettingsHelper
def enabled_project_button(project, protocol) def enabled_project_button(project, protocol)
case protocol case protocol
when 'ssh' when 'ssh'
ssh_clone_button(project, 'bottom', append_link: false) ssh_clone_button(project, append_link: false)
else else
http_clone_button(project, 'bottom', append_link: false) http_clone_button(project, append_link: false)
end end
end end
......
...@@ -56,7 +56,7 @@ module ButtonHelper ...@@ -56,7 +56,7 @@ module ButtonHelper
end end
end end
def http_clone_button(project, placement = 'right', append_link: true) def http_clone_button(project, append_link: true)
protocol = gitlab_config.protocol.upcase protocol = gitlab_config.protocol.upcase
protocol_description = protocol_description =
...@@ -79,7 +79,7 @@ module ButtonHelper ...@@ -79,7 +79,7 @@ module ButtonHelper
end end
def ssh_clone_button(project, append_link: true) def ssh_clone_button(project, append_link: true)
ssh_description = _('Add an SSH key to your profile to pull or push via SSH.') ssh_description = _("You won't be able to pull or push project code via SSH until you add an SSH key to your profile")
ssh_element_output = content_tag(:strong, 'SSH', class: 'dropdown-menu-inner-title') 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?) ssh_element_output << content_tag(:span, ssh_description, class: 'dropdown-menu-inner-content') if current_user.try(:require_ssh_key?)
......
...@@ -26,9 +26,10 @@ describe ButtonHelper do ...@@ -26,9 +26,10 @@ describe ButtonHelper do
context 'when user has password automatically set' do context 'when user has password automatically set' do
let(:user) { create(:user, password_automatically_set: true) } let(:user) { create(:user, password_automatically_set: true) }
it 'shows a password tooltip' do it 'shows the password text on the dropdown' do
expect(element.attr('class')).to include(has_tooltip_class) expect(element.children.length).to eq(2)
expect(element.attr('data-title')).to eq('Set a password on your account to pull or push via HTTP.') expect(element.children[1].name).to eq('span')
expect(element.children[1].children[0].text).to eq('Set a password on your account to pull or push via HTTP.')
end end
end end
end end
...@@ -40,8 +41,9 @@ describe ButtonHelper do ...@@ -40,8 +41,9 @@ describe ButtonHelper do
context 'when user has no personal access tokens' do context 'when user has no personal access tokens' do
it 'has a personal access token tooltip ' do it 'has a personal access token tooltip ' do
expect(element.attr('class')).to include(has_tooltip_class) expect(element.children.length).to eq(2)
expect(element.attr('data-title')).to eq('Create a personal access token on your account to pull or push via HTTP.') expect(element.children[1].name).to eq('span')
expect(element.children[1].children[0].text).to eq('Create a personal access token on your account to pull or push via HTTP.')
end end
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment