summaryrefslogtreecommitdiffstats
path: root/templates
diff options
context:
space:
mode:
authorwxiaoguang <wxiaoguang@gmail.com>2023-02-02 13:39:55 +0800
committerGitHub <noreply@github.com>2023-02-02 13:39:55 +0800
commitc46f53a627393766b6a7a4efc10218cbb792e7e3 (patch)
tree57dbc911d67074b2eb3f443af9de30868beab5dc /templates
parent5d9c64b3feeab32678a983d4256272c010a0e057 (diff)
downloadgitea-c46f53a627393766b6a7a4efc10218cbb792e7e3.tar.gz
gitea-c46f53a627393766b6a7a4efc10218cbb792e7e3.zip
Fix diff UI for unexpandable items (#22700)
Follows #21094 Before: There are 2 problems: 1. Sometimes, the header starts with a number, sometimes, it starts with an icon button. It makes the UI look like misaligned. 2. The second item's bottom border is too thick (actually, that's an empty element with border, which should be hidden as well) 3. (An old problem) the number is not mono-font ![image](https://user-images.githubusercontent.com/2114189/215935944-003fe2d3-69bf-413c-bbae-0a4668a508c3.png) After: Fix above problems. ![image](https://user-images.githubusercontent.com/2114189/215944811-b867a20c-110c-47a2-aa52-572a8162a44d.png) --------- Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com> Co-authored-by: John Olheiser <john.olheiser@gmail.com>
Diffstat (limited to 'templates')
-rw-r--r--templates/repo/diff/box.tmpl21
1 files changed, 10 insertions, 11 deletions
diff --git a/templates/repo/diff/box.tmpl b/templates/repo/diff/box.tmpl
index f74714499a..798a7eae14 100644
--- a/templates/repo/diff/box.tmpl
+++ b/templates/repo/diff/box.tmpl
@@ -76,19 +76,18 @@
{{$isImage := or (call $.IsBlobAnImage $blobBase) (call $.IsBlobAnImage $blobHead)}}
{{$isCsv := (call $.IsCsvFile $file)}}
{{$showFileViewToggle := or $isImage (and (not $file.IsIncomplete) $isCsv)}}
- <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}}>
+ {{$isExpandable := or (gt $file.Addition 0) (gt $file.Deletion 0) $file.IsBin}}
+ <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 or ($file.ShouldBeHidden) (not $isExpandable)}}data-folded="true"{{end}}>
<h4 class="diff-file-header sticky-2nd-row ui top attached normal header df ac sb">
<div class="df ac">
- {{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">
+ <a role="button" class="fold-file muted mr-2" {{if not $isExpandable}}style="visibility: hidden"{{end}}>
+ {{if $file.ShouldBeHidden}}
+ {{svg "octicon-chevron-right" 18}}
+ {{else}}
+ {{svg "octicon-chevron-down" 18}}
+ {{end}}
+ </a>
+ <div class="bold df ac mono">
{{if $file.IsBin}}
<span class="ml-1 mr-3">
{{$.locale.Tr "repo.diff.bin"}}