From 9dc264a2eebbd30bbff483c26bf27f0406677f77 Mon Sep 17 00:00:00 2001 From: silverwind Date: Fri, 14 Oct 2022 11:43:25 +0200 Subject: [PATCH] Diff file tree tweaks (#21446) - Left-align the diff stat line again like previously. - Default the file tree to collapsed view, which means the tree will rendered initially collapsed and it may "pop in" via JS if enabled. I think this is more desirable than having the empty space for the tree "pop out" like it currently does. - Mute the icon, removing color unless hovered. - Increase icon size and vertically center it. Before: image After: image Co-authored-by: wxiaoguang --- templates/repo/diff/box.tmpl | 18 ++++++++++-------- web_src/less/_repository.less | 4 ++-- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/templates/repo/diff/box.tmpl b/templates/repo/diff/box.tmpl index 264a04f6df..15eff81099 100644 --- a/templates/repo/diff/box.tmpl +++ b/templates/repo/diff/box.tmpl @@ -14,13 +14,15 @@ {{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}} +
+ + {{/* the icon meaning is reversed here, "octicon-sidebar-collapse" means show the file tree */}} + {{svg "octicon-sidebar-collapse" 20 "icon hide"}} + {{svg "octicon-sidebar-expand" 20 "icon"}} + +
+ {{svg "octicon-diff" 16 "mr-2"}}{{.locale.Tr "repo.diff.stats_desc" .Diff.NumFiles .Diff.TotalAddition .Diff.TotalDeletion | Str2html}} +
{{if and .PageIsPullFiles $.SignedUserID (not .IsArchived)}} @@ -65,7 +67,7 @@
-
+
{{range $i, $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*/}} diff --git a/web_src/less/_repository.less b/web_src/less/_repository.less index c5d2a5f50a..5dee3fccdd 100644 --- a/web_src/less/_repository.less +++ b/web_src/less/_repository.less @@ -3099,11 +3099,11 @@ td.blob-excerpt { @media @mediaMdAndDown { #diff-file-tree { - display: none; + display: none !important; } .diff-toggle-file-tree-button { - display: none; + display: none !important; } }