= form_for [:merge, @project.namespace.becomes(Namespace), @project, @merge_request], remote: true, method: :post, html: { class: 'accept-mr-form js-requires-input' } do |f|
  = hidden_field_tag :authenticity_token, form_authenticity_token
  .accept-merge-holder.clearfix.js-toggle-container
    .accept-action
      = f.button class: "btn btn-create accept_merge_request" do
        Accept Merge Request
    - if can_remove_branch?(@merge_request.source_project, @merge_request.source_branch) && !@merge_request.for_fork?
      .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-20
      = render 'shared/commit_message_container', params: params,
          text: @merge_request.merge_commit_message,
          rows: 14, hint: true

  :coffeescript
    $('.accept-mr-form').on 'ajax:before', ->
      btn = $('.accept_merge_request')
      btn.disable()
      btn.html("<i class='fa fa-spinner fa-spin'></i> Merge in progress")
