summaryrefslogtreecommitdiff
path: root/app/views/projects/merge_requests/show.html.haml
blob: 416cb932ec99778510c1d56d6dac526572d4d1e2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
- @gfm_form = true
- @content_class = "merge-request-container#{' limit-container-width' unless fluid_layout}"
- add_to_breadcrumbs _("Merge requests"), project_merge_requests_path(@project)
- breadcrumb_title @merge_request.to_reference
- page_title "#{@merge_request.title} (#{@merge_request.to_reference})", _("Merge requests")
- page_description @merge_request.description_html
- page_card_attributes @merge_request.card_attributes
- suggest_changes_help_path = help_page_path('user/discussions/index.md', anchor: 'suggest-changes')
- number_of_pipelines = @pipelines.size
- mr_action = j(params[:tab].presence || 'show')
- add_page_specific_style 'page_bundles/merge_requests'
- add_page_specific_style 'page_bundles/pipelines'
- add_page_specific_style 'page_bundles/reports'
- add_page_specific_style 'page_bundles/ci_status'

- add_page_startup_api_call @endpoint_metadata_url

.merge-request{ data: { mr_action: mr_action, url: merge_request_path(@merge_request, format: :json), project_path: project_path(@merge_request.project), lock_version: @merge_request.lock_version } }
  = render "projects/merge_requests/mr_title"

  .merge-request-details.issuable-details{ data: { id: @merge_request.project.id } }
    = render "projects/merge_requests/mr_box"
    .merge-request-tabs-holder{ class: ("js-tabs-affix" unless ENV['RAILS_ENV'] == 'test') }
      .merge-request-tabs-container
        %ul.merge-request-tabs.nav-tabs.nav.nav-links
          = render "projects/merge_requests/tabs/tab", class: "notes-tab", qa_selector: "notes_tab" do
            = tab_link_for @merge_request, :show, force_link: @commit.present? do
              = _("Overview")
              %span.badge.badge-pill.gl-badge.badge-muted.sm= @merge_request.related_notes.user.count
          - if @merge_request.source_project
            = render "projects/merge_requests/tabs/tab", name: "commits", class: "commits-tab", qa_selector: "commits_tab" do
              = tab_link_for @merge_request, :commits do
                = _("Commits")
                %span.badge.badge-pill.gl-badge.badge-muted.sm= @commits_count
          - if number_of_pipelines.nonzero?
            = render "projects/merge_requests/tabs/tab", name: "pipelines", class: "pipelines-tab" do
              = tab_link_for @merge_request, :pipelines do
                = _("Pipelines")
                %span.badge.badge-pill.gl-badge.badge-muted.sm.js-pipelines-mr-count= number_of_pipelines
          = render "projects/merge_requests/tabs/tab", name: "diffs", class: "diffs-tab", id: "diffs-tab", qa_selector: "diffs_tab" do
            = tab_link_for @merge_request, :diffs do
              = _("Changes")
              %span.badge.badge-pill.gl-badge.badge-muted.sm= @merge_request.diff_size
        .d-flex.flex-wrap.align-items-center.justify-content-lg-end
          #js-vue-discussion-counter

    .tab-content#diff-notes-app
      #js-diff-file-finder
        #js-code-navigation
      = render "projects/merge_requests/tabs/pane", id: "notes", class: "notes voting_notes" do
        .row
          %section.col-md-12
            %script.js-notes-data{ type: "application/json" }= initial_notes_data(true).to_json.html_safe
            .issuable-discussion.js-vue-notes-event
              - if @merge_request.description.present?
                .detail-page-description
                  = render "projects/merge_requests/description"
              = render "projects/merge_requests/widget"
              = render "projects/merge_requests/awards_block"
              - if mr_action === "show"
                - if Feature.enabled?(:paginated_notes, @project)
                  - add_page_startup_api_call notes_url
                - else
                  - add_page_startup_api_call discussions_path(@merge_request)
                - add_page_startup_api_call widget_project_json_merge_request_path(@project, @merge_request, async_mergeability_check: true, format: :json)
                - add_page_startup_api_call cached_widget_project_json_merge_request_path(@project, @merge_request, format: :json)
              #js-vue-mr-discussions{ data: { notes_data: notes_data(@merge_request, Feature.enabled?(:paginated_notes, @project)).to_json,
                endpoint_metadata: @endpoint_metadata_url,
                noteable_data: serialize_issuable(@merge_request, serializer: 'noteable'),
                noteable_type: 'MergeRequest',
                target_type: 'merge_request',
                help_page_path: suggest_changes_help_path,
                current_user_data: @current_user_data,
                is_locked: @merge_request.discussion_locked.to_s } }

      = render "projects/merge_requests/tabs/pane", name: "commits", id: "commits", class: "commits" do
        -# This tab is always loaded via AJAX
      = render "projects/merge_requests/tabs/pane", name: "pipelines", id: "pipelines", class: "pipelines" do
        - if number_of_pipelines.nonzero?
          = render 'projects/commit/pipelines_list', disable_initialization: true, endpoint: pipelines_project_merge_request_path(@project, @merge_request)
      - params = request.query_parameters
      - if Feature.enabled?(:default_merge_ref_for_diffs, @project, default_enabled: :yaml)
        - params = params.merge(diff_head: true)
      = render "projects/merge_requests/tabs/pane", name: "diffs", id: "js-diffs-app", class: "diffs", data: diffs_tab_pane_data(@project, @merge_request, params)

    .mr-loading-status
      .loading.hide
        .spinner.spinner-md

= render 'shared/issuable/sidebar', issuable_sidebar: @issuable_sidebar, assignees: @merge_request.assignees, reviewers: @merge_request.reviewers, source_branch: @merge_request.source_branch

- if @merge_request.can_be_reverted?(current_user)
  = render "projects/commit/change", type: 'revert', commit: @merge_request.merge_commit
- if @merge_request.can_be_cherry_picked?
  = render "projects/commit/change", type: 'cherry-pick', commit: @merge_request.merge_commit

#js-review-bar

= render 'shared/issuable/invite_members_trigger', project: @project