summaryrefslogtreecommitdiff
path: root/app/views/projects/diffs/_stats.html.haml
blob: c9057f385da7fc56f1f838c2b8fcc1fe2b745b08 (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
- sum_added_lines = diff_files.sum(&:added_lines) # rubocop: disable CodeReuse/ActiveRecord
- sum_removed_lines = diff_files.sum(&:removed_lines) # rubocop: disable CodeReuse/ActiveRecord
.commit-stat-summary.dropdown
  Showing
  %button.diff-stats-summary-toggler.js-diff-stats-dropdown{ type: "button", data: { toggle: "dropdown", display: "static" } }<
    = pluralize(diff_files.size, "changed file")
    = icon("caret-down", class: "prepend-left-5")
  %span.diff-stats-additions-deletions-expanded#diff-stats
    with
    %strong.cgreen= pluralize(sum_added_lines, 'addition')
    and
    %strong.cred= pluralize(sum_removed_lines, 'deletion')
  .diff-stats-additions-deletions-collapsed.float-right.d-none.d-sm-none{ "aria-hidden": "true", "aria-describedby": "diff-stats" }
    %strong.cgreen<
      +#{sum_added_lines}
    %strong.cred<
      \-#{sum_removed_lines}
  .dropdown-menu.diff-file-changes
    = dropdown_filter("Search files")
    .dropdown-content
      %ul
        - diff_files.each do |diff_file|
          %li
            %a.diff-changed-file{ href: "##{hexdigest(diff_file.file_path)}", title: diff_file.new_path }
              = sprite_icon(diff_file_changed_icon(diff_file), size: 16, css_class: "#{diff_file_changed_icon_color(diff_file)} diff-file-changed-icon append-right-8")
              %span.diff-changed-file-content.append-right-8
                - if diff_file.blob&.name
                  %strong.diff-changed-file-name
                    = diff_file.blob.name
                - else
                  %strong.diff-changed-blank-file-name
                    = s_('Diffs|No file name available')
                %span.diff-changed-file-path.prepend-top-5= diff_file_path_text(diff_file)
              %span.diff-changed-stats
                %span.cgreen<
                  +#{diff_file.added_lines}
                %span.cred<
                  \-#{diff_file.removed_lines}
        %li.dropdown-menu-empty-item.hidden
          %a
            = _("No files found.")