From 70b7627f48e504c13cf299f08082fbd5520900bf Mon Sep 17 00:00:00 2001 From: oppiliappan Date: Mon, 9 Mar 2026 21:12:35 +0000 Subject: [PATCH] appview: collapse diffs of generated files by default Signed-off-by: oppiliappan --- appview/pages/funcmap.go | 3 +++ appview/pages/templates/repo/fragments/diff.html | 15 +++++++++++++-- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/appview/pages/funcmap.go b/appview/pages/funcmap.go index 248eff47..2b1d214d 100644 --- a/appview/pages/funcmap.go +++ b/appview/pages/funcmap.go @@ -453,6 +453,9 @@ func (p *Pages) funcMap() template.FuncMap { } return result }, + "isGenerated": func(path string) bool { + return enry.IsGenerated(path, nil) + }, // constant values used to define a template "const": func() map[string]any { return map[string]any{ diff --git a/appview/pages/templates/repo/fragments/diff.html b/appview/pages/templates/repo/fragments/diff.html index 79f609d9..cf1a4c1e 100644 --- a/appview/pages/templates/repo/fragments/diff.html +++ b/appview/pages/templates/repo/fragments/diff.html @@ -138,8 +138,15 @@ {{ $idx := index . 0 }} {{ $file := index . 1 }} {{ $isSplit := index . 2 }} + {{ $isGenerated := false }} {{ with $file }} -
+ {{ $n := .Names }} + {{ if $n.New }} + {{ $isGenerated = isGenerated $n.New }} + {{ else if $n.Old }} + {{ $isGenerated = isGenerated $n.Old }} + {{ end }} +
@@ -148,7 +155,6 @@ {{ template "repo/fragments/diffStatPill" .Stats }}
- {{ $n := .Names }} {{ if and $n.New $n.Old (ne $n.New $n.Old)}} {{ $n.Old }} {{ i "arrow-right" "w-4 h-4" }} {{ $n.New }} {{ else if $n.New }} @@ -156,6 +162,11 @@ {{ else }} {{ $n.Old }} {{ end }} + {{ if $isGenerated }} + + {{ i "circle-question-mark" "size-4" }} + + {{ end }}
-- 2.51.2