_merged.html.haml 2.01 KB
Newer Older
1
.mr-state-widget
2
  = render 'projects/merge_requests/widget/heading'
3 4
  .mr-widget-body
    %h4
5
      Merged
6 7 8 9
      - if @merge_request.merge_event
        by #{link_to_member(@project, @merge_request.merge_event.author, avatar: true)}
        #{time_ago_with_tooltip(@merge_request.merge_event.created_at)}
    %div
10 11 12 13 14
      - if !@merge_request.source_branch_exists?
        = succeed '.' do
          The changes were merged into
          %span.label-branch= @merge_request.target_branch
        The source branch has been removed.
15

16
      - elsif can_remove_branch?(@merge_request.source_project, @merge_request.source_branch)
17
        .remove_source_branch_widget
18 19 20 21 22
          %p 
            = succeed '.' do
              The changes were merged into
              %span.label-branch= @merge_request.target_branch
            You can remove the source branch now.
23 24 25 26 27
          = link_to namespace_project_branch_path(@merge_request.source_project.namespace, @merge_request.source_project, @source_branch), remote: true, method: :delete, class: "btn btn-primary btn-sm remove_source_branch" do
            %i.fa.fa-times
            Remove Source Branch

        .remove_source_branch_widget.failed.hide
28 29
          %p 
            Failed to remove source branch '#{@merge_request.source_branch}'.
30 31

        .remove_source_branch_in_progress.hide
32 33 34
          %p
            = icon('spinner spin')
            Removing source branch '#{@merge_request.source_branch}'. Please wait. This page will be automatically reload.
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49

        :coffeescript
          $('.remove_source_branch').on 'click', ->
            $('.remove_source_branch_widget').hide()
            $('.remove_source_branch_in_progress').show()

          $(".remove_source_branch").on "ajax:success", (e, data, status, xhr) ->
            location.reload()

          $(".remove_source_branch").on "ajax:error", (e, data, status, xhr) ->
            $('.remove_source_branch_widget').hide()
            $('.remove_source_branch_in_progress').hide()
            $('.remove_source_branch_widget.failed').show()