summaryrefslogtreecommitdiff
path: root/app/views/projects/forks
diff options
context:
space:
mode:
authorPhil Hughes <me@iamphill.com>2017-09-28 11:44:33 +0100
committerPhil Hughes <me@iamphill.com>2017-09-29 10:51:26 +0100
commit8585ae61e730a48fc0688417b24279c48b59dada (patch)
tree46362df866c55c3f902ea24596771e007bdbf897 /app/views/projects/forks
parentccfe6860079c6c75ab5a1f831cd62af0e355331e (diff)
downloadgitlab-ce-8585ae61e730a48fc0688417b24279c48b59dada.tar.gz
Fix fork button being disabled for users who can fork to group
Previously the fork button was disabled for all users if they have exceeded their project limit. This fixes that by changing the check to see if the user can fork to a group instead of their own namespace. This behaviour is already possible by visiting the new fork page directly, so this just fixes the button being disabled. Closes #38462
Diffstat (limited to 'app/views/projects/forks')
-rw-r--r--app/views/projects/forks/new.html.haml11
1 files changed, 8 insertions, 3 deletions
diff --git a/app/views/projects/forks/new.html.haml b/app/views/projects/forks/new.html.haml
index 0f36e1a7353..008de97d6d3 100644
--- a/app/views/projects/forks/new.html.haml
+++ b/app/views/projects/forks/new.html.haml
@@ -1,4 +1,5 @@
- page_title "Fork project"
+- can_create_project = current_user.can_create_project?
.row.prepend-top-default
.col-lg-3
@@ -13,7 +14,7 @@
- if @namespaces.present?
%label.label-light
%span
- Click to fork the project to a user or group
+ #{ "Click to fork the project to a #{'user or' if can_create_project} group" }
- @namespaces.in_groups_of(6, false) do |group|
.row
- group.each do |namespace|
@@ -29,8 +30,12 @@
.caption
= namespace.human_name
- else
- .fork-thumbnail
- = link_to project_forks_path(@project, namespace_key: namespace.id), method: "POST" do
+ - is_disabled = namespace.kind === 'user' && !can_create_project
+ .fork-thumbnail{ class: ("disabled" if is_disabled) }
+ = link_to project_forks_path(@project, namespace_key: namespace.id),
+ method: "POST",
+ class: ("disabled has-tooltip" if is_disabled),
+ title: (_('You have reached your project limit') if is_disabled) do
- if /no_((\w*)_)*avatar/.match(avatar)
.no-avatar
= icon 'question'