diff options
author | JakobDev <jakobdev@gmx.de> | 2023-01-31 18:40:22 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-01-31 11:40:22 -0600 |
commit | be93e48ccb73acfaa372e56217105d3420e1a40e (patch) | |
tree | 16a1d4b18ebb0837c2ce93e073996145306fae35 /templates | |
parent | 85016af1fee8c11a3b2f2b84b20f74eaa5730ba8 (diff) | |
download | gitea-be93e48ccb73acfaa372e56217105d3420e1a40e.tar.gz gitea-be93e48ccb73acfaa372e56217105d3420e1a40e.zip |
Hide collapse icon in diff with no lines (#21094)
Sometimes (e.g. renaming a file) nothing of the content is changed. In
this case, it makes no sense to show the collapse icon in a diff.
Diffstat (limited to 'templates')
-rw-r--r-- | templates/repo/diff/box.tmpl | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/templates/repo/diff/box.tmpl b/templates/repo/diff/box.tmpl index 8482c31cdc..f74714499a 100644 --- a/templates/repo/diff/box.tmpl +++ b/templates/repo/diff/box.tmpl @@ -79,13 +79,15 @@ <div class="diff-file-box diff-box file-content {{TabSizeClass $.Editorconfig $file.Name}} mt-3" id="diff-{{$file.NameHash}}" data-old-filename="{{$file.OldName}}" data-new-filename="{{$file.Name}}" {{if $file.ShouldBeHidden}}data-folded="true"{{end}}> <h4 class="diff-file-header sticky-2nd-row ui top attached normal header df ac sb"> <div class="df ac"> - <a role="button" class="fold-file muted mr-2"> - {{if $file.ShouldBeHidden}} - {{svg "octicon-chevron-right" 18}} - {{else}} - {{svg "octicon-chevron-down" 18}} - {{end}} - </a> + {{if or (gt $file.Addition 0) (gt $file.Deletion 0) $file.IsBin}} + <a role="button" class="fold-file muted mr-2"> + {{if $file.ShouldBeHidden}} + {{svg "octicon-chevron-right" 18}} + {{else}} + {{svg "octicon-chevron-down" 18}} + {{end}} + </a> + {{end}} <div class="bold df ac"> {{if $file.IsBin}} <span class="ml-1 mr-3"> |