2018-04-10 13:49:26 -04:00
|
|
|
- can_create_issue = show_new_issue_link?(@project)
|
2018-04-06 12:27:12 -04:00
|
|
|
- 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
|
2016-12-16 10:46:24 -05:00
|
|
|
.project-action-button.dropdown.inline
|
2017-06-09 09:08:39 -04:00
|
|
|
%a.btn.dropdown-toggle.has-tooltip{ href: '#', title: _('Create new...'), 'data-toggle' => 'dropdown', 'data-container' => 'body', 'aria-label' => _('Create new...') }
|
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
|
2018-01-22 07:13:07 -05:00
|
|
|
- if can_create_issue || merge_project || can_create_project_snippet
|
|
|
|
%li.dropdown-header= _('This project')
|
2016-03-31 19:02:50 -04:00
|
|
|
|
|
|
|
- if can_create_issue
|
2018-01-16 15:52:37 -05:00
|
|
|
%li= link_to _('New issue'), new_project_issue_path(@project)
|
|
|
|
|
2015-12-23 10:20:07 -05:00
|
|
|
- if merge_project
|
2018-01-16 15:52:37 -05:00
|
|
|
%li= link_to _('New merge request'), project_new_merge_request_path(merge_project)
|
|
|
|
|
2018-01-22 07:13:07 -05:00
|
|
|
- if can_create_project_snippet
|
2018-01-16 15:52:37 -05:00
|
|
|
%li= link_to _('New snippet'), new_project_snippet_path(@project)
|
2015-12-18 04:03:34 -05:00
|
|
|
|
2018-04-06 12:27:12 -04:00
|
|
|
- if can_push_code
|
2018-01-22 07:13:07 -05:00
|
|
|
%li.dropdown-header= _('This repository')
|
2016-03-31 19:02:50 -04:00
|
|
|
|
2018-04-06 12:27:12 -04:00
|
|
|
- if can_push_code
|
2018-01-16 15:52:37 -05:00
|
|
|
%li= link_to _('New file'), project_new_blob_path(@project, @project.default_branch || 'master')
|
2018-01-09 13:00:11 -05:00
|
|
|
- unless @project.empty_repo?
|
2018-01-16 15:52:37 -05:00
|
|
|
%li= link_to _('New branch'), new_project_branch_path(@project)
|
|
|
|
%li= link_to _('New tag'), new_project_tag_path(@project)
|
2018-04-06 12:27:12 -04:00
|
|
|
- elsif can_collaborate_with_project?(@project)
|
2018-01-16 15:52:37 -05:00
|
|
|
%li= link_to _('New file'), project_new_blob_path(@project, @project.default_branch || 'master')
|
2018-04-06 12:27:12 -04:00
|
|
|
- elsif create_mr_from_new_fork
|
2018-01-16 15:52:37 -05:00
|
|
|
- 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 }
|
2018-01-22 07:13:07 -05:00
|
|
|
- fork_path = project_forks_path(@project, namespace_key: current_user.namespace.id, continue: continue_params)
|
2018-01-16 15:52:37 -05:00
|
|
|
%li= link_to _('New file'), fork_path, method: :post
|