BigW Consortium Gitlab

_accept.html.haml 2.55 KB
Newer Older
1
- status_class = @ci_commit ? " ci-#{@ci_commit.status}" : nil
2

3
= form_for [:merge, @project.namespace.becomes(Namespace), @project, @merge_request], remote: true, method: :post, html: { class: 'accept-mr-form js-quick-submit js-requires-input' } do |f|
4
  = hidden_field_tag :authenticity_token, form_authenticity_token
5
  .accept-merge-holder.clearfix.js-toggle-container
6 7
    .clearfix
      .accept-action
8
        - if @ci_commit && @ci_commit.active?
9
          %span.btn-group
10
            = button_tag class: "btn btn-create js-merge-button merge_when_build_succeeds" do
11
              Merge When Build Succeeds
12
            = button_tag class: "btn btn-success dropdown-toggle", 'data-toggle' => 'dropdown' do
13 14 15
              %span.caret
              %span.sr-only
                Select Merge Moment
16
            %ul.js-merge-dropdown.dropdown-menu.dropdown-menu-right{ role: 'menu' }
17 18 19 20 21 22 23 24 25
              %li
                = link_to "#", class: "merge_when_build_succeeds" do
                  = icon('check fw')
                  Merge When Build Succeeds
              %li
                = link_to "#", class: "accept_merge_request" do
                  = icon('warning fw')
                  Merge Immediately
        - else
26
          = f.button class: "btn btn-create btn-grouped js-merge-button accept_merge_request #{status_class}" do
27 28 29 30 31 32 33 34 35 36 37
            Accept Merge Request
      - if @merge_request.can_remove_source_branch?(current_user)
        .accept-control.checkbox
          = label_tag :should_remove_source_branch, class: "remove_source_checkbox" do
            = check_box_tag :should_remove_source_branch
            Remove source branch
      .accept-control.right
        = link_to "#", class: "modify-merge-commit-link js-toggle-button" do
          = icon('edit')
          Modify commit message
    .js-toggle-content.hide.prepend-top-default
38 39 40 41
      = render 'shared/commit_message_container', params: params,
          text: @merge_request.merge_commit_message,
          rows: 14, hint: true

42
    = hidden_field_tag :merge_when_build_succeeds, "", autocomplete: "off"
Zeger-Jan van de Weg committed
43

44
  :javascript
45 46
    $('.accept-mr-form').on('ajax:send', function() {
      $(".accept-mr-form :input").disable();
47
    });
Zeger-Jan van de Weg committed
48

49 50
    $('.accept_merge_request').on('click', function() {
      $('.js-merge-button').html("<i class='fa fa-spinner fa-spin'></i> Merge in progress");
Zeger-Jan van de Weg committed
51 52
    });

53
    $('.merge_when_build_succeeds').on('click', function() {
Zeger-Jan van de Weg committed
54
      $("#merge_when_build_succeeds").val("1");
55 56 57 58
    });

    $('.js-merge-dropdown a').on('click', function(e) {
      e.preventDefault();
Zeger-Jan van de Weg committed
59 60
      $(this).closest("form").submit();
    });