2013-01-05 02:18:39 +01:00
|
|
|
= form_for [@project, @merge_request], html: { class: "#{controller.action_name}-merge-request form-horizontal" } do |f|
|
2012-01-28 16:21:00 +01:00
|
|
|
-if @merge_request.errors.any?
|
2013-01-30 15:53:18 +01:00
|
|
|
.alert.alert-error
|
2012-01-28 16:21:00 +01:00
|
|
|
%ul
|
|
|
|
- @merge_request.errors.full_messages.each do |msg|
|
|
|
|
%li= msg
|
2011-12-13 22:24:31 +01:00
|
|
|
|
2013-01-04 22:35:31 +01:00
|
|
|
%fieldset
|
|
|
|
%legend 1. Select Branches
|
2012-06-13 19:02:30 +02:00
|
|
|
|
2013-01-04 22:35:31 +01:00
|
|
|
.row
|
|
|
|
.span5
|
|
|
|
.mr_branch_box
|
2013-01-05 23:08:02 +01:00
|
|
|
%h5.cgray From (Head Branch)
|
2013-01-04 22:35:31 +01:00
|
|
|
.body
|
2013-03-31 16:08:10 +02:00
|
|
|
.padded= f.select(:source_branch, @repository.branch_names, { include_blank: "Select branch" }, {class: 'chosen span4'})
|
2013-01-04 22:35:31 +01:00
|
|
|
.mr_source_commit
|
2012-06-13 08:03:53 +02:00
|
|
|
|
2013-01-04 22:35:31 +01:00
|
|
|
.span2
|
|
|
|
%center= image_tag "merge.png", class: 'mr_direction_tip'
|
|
|
|
.span5
|
|
|
|
.mr_branch_box
|
2013-01-05 23:08:02 +01:00
|
|
|
%h5.cgray To (Base Branch)
|
2013-01-04 22:35:31 +01:00
|
|
|
.body
|
2013-03-31 16:08:10 +02:00
|
|
|
.padded= f.select(:target_branch, @repository.branch_names, { include_blank: "Select branch" }, {class: 'chosen span4'})
|
2013-01-04 22:35:31 +01:00
|
|
|
.mr_target_commit
|
2012-06-13 08:03:53 +02:00
|
|
|
|
2013-01-04 22:35:31 +01:00
|
|
|
%fieldset
|
|
|
|
%legend 2. Fill info
|
2012-07-17 07:19:16 +02:00
|
|
|
|
2013-01-04 22:35:31 +01:00
|
|
|
.ui-box.ui-box-show
|
|
|
|
.ui-box-head
|
|
|
|
.clearfix
|
|
|
|
= f.label :title do
|
|
|
|
%strong= "Title *"
|
|
|
|
.input= f.text_field :title, class: "input-xxlarge pad js-gfm-input", maxlength: 255, rows: 5, required: true
|
|
|
|
.ui-box-body
|
|
|
|
.clearfix
|
|
|
|
.left
|
|
|
|
= f.label :assignee_id do
|
|
|
|
%i.icon-user
|
|
|
|
Assign to
|
|
|
|
.input= f.select(:assignee_id, @project.users.all.collect {|p| [ p.name, p.id ] }, { include_blank: "Select user" }, {class: 'chosen span3'})
|
|
|
|
.left
|
|
|
|
= f.label :milestone_id do
|
|
|
|
%i.icon-time
|
|
|
|
Milestone
|
|
|
|
.input= f.select(:milestone_id, @project.milestones.active.all.collect {|p| [ p.title, p.id ] }, { include_blank: "Select milestone" }, {class: 'chosen'})
|
2011-12-13 22:24:31 +01:00
|
|
|
|
2012-06-13 08:03:53 +02:00
|
|
|
.control-group
|
|
|
|
|
2012-04-10 07:51:08 +02:00
|
|
|
.form-actions
|
2013-01-05 23:08:02 +01:00
|
|
|
- if @merge_request.new_record?
|
2013-01-29 21:18:19 +01:00
|
|
|
= f.submit 'Submit merge request', class: "btn btn-create"
|
2013-01-05 23:08:02 +01:00
|
|
|
-else
|
2013-01-29 21:18:19 +01:00
|
|
|
= f.submit 'Save changes', class: "btn btn-save"
|
2012-01-28 16:21:00 +01:00
|
|
|
- if @merge_request.new_record?
|
2013-01-29 21:18:19 +01:00
|
|
|
= link_to project_merge_requests_path(@project), class: "btn btn-cancel" do
|
2012-01-28 16:21:00 +01:00
|
|
|
Cancel
|
2012-06-04 00:37:27 +02:00
|
|
|
- else
|
2013-01-29 21:18:19 +01:00
|
|
|
= link_to project_merge_request_path(@project, @merge_request), class: "btn btn-cancel" do
|
2012-01-28 16:21:00 +01:00
|
|
|
Cancel
|
2011-11-28 08:39:43 +01:00
|
|
|
|
|
|
|
:javascript
|
|
|
|
$(function(){
|
2013-01-29 21:18:19 +01:00
|
|
|
disableButtonIfEmptyField("#merge_request_title", ".btn-save");
|
2013-01-05 02:18:39 +01:00
|
|
|
|
|
|
|
var source_branch = $("#merge_request_source_branch")
|
|
|
|
, target_branch = $("#merge_request_target_branch");
|
2012-03-13 22:54:49 +01:00
|
|
|
|
2012-06-13 08:03:53 +02:00
|
|
|
$.get("#{branch_from_project_merge_requests_path(@project)}", {ref: source_branch.val() });
|
|
|
|
$.get("#{branch_to_project_merge_requests_path(@project)}", {ref: target_branch.val() });
|
2012-03-13 22:54:49 +01:00
|
|
|
|
2012-06-13 08:03:53 +02:00
|
|
|
source_branch.live("change", function() {
|
2012-03-13 22:54:49 +01:00
|
|
|
$.get("#{branch_from_project_merge_requests_path(@project)}", {ref: $(this).val() });
|
|
|
|
});
|
|
|
|
|
2012-06-13 08:03:53 +02:00
|
|
|
target_branch.live("change", function() {
|
2012-03-13 22:54:49 +01:00
|
|
|
$.get("#{branch_to_project_merge_requests_path(@project)}", {ref: $(this).val() });
|
|
|
|
});
|
2011-11-28 08:39:43 +01:00
|
|
|
});
|