diff --git a/options/locale/locale_en-US.ini b/options/locale/locale_en-US.ini index 58fd7d8f5..63a768dc7 100644 --- a/options/locale/locale_en-US.ini +++ b/options/locale/locale_en-US.ini @@ -1787,6 +1787,7 @@ diff.whitespace_ignore_all_whitespace = Ignore whitespace when comparing lines diff.whitespace_ignore_amount_changes = Ignore changes in amount of whitespace diff.whitespace_ignore_at_eol = Ignore changes in whitespace at EOL diff.stats_desc = %d changed files with %d additions and %d deletions +diff.stats_desc_file = %d changes: %d additions and %d deletions diff.bin = BIN diff.view_file = View File diff.file_before = Before diff --git a/templates/repo/diff/box.tmpl b/templates/repo/diff/box.tmpl index 275dc5150..40e9d277b 100644 --- a/templates/repo/diff/box.tmpl +++ b/templates/repo/diff/box.tmpl @@ -36,9 +36,9 @@
    {{range .Diff.Files}}
  1. -
    +
    {{if not .IsBin}} - {{template "repo/diff/stats" .}} + {{template "repo/diff/stats" dict "file" . "root" $}} {{else}} {{$.i18n.Tr "repo.diff.bin"}} {{end}} @@ -53,9 +53,9 @@ {{if $file.IsIncomplete}}

    -
    +
    {{if not $file.IsRenamed}} - {{template "repo/diff/stats" .}} + {{template "repo/diff/stats" dict "file" . "root" $}} {{end}}
    {{$file.Name}} @@ -87,11 +87,11 @@ {{svg "octicon-chevron-down" 18}} {{end}} -
    +
    {{if $file.IsBin}} {{$.i18n.Tr "repo.diff.bin"}} {{else if not $file.IsRenamed}} - {{template "repo/diff/stats" .}} + {{template "repo/diff/stats" dict "file" . "root" $}} {{end}}
    {{if $file.IsRenamed}}{{$file.OldName}} → {{end}}{{$file.Name}}{{if .IsLFSFile}} ({{$.i18n.Tr "repo.stored_lfs"}}){{end}} diff --git a/templates/repo/diff/stats.tmpl b/templates/repo/diff/stats.tmpl index 7e5d34c3d..97503f0ea 100644 --- a/templates/repo/diff/stats.tmpl +++ b/templates/repo/diff/stats.tmpl @@ -1,6 +1,4 @@ -+ {{.Addition}} - -
    -
    +{{Add .file.Addition .file.Deletion}} + +
    -- {{.Deletion}} diff --git a/web_src/less/_repository.less b/web_src/less/_repository.less index 1cedb07f1..8876dcdcb 100644 --- a/web_src/less/_repository.less +++ b/web_src/less/_repository.less @@ -1563,29 +1563,8 @@ display: flex; align-items: center; - .count { - margin-right: 12px; - font-size: 13px; - flex: 0 0 auto; - - .bar { - background-color: var(--color-red); - height: 12px; - width: 40px; - display: inline-block; - margin: 2px 4px 0; - vertical-align: text-top; - - .add { - background-color: var(--color-green); - height: 12px; - } - } - } - .file { flex: 1; - color: var(--color-text-light-2); word-break: break-all; } @@ -1768,17 +1747,6 @@ border-bottom: 1px dashed #dddddd; padding-left: 6px; } - - .diff-counter { - margin-right: 15px; - - .del { - color: var(--color-red); - } - .add { - color: var(--color-green); - } - } } .repo-search-result { @@ -3142,6 +3110,25 @@ td.blob-excerpt { border-radius: var(--border-radius) !important; } +.diff-counter { + font-weight: 600; + margin-right: 8px; +} + +.diff-stats-bar { + display: inline-block; + background-color: var(--color-red); + height: 12px; + width: 40px; + position: relative; + top: 2px; + + .diff-stats-add-bar { + background-color: var(--color-green); + height: 100%; + } +} + /* prevent page shaking on language bar click */ .repository-summary-language-stats { height: 48px;