2016-04-21 14:34:00 +00:00
|
|
|
- if can?(current_user, :push_code, @project)
|
2018-04-06 16:27:12 +00:00
|
|
|
- can_create_merge_request = can?(current_user, :create_merge_request_in, @project)
|
|
|
|
- data_action = can_create_merge_request ? 'create-mr' : 'create-branch'
|
|
|
|
- value = can_create_merge_request ? 'Create merge request' : 'Create branch'
|
2019-06-20 17:59:02 +00:00
|
|
|
- value = can_create_confidential_merge_request? ? _('Create confidential merge request') : value
|
2019-07-05 10:14:56 +00:00
|
|
|
- create_mr_text = can_create_confidential_merge_request? ? _('Create confidential merge request') : _('Create merge request')
|
2018-04-06 16:27:12 +00:00
|
|
|
|
2017-11-25 11:33:05 +00:00
|
|
|
- can_create_path = can_create_branch_project_issue_path(@project, @issue)
|
|
|
|
- create_mr_path = create_merge_request_project_issue_path(@project, @issue, branch_name: @issue.to_branch_name, ref: @project.default_branch)
|
|
|
|
- create_branch_path = project_branches_path(@project, branch_name: @issue.to_branch_name, ref: @project.default_branch, issue_iid: @issue.iid)
|
|
|
|
- refs_path = refs_namespace_project_path(@project.namespace, @project, search: '')
|
|
|
|
|
2019-07-05 10:14:56 +00:00
|
|
|
.create-mr-dropdown-wrap.d-inline-block.full-width-mobile.js-create-mr{ data: { project_path: @project.full_path, project_id: @project.id, can_create_path: can_create_path, create_mr_path: create_mr_path, create_branch_path: create_branch_path, refs_path: refs_path, is_confidential: can_create_confidential_merge_request?.to_s } }
|
2019-06-06 14:44:13 +00:00
|
|
|
.btn-group.btn-group-sm.unavailable
|
2017-05-04 08:09:21 +00:00
|
|
|
%button.btn.btn-grouped{ type: 'button', disabled: 'disabled' }
|
2020-02-19 09:08:59 +00:00
|
|
|
.spinner.align-text-bottom.mr-1.hide
|
2017-05-04 08:09:21 +00:00
|
|
|
%span.text
|
|
|
|
Checking branch availability…
|
2018-10-23 09:49:45 +00:00
|
|
|
|
2019-06-06 14:44:13 +00:00
|
|
|
.btn-group.btn-group-sm.available.hidden
|
2018-01-28 22:43:47 +00:00
|
|
|
%button.btn.js-create-merge-request.btn-success.btn-inverted{ type: 'button', data: { action: data_action } }
|
2017-11-25 11:33:05 +00:00
|
|
|
= value
|
|
|
|
|
2019-06-06 14:44:13 +00:00
|
|
|
%button.btn.create-merge-request-dropdown-toggle.dropdown-toggle.btn-success.btn-inverted.js-dropdown-toggle.flex-grow-0{ type: 'button', data: { dropdown: { trigger: '#create-merge-request-dropdown' }, display: 'static' } }
|
2017-05-04 08:09:21 +00:00
|
|
|
= icon('caret-down')
|
2017-11-25 11:33:05 +00:00
|
|
|
|
2018-02-01 14:19:27 +00:00
|
|
|
.droplab-dropdown
|
2019-06-20 17:59:02 +00:00
|
|
|
%ul#create-merge-request-dropdown.create-merge-request-dropdown-menu.dropdown-menu.dropdown-menu-right.gl-show-field-errors{ class: ("create-confidential-merge-request-dropdown-menu" if can_create_confidential_merge_request?), data: { dropdown: true } }
|
2018-02-01 14:19:27 +00:00
|
|
|
- if can_create_merge_request
|
2019-07-05 10:14:56 +00:00
|
|
|
%li.droplab-item-selected{ role: 'button', data: { value: 'create-mr', text: create_mr_text } }
|
2019-12-06 09:06:39 +00:00
|
|
|
.menu-item.text-nowrap
|
2018-02-01 14:19:27 +00:00
|
|
|
= icon('check', class: 'icon')
|
2019-06-20 17:59:02 +00:00
|
|
|
- if can_create_confidential_merge_request?
|
|
|
|
= _('Create confidential merge request and branch')
|
|
|
|
- else
|
|
|
|
= _('Create merge request and branch')
|
2018-02-01 14:19:27 +00:00
|
|
|
|
2019-01-16 12:09:29 +00:00
|
|
|
%li{ class: [!can_create_merge_request && 'droplab-item-selected'], role: 'button', data: { value: 'create-branch', text: _('Create branch') } }
|
2018-02-01 14:19:27 +00:00
|
|
|
.menu-item
|
|
|
|
= icon('check', class: 'icon')
|
|
|
|
= _('Create branch')
|
|
|
|
%li.divider.droplab-item-ignore
|
|
|
|
|
2020-06-29 15:08:56 +00:00
|
|
|
%li.droplab-item-ignore.gl-ml-3.gl-mr-3.gl-mt-5
|
2019-07-05 10:14:56 +00:00
|
|
|
- if can_create_confidential_merge_request?
|
|
|
|
#js-forked-project{ data: { namespace_path: @project.namespace.full_path, project_path: @project.full_path, new_fork_path: new_project_fork_path(@project), help_page_path: help_page_path('user/project/merge_requests') } }
|
2018-02-01 14:19:27 +00:00
|
|
|
.form-group
|
|
|
|
%label{ for: 'new-branch-name' }
|
|
|
|
= _('Branch name')
|
|
|
|
%input#new-branch-name.js-branch-name.form-control{ type: 'text', placeholder: "#{@issue.to_branch_name}", value: "#{@issue.to_branch_name}" }
|
2018-06-19 21:22:31 +00:00
|
|
|
%span.js-branch-message.form-text
|
2018-02-01 14:19:27 +00:00
|
|
|
|
|
|
|
.form-group
|
|
|
|
%label{ for: 'source-name' }
|
|
|
|
= _('Source (branch or tag)')
|
|
|
|
%input#source-name.js-ref.ref.form-control{ type: 'text', placeholder: "#{@project.default_branch}", value: "#{@project.default_branch}", data: { value: "#{@project.default_branch}" } }
|
2018-04-11 18:26:37 +00:00
|
|
|
%span.js-ref-message.form-text.text-muted
|
2018-02-01 14:19:27 +00:00
|
|
|
|
|
|
|
.form-group
|
|
|
|
%button.btn.btn-success.js-create-target{ type: 'button', data: { action: 'create-mr' } }
|
2019-07-05 10:14:56 +00:00
|
|
|
= create_mr_text
|
|
|
|
|
|
|
|
- if can_create_confidential_merge_request?
|
|
|
|
%p.text-warning.js-exposed-info-warning.hidden
|
|
|
|
= _('This may expose confidential information as the selected fork is in another namespace that can have other members.')
|