diff options
author | Phil Hughes <me@iamphill.com> | 2017-11-29 17:25:09 +0000 |
---|---|---|
committer | Phil Hughes <me@iamphill.com> | 2017-11-29 17:25:09 +0000 |
commit | fbe8dfb3008a0502fbc6234a169851a70707b7b6 (patch) | |
tree | 525bd7d13512ed835ef58adb1b5f4d99df899d26 /app/views | |
parent | a9b95d17cf5973e97e0e33e4aadd9516c9005523 (diff) | |
parent | 299c54397340f93646755c16b778c1c38088ded2 (diff) | |
download | gitlab-ce-fbe8dfb3008a0502fbc6234a169851a70707b7b6.tar.gz |
Merge branch 'bvl-double-fork' into 'master'
Redirect to an already forked project if it exists
See merge request gitlab-org/gitlab-ce!15653
Diffstat (limited to 'app/views')
-rw-r--r-- | app/views/projects/forks/_fork_button.html.haml | 26 | ||||
-rw-r--r-- | app/views/projects/forks/new.html.haml | 17 |
2 files changed, 27 insertions, 16 deletions
diff --git a/app/views/projects/forks/_fork_button.html.haml b/app/views/projects/forks/_fork_button.html.haml new file mode 100644 index 00000000000..8a549d431ee --- /dev/null +++ b/app/views/projects/forks/_fork_button.html.haml @@ -0,0 +1,26 @@ +- avatar = namespace_icon(namespace, 100) +- can_create_project = current_user.can?(:create_projects, namespace) + +- if forked_project = namespace.find_fork_of(@project) + .bordered-box.fork-thumbnail.text-center.prepend-left-default.append-right-default.prepend-top-default.append-bottom-default.forked + = link_to project_path(forked_project) do + - if /no_((\w*)_)*avatar/.match(avatar) + = project_identicon(namespace, class: "avatar s100 identicon") + - else + .avatar-container.s100 + = image_tag(avatar, class: "avatar s100") + %h5.prepend-top-default + = namespace.human_name +- else + .bordered-box.fork-thumbnail.text-center.prepend-left-default.append-right-default.prepend-top-default.append-bottom-default{ 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) + = project_identicon(namespace, class: "avatar s100 identicon") + - else + .avatar-container.s100 + = image_tag(avatar, class: "avatar s100") + %h5.prepend-top-default + = namespace.human_name diff --git a/app/views/projects/forks/new.html.haml b/app/views/projects/forks/new.html.haml index e9613534dde..475c6ba4d3d 100644 --- a/app/views/projects/forks/new.html.haml +++ b/app/views/projects/forks/new.html.haml @@ -14,22 +14,7 @@ %h5.prepend-top-0.append-bottom-0.prepend-left-default.append-right-default Click to fork the project - @namespaces.each do |namespace| - - avatar = namespace_icon(namespace, 100) - - can_create_project = current_user.can?(:create_projects, namespace) - - forked_project = namespace.find_fork_of(@project) - - fork_path = forked_project ? project_path(forked_project) : project_forks_path(@project, namespace_key: namespace.id) - .bordered-box.fork-thumbnail.text-center.prepend-left-default.append-right-default.prepend-top-default.append-bottom-default{ class: [("disabled" unless can_create_project), ("forked" if forked_project)] } - = link_to fork_path, - method: "POST", - class: [("js-fork-thumbnail" unless forked_project), ("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) - = project_identicon(namespace, class: "avatar s100 identicon") - - else - .avatar-container.s100 - = image_tag(avatar, class: "avatar s100") - %h5.prepend-top-default - = namespace.human_name + = render 'fork_button', namespace: namespace - else %strong No available namespaces to fork the project. |