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

60 lines
2.5 KiB
Text
Raw Normal View History

2015-09-11 14:41:01 +05:30
- if current_user
2017-08-17 22:00:37 +05:30
.project-action-button.dropdown.inline
2017-09-10 17:25:29 +05:30
%a.btn.dropdown-toggle.has-tooltip{ href: '#', title: _('Create new...'), 'data-toggle' => 'dropdown', 'data-container' => 'body', 'aria-label' => _('Create new...') }
2015-09-11 14:41:01 +05:30
= icon('plus')
2016-11-03 12:29:30 +05:30
= icon("caret-down")
%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
2017-09-10 17:25:29 +05:30
= link_to new_project_issue_path(@project) do
2015-09-11 14:41:01 +05:30
= icon('exclamation-circle fw')
2017-09-10 17:25:29 +05:30
#{ _('New issue') }
2016-06-02 11:05:42 +05:30
- if merge_project
2015-09-11 14:41:01 +05:30
%li
2017-09-10 17:25:29 +05:30
= link_to project_new_merge_request_path(merge_project) do
2015-09-11 14:41:01 +05:30
= icon('tasks fw')
2017-09-10 17:25:29 +05:30
#{ _('New merge request') }
2016-06-02 11:05:42 +05:30
- if can_create_snippet
2015-09-11 14:41:01 +05:30
%li
2017-09-10 17:25:29 +05:30
= link_to new_project_snippet_path(@project) do
2015-09-11 14:41:01 +05:30
= icon('file-text-o fw')
2017-09-10 17:25:29 +05:30
#{ _('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
2017-09-10 17:25:29 +05:30
= link_to project_new_blob_path(@project, @project.default_branch || 'master') do
2015-11-26 14:37:03 +05:30
= icon('file fw')
2017-09-10 17:25:29 +05:30
#{ _('New file') }
2015-09-11 14:41:01 +05:30
%li
2017-09-10 17:25:29 +05:30
= link_to new_project_branch_path(@project) do
2015-09-11 14:41:01 +05:30
= icon('code-fork fw')
2017-09-10 17:25:29 +05:30
#{ _('New branch') }
2015-09-11 14:41:01 +05:30
%li
2017-09-10 17:25:29 +05:30
= link_to new_project_tag_path(@project) do
2015-09-11 14:41:01 +05:30
= icon('tags fw')
2017-09-10 17:25:29 +05:30
#{ _('New tag') }
- elsif current_user && current_user.already_forked?(@project)
%li
2017-09-10 17:25:29 +05:30
= link_to project_new_blob_path(@project, @project.default_branch || 'master') do
= icon('file fw')
2017-09-10 17:25:29 +05:30
#{ _('New file') }
- elsif can?(current_user, :fork_project, @project)
%li
2017-09-10 17:25:29 +05:30
- continue_params = { to: project_new_blob_path(@project, @project.default_branch || 'master'),
notice: edit_in_new_fork_notice,
notice_now: edit_in_new_fork_notice_now }
2017-09-10 17:25:29 +05:30
- fork_path = project_forks_path(@project, namespace_key: current_user.namespace.id,
continue: continue_params)
= link_to fork_path, method: :post do
= icon('file fw')
2017-09-10 17:25:29 +05:30
#{ _('New file') }