This instance will be upgraded to Heptapod 0.31.0rc on 2022-05-19 at 11:00 UTC+2 (a few minutes of down time)

_form.html.haml 2.81 KB
Newer Older
1
= form_for [@project, @merge_request], html: { class: "#{controller.action_name}-merge-request form-horizontal" } do |f|
2
  -if @merge_request.errors.any?
3
    .alert.alert-error
4
5
6
      %ul
        - @merge_request.errors.full_messages.each do |msg|
          %li= msg
7

Dmitriy Zaporozhets's avatar
Dmitriy Zaporozhets committed
8
9
  %fieldset
    %legend 1. Select Branches
randx's avatar
randx committed
10

Dmitriy Zaporozhets's avatar
Dmitriy Zaporozhets committed
11
12
13
    .row
      .span5
        .mr_branch_box
14
          %h5.cgray From (Head Branch)
Dmitriy Zaporozhets's avatar
Dmitriy Zaporozhets committed
15
          .body
16
            .padded= f.select(:source_branch, @repository.branch_names, { include_blank: "Select branch" }, {class: 'chosen span4'})
Dmitriy Zaporozhets's avatar
Dmitriy Zaporozhets committed
17
        .mr_source_commit
18

Dmitriy Zaporozhets's avatar
Dmitriy Zaporozhets committed
19
20
21
22
      .span2
        %center= image_tag "merge.png", class: 'mr_direction_tip'
      .span5
        .mr_branch_box
23
          %h5.cgray To (Base Branch)
Dmitriy Zaporozhets's avatar
Dmitriy Zaporozhets committed
24
          .body
25
            .padded= f.select(:target_branch, @repository.branch_names, { include_blank: "Select branch" }, {class: 'chosen span4'})
Dmitriy Zaporozhets's avatar
Dmitriy Zaporozhets committed
26
        .mr_target_commit
27

Dmitriy Zaporozhets's avatar
Dmitriy Zaporozhets committed
28
29
  %fieldset
    %legend 2. Fill info
30

Dmitriy Zaporozhets's avatar
Dmitriy Zaporozhets committed
31
32
33
34
35
36
37
38
39
40
41
42
    .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
43
            .input= f.select(:assignee_id, @project.team.members.sort_by(&:name).map {|p| [ p.name, p.id ] }, { include_blank: "Select user" }, {class: 'chosen span3'})
Dmitriy Zaporozhets's avatar
Dmitriy Zaporozhets committed
44
45
46
47
          .left
            = f.label :milestone_id do
              %i.icon-time
              Milestone
48
            .input= f.select(:milestone_id, @project.milestones.active.all.map {|p| [ p.title, p.id ] }, { include_blank: "Select milestone" }, {class: 'chosen'})
49

50
51
  .control-group

randx's avatar
randx committed
52
  .form-actions
53
    - if @merge_request.new_record?
Dmitriy Zaporozhets's avatar
Dmitriy Zaporozhets committed
54
      = f.submit 'Submit merge request', class: "btn btn-create"
55
    -else
Dmitriy Zaporozhets's avatar
Dmitriy Zaporozhets committed
56
      = f.submit 'Save changes', class: "btn btn-save"
57
    - if @merge_request.new_record?
Dmitriy Zaporozhets's avatar
Dmitriy Zaporozhets committed
58
      = link_to project_merge_requests_path(@project), class: "btn btn-cancel" do
59
        Cancel
60
    - else
Dmitriy Zaporozhets's avatar
Dmitriy Zaporozhets committed
61
      = link_to project_merge_request_path(@project, @merge_request), class: "btn btn-cancel" do
62
        Cancel
Dmitriy Zaporozhets's avatar
Dmitriy Zaporozhets committed
63
64

:javascript
Dmitriy Zaporozhets's avatar
Dmitriy Zaporozhets committed
65
  disableButtonIfEmptyField("#merge_request_title", ".btn-save");
66

Dmitriy Zaporozhets's avatar
Dmitriy Zaporozhets committed
67
68
  var source_branch = $("#merge_request_source_branch")
    , target_branch = $("#merge_request_target_branch");
69

Dmitriy Zaporozhets's avatar
Dmitriy Zaporozhets committed
70
71
  $.get("#{branch_from_project_merge_requests_path(@project)}", {ref: source_branch.val() });
  $.get("#{branch_to_project_merge_requests_path(@project)}", {ref: target_branch.val() });
72

Dmitriy Zaporozhets's avatar
Dmitriy Zaporozhets committed
73
74
75
  source_branch.live("change", function() {
    $.get("#{branch_from_project_merge_requests_path(@project)}", {ref: $(this).val() });
  });
76

Dmitriy Zaporozhets's avatar
Dmitriy Zaporozhets committed
77
78
  target_branch.live("change", function() {
    $.get("#{branch_to_project_merge_requests_path(@project)}", {ref: $(this).val() });
Dmitriy Zaporozhets's avatar
Dmitriy Zaporozhets committed
79
  });