Collapse deleted file by default for a cleaner diff view.
+8
-2
Diff
round #1
+8
-2
appview/pages/templates/repo/fragments/diff.html
+8
-2
appview/pages/templates/repo/fragments/diff.html
···
142
142
{{ $file := index . 1 }}
143
143
{{ $isSplit := index . 2 }}
144
144
{{ $isGenerated := false }}
145
+
{{ $isDeleted := false }}
145
146
{{ with $file }}
146
147
{{ $n := .Names }}
148
+
{{ $isDeleted = and (eq $n.New "") (ne $n.Old "") }}
147
149
{{ if $n.New }}
148
150
{{ $isGenerated = isGenerated $n.New }}
149
151
{{ else if $n.Old }}
150
152
{{ $isGenerated = isGenerated $n.Old }}
151
153
{{ end }}
152
-
<details {{ if not $isGenerated }}open{{ end }} id="file-{{ .Id }}" class="group border border-gray-200 dark:border-gray-700 w-full mx-auto rounded bg-white dark:bg-gray-800 drop-shadow-sm" tabindex="{{ add $idx 1 }}">
154
+
<details {{ if and (not $isGenerated) (not $isDeleted) }}open{{ end }} id="file-{{ .Id }}" class="group border border-gray-200 dark:border-gray-700 w-full mx-auto rounded bg-white dark:bg-gray-800 drop-shadow-sm" tabindex="{{ add $idx 1 }}">
153
155
<summary class="list-none cursor-pointer sticky top-12 group-open:border-b border-gray-200 dark:border-gray-700">
154
156
<div id="diff-file-header" class="rounded cursor-pointer bg-white dark:bg-gray-800 flex justify-between">
155
157
<div id="left-side-items" class="p-2 flex gap-2 items-center overflow-x-auto">
···
165
167
{{ else }}
166
168
{{ $n.Old }}
167
169
{{ end }}
168
-
{{ if $isGenerated }}
170
+
{{ if $isDeleted }}
171
+
<span class="text-gray-400 dark:text-gray-500" title="Deleted files are collapsed by default">
172
+
{{ i "circle-question-mark" "size-4" }}
173
+
</span>
174
+
{{ else if $isGenerated }}
169
175
<span class="text-gray-400 dark:text-gray-500" title="Generated files are collapsed by default">
170
176
{{ i "circle-question-mark" "size-4" }}
171
177
</span>
History
2 rounds
3 comments
tachyonism.tngl.sh
submitted
#1
1 commit
expand
collapse
appview/pages: collapse deleted files by default
Signed-off-by: HigherOrderLogic <73709188+HigherOrderLogic@users.noreply.github.com>
expand 3 comments
Yes, GH does this. In fact the inspiration for this PR was because of GH. :P
lgtm thanks!
pull request successfully merged
tachyonism.tngl.sh
submitted
#0
1 commit
expand
collapse
appview/pages: collapse deleted files by default
I like this! is there precedent for this? do gh etc. do this?