2013-07-17 21:40:40 +00:00
|
|
|
= form_for [@project, @merge_request], html: { class: "#{controller.action_name}-merge-request form-horizontal" } do |f|
|
2012-01-28 15:21:00 +00:00
|
|
|
-if @merge_request.errors.any?
|
2013-01-30 14:53:18 +00:00
|
|
|
.alert.alert-error
|
2012-01-28 15:21:00 +00:00
|
|
|
%ul
|
|
|
|
- @merge_request.errors.full_messages.each do |msg|
|
|
|
|
%li= msg
|
2011-12-13 21:24:31 +00:00
|
|
|
|
2013-07-17 12:48:22 +00:00
|
|
|
.merge-request-branches
|
2013-09-09 14:11:58 +00:00
|
|
|
.row
|
2013-12-30 21:55:15 +00:00
|
|
|
.col-md-5
|
2013-09-09 14:11:58 +00:00
|
|
|
.clearfix
|
|
|
|
.pull-left
|
2013-12-20 07:48:43 +00:00
|
|
|
= f.select(:source_project_id, [[@merge_request.source_project_path,@merge_request.source_project.id]] , {}, { class: 'source_project chosen span3', disabled: @merge_request.persisted? })
|
2013-09-09 14:11:58 +00:00
|
|
|
.pull-left
|
|
|
|
|
|
|
|
= f.select(:source_branch, @merge_request.source_project.repository.branch_names, { include_blank: "Select branch" }, {class: 'source_branch chosen span2'})
|
|
|
|
.mr_source_commit.prepend-top-10
|
2013-12-30 21:55:15 +00:00
|
|
|
.col-md-2
|
2013-09-09 14:11:58 +00:00
|
|
|
%h2.merge-request-angle.light
|
|
|
|
%i.icon-long-arrow-right
|
2013-12-30 21:55:15 +00:00
|
|
|
.col-md-5
|
2013-09-09 14:11:58 +00:00
|
|
|
.clearfix
|
|
|
|
.pull-left
|
|
|
|
- projects = @project.forked_from_project.nil? ? [@project] : [ @project,@project.forked_from_project]
|
2013-12-20 07:48:43 +00:00
|
|
|
= f.select(:target_project_id, options_from_collection_for_select(projects, 'id', 'path_with_namespace'), {}, { class: 'target_project chosen span3', disabled: @merge_request.persisted? })
|
2013-09-09 14:11:58 +00:00
|
|
|
.pull-left
|
|
|
|
|
|
|
|
= f.select(:target_branch, @target_branches, { include_blank: "Select branch" }, {class: 'target_branch chosen span2'})
|
|
|
|
.mr_target_commit.prepend-top-10
|
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
|
2013-07-17 12:48:22 +00:00
|
|
|
= f.label :title do
|
|
|
|
%strong= "Title *"
|
2013-12-31 00:50:36 +00:00
|
|
|
.col-sm-10= f.text_field :title, class: "input-lg pad js-gfm-input", maxlength: 255, rows: 5, required: true
|
2013-12-30 23:27:02 +00:00
|
|
|
.form-group
|
2013-07-17 12:48:22 +00:00
|
|
|
.left
|
|
|
|
= f.label :assignee_id do
|
|
|
|
%i.icon-user
|
|
|
|
Assign to
|
2013-12-30 23:27:02 +00:00
|
|
|
.col-sm-10= f.select(:assignee_id, assignee_options(@merge_request), { include_blank: "Select user" }, {class: 'chosen span3'})
|
2013-07-17 12:48:22 +00:00
|
|
|
.left
|
|
|
|
= f.label :milestone_id do
|
|
|
|
%i.icon-time
|
|
|
|
Milestone
|
2013-12-30 23:27:02 +00:00
|
|
|
.col-sm-10= f.select(:milestone_id, milestone_options(@merge_request), { include_blank: "Select milestone" }, {class: 'chosen'})
|
|
|
|
.form-group
|
2013-09-09 14:11:58 +00:00
|
|
|
= f.label :description, "Description"
|
2013-12-30 23:27:02 +00:00
|
|
|
.col-sm-10
|
2013-12-31 00:50:36 +00:00
|
|
|
= f.text_area :description, class: "input-lg js-gfm-input", rows: 14
|
2013-09-09 14:11:58 +00:00
|
|
|
%p.hint Description is parsed with #{link_to "GitLab Flavored Markdown", help_markdown_path, target: '_blank'}.
|
|
|
|
|
2012-07-17 05:19:16 +00:00
|
|
|
|
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
|
|
|
});
|