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

43 lines
2.3 KiB
Text
Raw Normal View History

2018-05-09 12:01:36 +05:30
- can_create_issue = show_new_issue_link?(@project)
- can_create_project_snippet = can?(current_user, :create_project_snippet, @project)
- can_push_code = can?(current_user, :push_code, @project)
- create_mr_from_new_fork = can?(current_user, :fork_project, @project) && can?(current_user, :create_merge_request_in, @project)
- merge_project = merge_request_source_project_for_project(@project)
- show_menu = can_create_issue || can_create_project_snippet || can_push_code || create_mr_from_new_fork || merge_project
- if show_menu
2017-08-17 22:00:37 +05:30
.project-action-button.dropdown.inline
2018-12-13 13:39:08 +05:30
%a.btn.dropdown-toggle.has-tooltip.qa-create-new-dropdown{ href: '#', title: _('Create new...'), 'data-toggle' => 'dropdown', 'data-container' => 'body', 'aria-label' => _('Create new...'), 'data-display' => 'static' }
2015-09-11 14:41:01 +05:30
= icon('plus')
2016-11-03 12:29:30 +05:30
= icon("caret-down")
2018-11-08 19:23:39 +05:30
%ul.dropdown-menu.dropdown-menu-right.project-home-dropdown
2018-03-17 18:26:18 +05:30
- if can_create_issue || merge_project || can_create_project_snippet
%li.dropdown-header= _('This project')
2016-06-02 11:05:42 +05:30
- if can_create_issue
2018-03-17 18:26:18 +05:30
%li= link_to _('New issue'), new_project_issue_path(@project)
2016-06-02 11:05:42 +05:30
- if merge_project
2018-03-17 18:26:18 +05:30
%li= link_to _('New merge request'), project_new_merge_request_path(merge_project)
2016-06-02 11:05:42 +05:30
2018-03-17 18:26:18 +05:30
- if can_create_project_snippet
%li= link_to _('New snippet'), new_project_snippet_path(@project)
2018-05-09 12:01:36 +05:30
- if can_push_code
2018-03-17 18:26:18 +05:30
%li.dropdown-header= _('This repository')
2016-06-02 11:05:42 +05:30
2018-05-09 12:01:36 +05:30
- if can_push_code
2018-12-13 13:39:08 +05:30
%li.qa-new-file-option= link_to _('New file'), project_new_blob_path(@project, @project.default_branch || 'master')
2018-03-17 18:26:18 +05:30
- unless @project.empty_repo?
%li= link_to _('New branch'), new_project_branch_path(@project)
%li= link_to _('New tag'), new_project_tag_path(@project)
2018-05-09 12:01:36 +05:30
- elsif can_collaborate_with_project?(@project)
2018-03-17 18:26:18 +05:30
%li= link_to _('New file'), project_new_blob_path(@project, @project.default_branch || 'master')
2018-05-09 12:01:36 +05:30
- elsif create_mr_from_new_fork
2019-03-02 22:35:43 +05:30
- continue_params = { to: project_new_blob_path(@project, @project.default_branch || 'master'),
notice: edit_in_new_fork_notice,
2018-03-17 18:26:18 +05:30
notice_now: edit_in_new_fork_notice_now }
- fork_path = project_forks_path(@project, namespace_key: current_user.namespace.id, continue: continue_params)
%li= link_to _('New file'), fork_path, method: :post