diff options
author | Phil Hughes <me@iamphill.com> | 2019-07-10 13:17:45 +0100 |
---|---|---|
committer | Phil Hughes <me@iamphill.com> | 2019-07-15 15:23:52 +0100 |
commit | 1e3877a9c86a3651b12c2f01310e68599b15f8b8 (patch) | |
tree | a65e005af158137f451c5a16bb9c542e5b81ee2c /app/helpers | |
parent | 4d8babc809ebd13e4f583d5244a97b2955fd4af5 (diff) | |
download | gitlab-ce-1e3877a9c86a3651b12c2f01310e68599b15f8b8.tar.gz |
Added add to tree dropdown to Vue files breadcrumb
Diffstat (limited to 'app/helpers')
-rw-r--r-- | app/helpers/tree_helper.rb | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/app/helpers/tree_helper.rb b/app/helpers/tree_helper.rb index a3575462de0..bb1cdcb1b31 100644 --- a/app/helpers/tree_helper.rb +++ b/app/helpers/tree_helper.rb @@ -154,4 +154,36 @@ module TreeHelper "logs-path" => logs_path } end + + def breadcrumb_data_attributes + attrs = { + can_collaborate: can_collaborate_with_project?(@project).to_s, + new_blob_path: project_new_blob_path(@project, @id), + new_branch_path: new_project_branch_path(@project), + new_tag_path: new_project_tag_path(@project), + can_edit_tree: can_edit_tree?.to_s + } + + if can?(current_user, :fork_project, @project) && can?(current_user, :create_merge_request_in, @project) + continue_param = { + to: project_new_blob_path(@project, @id), + notice: edit_in_new_fork_notice, + notice_now: edit_in_new_fork_notice_now + } + + attrs.merge!( + fork_new_blob_path: project_forks_path(@project, namespace_key: current_user.namespace.id, continue: continue_param), + fork_new_directory_path: project_forks_path(@project, namespace_key: current_user.namespace.id, continue: continue_param.merge({ + to: request.fullpath, + notice: _("%{edit_in_new_fork_notice} Try to create a new directory again.") % { edit_in_new_fork_notice: edit_in_new_fork_notice } + })), + fork_upload_blob_path: project_forks_path(@project, namespace_key: current_user.namespace.id, continue: continue_param.merge({ + to: request.fullpath, + notice: _("%{edit_in_new_fork_notice} Try to upload a file again.") % { edit_in_new_fork_notice: edit_in_new_fork_notice } + })) + ) + end + + attrs + end end |