65 lines
4.6 KiB
Text
65 lines
4.6 KiB
Text
- if can?(current_user, :push_code, @project)
|
|
- 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')
|
|
- value = can_create_confidential_merge_request? ? _('Create confidential merge request') : value
|
|
- create_mr_text = can_create_confidential_merge_request? ? _('Create confidential merge request') : _('Create merge request')
|
|
|
|
- can_create_path = can_create_branch_project_issue_path(@project, @issue)
|
|
- create_branch_path = project_branches_path(@project, branch_name: @issue.to_branch_name, ref: @project.default_branch, issue_iid: @issue.iid, format: :json)
|
|
- refs_path = refs_namespace_project_path(@project.namespace, @project, search: '')
|
|
|
|
.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(from: @issue.to_branch_name, source_project: @project, to: @project.default_branch, mr_params: { issue_iid: @issue.iid }), create_branch_path: create_branch_path, refs_path: refs_path, is_confidential: can_create_confidential_merge_request?.to_s } }
|
|
.btn-group.unavailable
|
|
= render Pajamas::ButtonComponent.new(button_options: { disabled: 'disabled' }) do
|
|
= gl_loading_icon(inline: true, css_class: 'js-create-mr-spinner gl-button-icon gl-display-none')
|
|
%span.text
|
|
= _('Checking branch availability…')
|
|
|
|
|
|
.btn-group.available.hidden
|
|
= render Pajamas::ButtonComponent.new(variant: :confirm, button_options: { class: 'js-create-merge-request', data: { action: data_action } }) do
|
|
= gl_loading_icon(inline: true , css_class: 'js-create-mr-spinner js-spinner gl-display-none')
|
|
= value
|
|
|
|
= render Pajamas::ButtonComponent.new(variant: :confirm, icon: 'chevron-down', button_options: { class: 'js-dropdown-toggle dropdown-toggle create-merge-request-dropdown-toggle', data: { 'dropdown-trigger': '#create-merge-request-dropdown', display: 'static' } })
|
|
|
|
.droplab-dropdown
|
|
%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 } }
|
|
- if can_create_merge_request
|
|
%li.droplab-item-selected{ role: 'button', data: { value: 'create-mr', text: create_mr_text } }
|
|
.menu-item.text-nowrap
|
|
= sprite_icon('check', css_class: 'icon')
|
|
- if can_create_confidential_merge_request?
|
|
= _('Create confidential merge request and branch')
|
|
- else
|
|
= _('Create merge request and branch')
|
|
|
|
%li{ class: [!can_create_merge_request && 'droplab-item-selected'], role: 'button', data: { value: 'create-branch', text: _('Create branch') } }
|
|
.menu-item
|
|
= sprite_icon('check', css_class: 'icon')
|
|
= _('Create branch')
|
|
%li.divider.droplab-item-ignore
|
|
|
|
%li.droplab-item-ignore.gl-ml-3.gl-mr-3.gl-mt-5
|
|
- 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/index.md') } }
|
|
.form-group
|
|
%label{ for: 'new-branch-name' }
|
|
= _('Branch name')
|
|
%input#new-branch-name.js-branch-name.form-control.gl-form-input{ type: 'text', placeholder: "#{@issue.to_branch_name}", value: "#{@issue.to_branch_name}" }
|
|
%span.js-branch-message.form-text
|
|
|
|
.form-group
|
|
%label{ for: 'source-name' }
|
|
= _('Source (branch or tag)')
|
|
%input#source-name.js-ref.ref.form-control.gl-form-input{ type: 'text', placeholder: "#{@project.default_branch}", value: "#{@project.default_branch}", data: { value: "#{@project.default_branch}" } }
|
|
%span.js-ref-message.form-text
|
|
|
|
.form-group
|
|
= render Pajamas::ButtonComponent.new(variant: :confirm, button_options: { class: 'js-create-target', data: { action: 'create-mr' } }) do
|
|
= create_mr_text
|
|
|
|
- if can_create_confidential_merge_request?
|
|
%p.gl-text-orange-500.js-exposed-info-warning.gl-display-none
|
|
= _('This may expose confidential information as the selected fork is in another namespace that can have other members.')
|