gitlabhq/app/views/merge_requests/_form.html.haml
2012-10-16 00:46:48 +02:00

70 lines
2.3 KiB
Plaintext

= form_for [@project, @merge_request], html: { class: "new_merge_request form-horizontal" } do |f|
-if @merge_request.errors.any?
.alert-message.block-message.error
%ul
- @merge_request.errors.full_messages.each do |msg|
%li= msg
%h4.cdark 1. Select Branches
%br
.row
.span5
.mr_branch_box
%h5 From (Head Branch)
.body
.padded= f.select(:source_branch, @project.heads.map(&:name), { include_blank: "Select branch" }, {class: 'chosen span4'})
.mr_source_commit
.span2
%center= image_tag "merge.png", class: 'mr_direction_tip'
.span5
.mr_branch_box
%h5 To (Base Branch)
.body
.padded= f.select(:target_branch, @project.heads.map(&:name), { include_blank: "Select branch" }, {class: 'chosen span4'})
.mr_target_commit
%h4.cdark 2. Fill info
.clearfix
.main_box
.top_box_content
= f.label :title do
%strong= "Title *"
.input= f.text_field :title, class: "input-xxlarge pad gfm-input", maxlength: 255, rows: 5
.middle_box_content
= 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'})
.control-group
.form-actions
= f.submit 'Save', class: "btn save-btn"
- if @merge_request.new_record?
= link_to project_merge_requests_path(@project), class: "btn cancel-btn" do
Cancel
- else
= link_to project_merge_request_path(@project, @merge_request), class: "btn cancel-btn" do
Cancel
:javascript
$(function(){
disableButtonIfEmptyField("#merge_request_title", ".save-btn");
var source_branch = $("#merge_request_source_branch");
var target_branch = $("#merge_request_target_branch");
$.get("#{branch_from_project_merge_requests_path(@project)}", {ref: source_branch.val() });
$.get("#{branch_to_project_merge_requests_path(@project)}", {ref: target_branch.val() });
source_branch.live("change", function() {
$.get("#{branch_from_project_merge_requests_path(@project)}", {ref: $(this).val() });
});
target_branch.live("change", function() {
$.get("#{branch_to_project_merge_requests_path(@project)}", {ref: $(this).val() });
});
});