diff options
author | Filipa Lacerda <filipa@gitlab.com> | 2017-09-29 15:55:14 +0000 |
---|---|---|
committer | Filipa Lacerda <filipa@gitlab.com> | 2017-09-29 15:55:14 +0000 |
commit | c49d19a5dc058a670bdac1e23579fbb44c60bec4 (patch) | |
tree | 5ce9f61d305edfd9ab57dc47aaa2a9b2e3429259 /app/views | |
parent | 0e82f6d38d5a186634e70e3eafa9e3e74cf8d5dd (diff) | |
parent | 93aa6d04c2e81193d7833890d2281fc1df7d7129 (diff) | |
download | gitlab-ce-c49d19a5dc058a670bdac1e23579fbb44c60bec4.tar.gz |
Merge branch 'fork-btn-enabled-user-groups' into 'master'
Fix fork button being disabled for users who can fork to group
Closes #38462
See merge request gitlab-org/gitlab-ce!14551
Diffstat (limited to 'app/views')
-rw-r--r-- | app/views/projects/buttons/_fork.html.haml | 9 | ||||
-rw-r--r-- | app/views/projects/forks/new.html.haml | 10 |
2 files changed, 11 insertions, 8 deletions
diff --git a/app/views/projects/buttons/_fork.html.haml b/app/views/projects/buttons/_fork.html.haml index f45cc7f0f45..f880556a9f7 100644 --- a/app/views/projects/buttons/_fork.html.haml +++ b/app/views/projects/buttons/_fork.html.haml @@ -4,12 +4,11 @@ = link_to namespace_project_path(current_user, current_user.fork_of(@project)), title: _('Go to your fork'), class: 'btn has-tooltip' do = custom_icon('icon_fork') %span= s_('GoToYourFork|Fork') - - elsif !current_user.can_create_project? - = link_to new_project_fork_path(@project), title: _('You have reached your project limit'), class: 'btn has-tooltip disabled' do - = custom_icon('icon_fork') - %span= s_('CreateNewFork|Fork') - else - = link_to new_project_fork_path(@project), class: 'btn' do + - can_create_fork = current_user.can?(:create_fork) + = link_to new_project_fork_path(@project), + class: "btn btn-default #{'has-tooltip disabled' unless can_create_fork}", + title: (_('You have reached your project limit') unless can_create_fork) do = custom_icon('icon_fork') %span= s_('CreateNewFork|Fork') .count-with-arrow diff --git a/app/views/projects/forks/new.html.haml b/app/views/projects/forks/new.html.haml index 0f36e1a7353..906774a21e3 100644 --- a/app/views/projects/forks/new.html.haml +++ b/app/views/projects/forks/new.html.haml @@ -13,7 +13,7 @@ - if @namespaces.present? %label.label-light %span - Click to fork the project to a user or group + Click to fork the project - @namespaces.in_groups_of(6, false) do |group| .row - group.each do |namespace| @@ -29,8 +29,12 @@ .caption = namespace.human_name - else - .fork-thumbnail - = link_to project_forks_path(@project, namespace_key: namespace.id), method: "POST" do + - can_create_project = current_user.can?(:create_projects, namespace) + .fork-thumbnail{ class: ("disabled" unless can_create_project) } + = link_to project_forks_path(@project, namespace_key: namespace.id), + method: "POST", + class: ("disabled has-tooltip" unless can_create_project), + title: (_('You have reached your project limit') unless can_create_project) do - if /no_((\w*)_)*avatar/.match(avatar) .no-avatar = icon 'question' |