summaryrefslogtreecommitdiff
path: root/app/helpers
diff options
context:
space:
mode:
authorFilipa Lacerda <filipa@gitlab.com>2019-07-16 14:45:54 +0000
committerFilipa Lacerda <filipa@gitlab.com>2019-07-16 14:45:54 +0000
commitf97a73fa39b48b6c3c770d609fcd9584d17221da (patch)
treee65668f648f2780fbc115cba34bc10b63968a2fd /app/helpers
parentbbbaab1ebdbac222d0674b17f489bd9d0af117ac (diff)
parent1e3877a9c86a3651b12c2f01310e68599b15f8b8 (diff)
downloadgitlab-ce-f97a73fa39b48b6c3c770d609fcd9584d17221da.tar.gz
Merge branch 'vue-file-list-breadcrumb-dropdown' into 'master'
Added add to tree dropdown to Vue files breadcrumb Closes #62865 See merge request gitlab-org/gitlab-ce!30177
Diffstat (limited to 'app/helpers')
-rw-r--r--app/helpers/tree_helper.rb32
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