2014-01-01 20:27:10 +00:00
|
|
|
= form_for [@project, @merge_request], html: { class: "merge-request-form form-horizontal" } do |f|
|
2014-03-24 13:20:29 +00:00
|
|
|
.row
|
|
|
|
.col-sm-2
|
|
|
|
.col-sm-10
|
|
|
|
- if @repository.contribution_guide && !@merge_request.persisted?
|
|
|
|
- contribution_guide_url = project_blob_path(@project, tree_join(@repository.root_ref, @repository.contribution_guide.name))
|
|
|
|
.alert.alert-info
|
|
|
|
Please review the
|
|
|
|
%strong #{link_to "guidelines for contribution", contribution_guide_url}
|
|
|
|
to this repository.
|
|
|
|
|
|
|
|
-if @merge_request.errors.any?
|
|
|
|
.alert.alert-danger
|
|
|
|
- @merge_request.errors.full_messages.each do |msg|
|
|
|
|
%div= msg
|
2011-12-13 21:24:31 +00:00
|
|
|
|
2013-07-17 12:48:22 +00:00
|
|
|
.merge-request-branches
|
2014-02-15 12:52:33 +00:00
|
|
|
.form-group
|
|
|
|
= label_tag nil, class: 'control-label' do
|
|
|
|
From
|
|
|
|
.col-sm-10
|
2013-09-09 14:11:58 +00:00
|
|
|
.clearfix
|
|
|
|
.pull-left
|
2014-01-11 10:11:54 +00:00
|
|
|
= f.select(:source_project_id, [[@merge_request.source_project_path,@merge_request.source_project.id]] , {}, { class: 'source_project select2 span3', disabled: @merge_request.persisted? })
|
2013-09-09 14:11:58 +00:00
|
|
|
.pull-left
|
|
|
|
|
2014-01-31 11:24:38 +00:00
|
|
|
= f.select(:source_branch, @merge_request.source_branches, { include_blank: "Select branch" }, {class: 'source_branch select2 span2'})
|
2014-02-15 12:52:33 +00:00
|
|
|
.mr_source_commit
|
|
|
|
%br
|
|
|
|
.form-group
|
|
|
|
= label_tag nil, class: 'control-label' do
|
|
|
|
To
|
|
|
|
.col-sm-10
|
2013-09-09 14:11:58 +00:00
|
|
|
.clearfix
|
|
|
|
.pull-left
|
2014-04-02 18:51:53 +00:00
|
|
|
- projects = @project.forked_from_project.nil? ? [@project] : [@project, @project.forked_from_project]
|
2013-11-28 08:45:35 +00:00
|
|
|
= f.select(:target_project_id, options_from_collection_for_select(projects, 'id', 'path_with_namespace', f.object.target_project_id), {}, { class: 'target_project select2 span3', disabled: @merge_request.persisted? })
|
2013-09-09 14:11:58 +00:00
|
|
|
.pull-left
|
|
|
|
|
2014-01-31 11:24:38 +00:00
|
|
|
= f.select(:target_branch, @merge_request.target_branches, { include_blank: "Select branch" }, {class: 'target_branch select2 span2'})
|
2014-02-15 12:52:33 +00:00
|
|
|
.mr_target_commit
|
2012-06-13 06:03:53 +00:00
|
|
|
|
2013-07-17 12:48:22 +00:00
|
|
|
%hr
|
2013-07-17 15:35:28 +00:00
|
|
|
.merge-request-form-info
|
2013-12-30 23:27:02 +00:00
|
|
|
.form-group
|
2014-01-01 20:27:10 +00:00
|
|
|
= f.label :title, class: 'control-label' do
|
2013-07-17 12:48:22 +00:00
|
|
|
%strong= "Title *"
|
2014-01-01 20:11:18 +00:00
|
|
|
.col-sm-10= f.text_field :title, class: "form-control pad js-gfm-input", maxlength: 255, rows: 5, required: true
|
2013-12-30 23:27:02 +00:00
|
|
|
.form-group
|
2014-01-01 20:27:10 +00:00
|
|
|
= f.label :description, "Description", class: 'control-label'
|
|
|
|
.col-sm-10
|
|
|
|
= f.text_area :description, class: "form-control js-gfm-input", rows: 14
|
|
|
|
%p.hint Description is parsed with #{link_to "GitLab Flavored Markdown", help_markdown_path, target: '_blank'}.
|
|
|
|
|
2012-04-10 05:51:08 +00:00
|
|
|
.form-actions
|
2013-01-05 22:08:02 +00:00
|
|
|
- if @merge_request.new_record?
|
2013-07-16 21:14:03 +00:00
|
|
|
= f.submit 'Submit merge request', class: "btn btn-create"
|
2013-01-05 22:08:02 +00:00
|
|
|
-else
|
2013-07-16 21:14:03 +00:00
|
|
|
= f.submit 'Save changes', class: "btn btn-save"
|
2012-01-28 15:21:00 +00:00
|
|
|
- if @merge_request.new_record?
|
2013-06-03 20:20:50 +00:00
|
|
|
= link_to project_merge_requests_path(@source_project), class: "btn btn-cancel" do
|
2012-01-28 15:21:00 +00:00
|
|
|
Cancel
|
2012-06-03 22:37:27 +00:00
|
|
|
- else
|
2013-06-03 20:20:50 +00:00
|
|
|
= link_to project_merge_request_path(@target_project, @merge_request), class: "btn btn-cancel" do
|
2012-01-28 15:21:00 +00:00
|
|
|
Cancel
|
2011-11-28 07:39:43 +00:00
|
|
|
|
|
|
|
:javascript
|
2013-06-21 19:08:16 +00:00
|
|
|
disableButtonIfEmptyField("#merge_request_title", ".btn-save");
|
2013-01-05 01:18:39 +00:00
|
|
|
|
2013-06-08 15:51:18 +00:00
|
|
|
var source_branch = $("#merge_request_source_branch")
|
|
|
|
, target_branch = $("#merge_request_target_branch")
|
|
|
|
, target_project = $("#merge_request_target_project_id");
|
2012-03-13 21:54:49 +00:00
|
|
|
|
2013-06-08 15:51:18 +00:00
|
|
|
$.get("#{branch_from_project_merge_requests_path(@source_project)}", {ref: source_branch.val() });
|
|
|
|
$.get("#{branch_to_project_merge_requests_path(@source_project)}", {target_project_id: target_project.val(),ref: target_branch.val() });
|
2012-03-13 21:54:49 +00:00
|
|
|
|
2013-07-12 16:23:42 +00:00
|
|
|
target_project.on("change", function() {
|
2013-06-08 15:51:18 +00:00
|
|
|
$.get("#{update_branches_project_merge_requests_path(@source_project)}", {target_project_id: $(this).val() });
|
|
|
|
});
|
2013-07-12 16:23:42 +00:00
|
|
|
source_branch.on("change", function() {
|
2013-06-08 15:51:18 +00:00
|
|
|
$.get("#{branch_from_project_merge_requests_path(@source_project)}", {ref: $(this).val() });
|
|
|
|
});
|
2013-07-12 16:23:42 +00:00
|
|
|
target_branch.on("change", function() {
|
2013-06-08 15:51:18 +00:00
|
|
|
$.get("#{branch_to_project_merge_requests_path(@source_project)}", {target_project_id: target_project.val(),ref: $(this).val() });
|
2013-07-12 16:23:42 +00:00
|
|
|
});
|