summaryrefslogtreecommitdiff
path: root/app/views/projects/buttons
diff options
context:
space:
mode:
authorDouwe Maan <douwe@gitlab.com>2015-12-18 10:03:34 +0100
committerDouwe Maan <douwe@gitlab.com>2015-12-18 10:03:34 +0100
commitd9c82d679fd622aead99aeb90369361a05e02a36 (patch)
tree6bc7986aafad7e0a3998c0a026573e9baf0cc032 /app/views/projects/buttons
parent110a5f9c96457ac314f30630735dd827d9d96a4c (diff)
downloadgitlab-ce-d9c82d679fd622aead99aeb90369361a05e02a36.tar.gz
Automatically fork a project when not allowed to edit a file.
Diffstat (limited to 'app/views/projects/buttons')
-rw-r--r--app/views/projects/buttons/_dropdown.html.haml20
1 files changed, 19 insertions, 1 deletions
diff --git a/app/views/projects/buttons/_dropdown.html.haml b/app/views/projects/buttons/_dropdown.html.haml
index b277b765b6b..1f639fecc30 100644
--- a/app/views/projects/buttons/_dropdown.html.haml
+++ b/app/views/projects/buttons/_dropdown.html.haml
@@ -18,10 +18,11 @@
= link_to new_namespace_project_snippet_path(@project.namespace, @project) do
= icon('file-text-o fw')
New snippet
+
- if can?(current_user, :push_code, @project)
%li.divider
%li
- = link_to namespace_project_new_blob_path(@project.namespace, @project, @project.default_branch || 'master'), title: 'New file' do
+ = link_to namespace_project_new_blob_path(@project.namespace, @project, @project.default_branch || 'master') do
= icon('file fw')
New file
%li
@@ -32,3 +33,20 @@
= link_to new_namespace_project_tag_path(@project.namespace, @project) do
= icon('tags fw')
New tag
+ - elsif current_user && current_user.already_forked?(@project)
+ %li.divider
+ %li
+ = link_to namespace_project_new_blob_path(@project.namespace, @project, @project.default_branch || 'master') do
+ = icon('file fw')
+ New file
+ - elsif can?(current_user, :fork_project, @project)
+ %li.divider
+ %li
+ - continue_params = { to: namespace_project_new_blob_path(@project.namespace, @project, @project.default_branch || 'master'),
+ notice: edit_in_new_fork_notice,
+ notice_now: edit_in_new_fork_notice_now }
+ - fork_path = namespace_project_fork_path(@project.namespace, @project, namespace_key: current_user.namespace.id,
+ continue: continue_params)
+ = link_to fork_path, method: :post do
+ = icon('file fw')
+ New file