debian-mirror-gitlab/app/views/projects/buttons/_dropdown.html.haml

59 lines
2.6 KiB
Text
Raw Normal View History

2015-09-11 14:41:01 +05:30
- if current_user
.btn-group
%a.btn.dropdown-toggle{href: '#', "data-toggle" => "dropdown"}
2015-09-11 14:41:01 +05:30
= icon('plus')
%ul.dropdown-menu.dropdown-menu-align-right.project-home-dropdown
2016-06-02 11:05:42 +05:30
- 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
2015-09-11 14:41:01 +05:30
%li
2015-11-26 14:37:03 +05:30
= link_to url_for_new_issue(@project, only_path: true) do
2015-09-11 14:41:01 +05:30
= icon('exclamation-circle fw')
New issue
2016-06-02 11:05:42 +05:30
- if merge_project
2015-09-11 14:41:01 +05:30
%li
= link_to new_namespace_project_merge_request_path(merge_project.namespace, merge_project) do
2015-09-11 14:41:01 +05:30
= icon('tasks fw')
New merge request
2016-06-02 11:05:42 +05:30
- if can_create_snippet
2015-09-11 14:41:01 +05:30
%li
= link_to new_namespace_project_snippet_path(@project.namespace, @project) do
= icon('file-text-o fw')
New snippet
2016-06-02 11:05:42 +05:30
- if can_create_issue || merge_project || can_create_snippet
2015-09-11 14:41:01 +05:30
%li.divider
2016-06-02 11:05:42 +05:30
- if can?(current_user, :push_code, @project)
2015-11-26 14:37:03 +05:30
%li
= link_to namespace_project_new_blob_path(@project.namespace, @project, @project.default_branch || 'master') do
2015-11-26 14:37:03 +05:30
= icon('file fw')
New file
2015-09-11 14:41:01 +05:30
%li
= link_to new_namespace_project_branch_path(@project.namespace, @project) do
= icon('code-fork fw')
New branch
%li
= 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
= 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 }
2016-04-02 18:10:28 +05:30
- 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