gitlab-org--gitlab-foss/app/views/projects/buttons/_dropdown.html.haml

60 lines
2.6 KiB
Text
Raw Normal View History

- if current_user
2016-12-16 10:46:24 -05:00
.project-action-button.dropdown.inline
%a.btn.dropdown-toggle{ href: '#', "data-toggle" => "dropdown" }
2015-07-31 07:56:15 -04:00
= icon('plus')
2016-10-04 21:18:18 -04:00
= icon("caret-down")
2016-05-19 11:11:54 -04:00
%ul.dropdown-menu.dropdown-menu-align-right.project-home-dropdown
- can_create_issue = can?(current_user, :create_issue, @project)
- merge_project = can?(current_user, :create_merge_request, @project) ? @project : (current_user && current_user.fork_of(@project))
- can_create_snippet = can?(current_user, :create_snippet, @project)
- if can_create_issue
%li
= link_to new_namespace_project_issue_path(@project.namespace, @project) do
2015-07-31 07:56:15 -04:00
= icon('exclamation-circle fw')
New issue
- if merge_project
%li
= link_to new_namespace_project_merge_request_path(merge_project.namespace, merge_project) do
2015-07-31 07:56:15 -04:00
= icon('tasks fw')
New merge request
- if can_create_snippet
%li
2015-07-31 07:56:15 -04:00
= link_to new_namespace_project_snippet_path(@project.namespace, @project) do
= icon('file-text-o fw')
New snippet
- if can_create_issue || merge_project || can_create_snippet
%li.divider
- if can?(current_user, :push_code, @project)
%li
= link_to namespace_project_new_blob_path(@project.namespace, @project, @project.default_branch || 'master') do
= icon('file fw')
New file
%li
= link_to new_namespace_project_branch_path(@project.namespace, @project) do
2015-07-31 07:56:15 -04:00
= icon('code-fork fw')
New branch
%li
= link_to new_namespace_project_tag_path(@project.namespace, @project) do
2015-07-31 07:56:15 -04:00
= icon('tags fw')
New tag
- elsif current_user && current_user.already_forked?(@project)
%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
- 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_forks_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