2017-11-06 09:33:37 -05:00
|
|
|
- can_create_merge_request = can?(current_user, :create_merge_request, @project)
|
|
|
|
- data_action = can_create_merge_request ? 'create-mr' : 'create-branch'
|
2017-11-25 06:33:05 -05:00
|
|
|
- value = can_create_merge_request ? 'Create merge request' : 'Create branch'
|
2017-11-06 09:33:37 -05:00
|
|
|
|
2016-04-21 10:34:00 -04:00
|
|
|
- if can?(current_user, :push_code, @project)
|
2017-11-25 06:33:05 -05: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: '')
|
|
|
|
|
|
|
|
.create-mr-dropdown-wrap{ data: { can_create_path: can_create_path, create_mr_path: create_mr_path, create_branch_path: create_branch_path, refs_path: refs_path } }
|
2017-05-04 04:09:21 -04:00
|
|
|
.btn-group.unavailable
|
|
|
|
%button.btn.btn-grouped{ type: 'button', disabled: 'disabled' }
|
|
|
|
= icon('spinner', class: 'fa-spin')
|
|
|
|
%span.text
|
|
|
|
Checking branch availability…
|
|
|
|
.btn-group.available.hide
|
2017-11-25 06:33:05 -05:00
|
|
|
%button.btn.js-create-merge-request.btn-default{ type: 'button', data: { action: data_action } }
|
|
|
|
= value
|
|
|
|
|
|
|
|
%button.btn.create-merge-request-dropdown-toggle.dropdown-toggle.btn-default.js-dropdown-toggle{ type: 'button', data: { dropdown: { trigger: '#create-merge-request-dropdown' } } }
|
2017-05-04 04:09:21 -04:00
|
|
|
= icon('caret-down')
|
2017-11-25 06:33:05 -05:00
|
|
|
|
|
|
|
%ul#create-merge-request-dropdown.create-merge-request-dropdown-menu.dropdown-menu.dropdown-menu-align-right.gl-show-field-errors{ data: { dropdown: true } }
|
2017-11-06 09:33:37 -05:00
|
|
|
- if can_create_merge_request
|
2017-11-25 06:33:05 -05:00
|
|
|
%li.create-item.droplab-item-selected.droplab-item-ignore-hiding{ role: 'button', data: { value: 'create-mr', text: 'Create merge request' } }
|
|
|
|
.menu-item.droplab-item-ignore-hiding
|
|
|
|
.icon-container.droplab-item-ignore-hiding= icon('check')
|
|
|
|
.description.droplab-item-ignore-hiding Create merge request and branch
|
|
|
|
|
|
|
|
%li.create-item.droplab-item-ignore-hiding{ class: [!can_create_merge_request && 'droplab-item-selected'], role: 'button', data: { value: 'create-branch', text: 'Create branch' } }
|
|
|
|
.menu-item.droplab-item-ignore-hiding
|
|
|
|
.icon-container.droplab-item-ignore-hiding= icon('check')
|
|
|
|
.description.droplab-item-ignore-hiding Create branch
|
|
|
|
%li.divider
|
|
|
|
|
|
|
|
%li.droplab-item-ignore
|
|
|
|
Branch name
|
|
|
|
%input.js-branch-name.form-control.droplab-item-ignore{ type: 'text', placeholder: "#{@issue.to_branch_name}", value: "#{@issue.to_branch_name}" }
|
|
|
|
%span.js-branch-message.branch-message.droplab-item-ignore
|
|
|
|
|
|
|
|
%li.droplab-item-ignore
|
|
|
|
Source (branch or tag)
|
|
|
|
%input.js-ref.ref.form-control.droplab-item-ignore{ type: 'text', placeholder: "#{@project.default_branch}", value: "#{@project.default_branch}", data: { value: "#{@project.default_branch}" } }
|
|
|
|
%span.js-ref-message.ref-message.droplab-item-ignore
|
|
|
|
|
|
|
|
%li.droplab-item-ignore
|
|
|
|
%button.btn.btn-success.js-create-target.droplab-item-ignore{ type: 'button', data: { action: 'create-mr' } }
|
|
|
|
Create merge request
|
|
|
|
|