summaryrefslogtreecommitdiff
path: root/app/views/projects/blame/show.html.haml
blob: f2c4fe017f26db40bff39a1af3fb3aa07cb3c2b4 (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
- page_title _("Blame"), @blob.path, @ref

#blob-content-holder.tree-holder{ data: { testid: 'blob-content-holder' } }
  = render "projects/blob/breadcrumb", blob: @blob, blame: true

  .file-holder.gl-overflow-hidden
    = render "projects/blob/header", blob: @blob, blame: true

    .file-blame-legend
      %span.left-label Newer
      %span.legend-box.legend-box-0
      %span.legend-box.legend-box-1
      %span.legend-box.legend-box-2
      %span.legend-box.legend-box-3
      %span.legend-box.legend-box-4
      %span.legend-box.legend-box-5
      %span.legend-box.legend-box-6
      %span.legend-box.legend-box-7
      %span.legend-box.legend-box-8
      %span.legend-box.legend-box-9
      %span.right-label Older

    .table-responsive.file-content.blame.code{ class: "#{user_color_scheme} gl-rounded-0!", data: { qa_selector: 'blame_file_content' } }
      %table
        - current_line = @blame.first_line
        - @blame.groups.each do |blame_group|
          - commit_data = @blame.commit_data(blame_group[:commit])
          - line_count = blame_group[:lines].count

          %tr{ style: intrinsic_row_css(line_count) }
            %td.blame-commit{ class: commit_data.age_map_class }
              .commit
                = commit_data.author_avatar

                .commit-row-title
                  %span.item-title.str-truncated-100
                    = commit_data.commit_link
                  %span
                    = commit_data.project_blame_link
                   

                .light
                  = commit_data.commit_author_link
                  = _('committed')
                  #{commit_data.time_ago_tooltip}

            %td.line-numbers
              - (current_line...(current_line + line_count)).each do |i|
                %a.diff-line-num.gl-justify-content-end{ href: "#L#{i}", id: "L#{i}", 'data-line-number' => i, class: "gl-display-flex!" }
                  .file-line-num
                    = i
                \

            %td.lines.gl-w-full
              %pre.code.highlight
                %code
                  - blame_group[:lines].each do |line|
                    #{line}

          - current_line += line_count

    - if @blame_pagination && @blame_pagination.total_pages > 1
      .gl-display-flex.gl-justify-content-center.gl-flex-direction-column.gl-align-items-center.gl-p-3.gl-bg-gray-50.gl-border-t-solid.gl-border-t-1.gl-border-gray-100
        = _('For faster browsing, not all history is shown.')
        = render Pajamas::ButtonComponent.new(href: namespace_project_blame_path(namespace_id: @project.namespace, project_id: @project, id: @id, no_pagination: true), size: :small, button_options: { class: 'gl-mt-3' }) do |c|
          = _('View entire blame')

  - if @blame_pagination
    = paginate(@blame_pagination, theme: "gitlab")