+
{{$class := ""}}
{{if .Commit.Signature}}
{{$class = (printf "%s%s" $class " isSigned")}}
diff --git a/templates/repo/diff/box.tmpl b/templates/repo/diff/box.tmpl
index 51769eb953..4624a53ba3 100644
--- a/templates/repo/diff/box.tmpl
+++ b/templates/repo/diff/box.tmpl
@@ -14,6 +14,11 @@
{{else}}
-
-
+
+ {{/* the icon meaning is reversed here, "octicon-sidebar-collapse" means show the file tree */}}
+ {{svg "octicon-sidebar-collapse" 16 "icon hide"}}
+ {{svg "octicon-sidebar-expand" 16 "icon"}}
+
{{svg "octicon-diff" 16 "mr-2"}}{{.locale.Tr "repo.diff.stats_desc" .Diff.NumFiles .Diff.TotalAddition .Diff.TotalDeletion | Str2html}}
@@ -31,145 +36,151 @@
{{end}}
- {{range $file := .Diff.Files}}
- {{/*notice: the index of Diff.Files should not be used for element ID, because the index will be restarted from 0 when doing load-more for PRs with a lot of files*/}}
- {{$blobBase := call $.GetBlobByPathForCommit $.BaseCommit $file.OldName}}
- {{$blobHead := call $.GetBlobByPathForCommit $.HeadCommit $file.Name}}
- {{$isImage := or (call $.IsBlobAnImage $blobBase) (call $.IsBlobAnImage $blobHead)}}
- {{$isCsv := (call $.IsCsvFile $file)}}
- {{$showFileViewToggle := or $isImage (and (not $file.IsIncomplete) $isCsv)}}
-
-
-
-
-
-
- {{if $file.ShouldBeHidden}}
- {{svg "octicon-chevron-right" 18}}
- {{else}}
- {{svg "octicon-chevron-down" 18}}
- {{end}}
-
-
- {{if $file.IsBin}}
-
- {{$.locale.Tr "repo.diff.bin"}}
-
- {{else}}
- {{template "repo/diff/stats" dict "file" . "root" $}}
- {{end}}
-
- {{if $file.IsRenamed}}{{$file.OldName}} → {{end}}{{$file.Name}}{{if .IsLFSFile}} ({{$.locale.Tr "repo.stored_lfs"}}){{end}}
- {{if $file.IsGenerated}}
- {{$.locale.Tr "repo.diff.generated"}}
- {{end}}
- {{if $file.IsVendored}}
- {{$.locale.Tr "repo.diff.vendored"}}
- {{end}}
-
-
- {{if $showFileViewToggle}}
- {{$.locale.Tr "repo.diff.protected"}}
- {{end}}
- {{if not (or $file.IsIncomplete $file.IsBin $file.IsSubmodule)}}
- {{$.locale.Tr "repo.unescape_control_characters"}}
-
- {{end}}
- {{if and (not $file.IsSubmodule) (not $.PageIsWiki)}}
- {{if $file.IsDeleted}}
- {{$.locale.Tr "repo.diff.view_file"}}
- {{else}}
- {{$.locale.Tr "repo.diff.view_file"}}
- {{end}}
- {{end}}
- {{if and $.IsSigned $.PageIsPullFiles (not $.IsArchived)}}
- {{if $file.HasChangedSinceLastReview}}
- {{$.locale.Tr "repo.pulls.has_changed_since_last_review"}}
- {{end}}
-
- {{end}}
-
-
- {{end}}
- {{if $file.IsProtected}}
-
-
- {{if $file.IsBin}}
-
- {{$.locale.Tr "repo.diff.bin"}}
-
- {{else}}
- {{template "repo/diff/stats" dict "file" . "root" $}}
- {{end}}
-
- {{if $file.IsRenamed}}{{$file.OldName}} → {{end}}{{$file.Name}}{{if .IsLFSFile}} ({{$.locale.Tr "repo.stored_lfs"}}){{end}}
- {{if $file.IsGenerated}}
- {{$.locale.Tr "repo.diff.generated"}}
- {{end}}
- {{if $file.IsVendored}}
- {{$.locale.Tr "repo.diff.vendored"}}
- {{end}}
-
-
{{if not $.Repository.IsArchived}}
diff --git a/templates/repo/diff/compare.tmpl b/templates/repo/diff/compare.tmpl
index 029e7717a4..e0e6837203 100644
--- a/templates/repo/diff/compare.tmpl
+++ b/templates/repo/diff/compare.tmpl
@@ -1,7 +1,7 @@
{{template "base/head" .}}
{{template "repo/header" .}}
-
+