.mr-state-widget
  - if @merge_request.source_project.ci_service && @commits.any?
    .mr-widget-heading
      = render "projects/merge_requests/show/mr_ci"
  .mr-widget-body
    - if @merge_request.open?
      - if @merge_request.source_branch_exists? && @merge_request.target_branch_exists?
        = render "projects/merge_requests/show/mr_accept"
      - else
        = render "projects/merge_requests/show/no_accept"

    - if @merge_request.closed?
      %h4
        Closed
        - if @merge_request.closed_event
          by #{link_to_member(@project, @merge_request.closed_event.author, avatar: false)}
          #{time_ago_with_tooltip(@merge_request.closed_event.created_at)}
      %p Changes were not merged into target branch

    - if @merge_request.merged?
      %h4
        Merged
        - if @merge_request.merge_event
          by #{link_to_member(@project, @merge_request.merge_event.author, avatar: false)}
          #{time_ago_with_tooltip(@merge_request.merge_event.created_at)}
      = render "projects/merge_requests/show/remove_source_branch"

    - if @merge_request.locked?
      %h4
        Merge in progress...
      %p
        Merging is in progress. While merging this request is locked and cannot be closed.

    - unless @commits.any?
      %h4 Nothing to merge
      %p
        Nothing to merge from
        %span.label-branch #{@merge_request.source_branch}
        to
        %span.label-branch #{@merge_request.target_branch}
        %br
        Try to use different branches or push new code.

  - if @closes_issues.present? && @merge_request.open?
    .mr-widget-footer
      %span
        %i.fa.fa-check
        Accepting this merge request will close #{@closes_issues.size == 1 ? 'issue' : 'issues'}
        = succeed '.' do
          != gfm(issues_sentence(@closes_issues))
