From 4ffe3ca24b9d691706d594405b35cc9f295b1861 Mon Sep 17 00:00:00 2001 From: Julie Qiu Date: Fri, 26 Feb 2021 16:58:48 -0500 Subject: [PATCH] content,internal/frontend: refactor directories section The following is refactored: * The UnitPage fields Subdirectories and NestedModules are removed, since they are not needed. UnitPage.Directories is used to determine if the directories section should be shown. * The directories section now displays the internal directory at the bottom of the page. For golang/go#44356 Change-Id: I3e6f7e3cacf27e129d6d7ea78d7a89e6e58e4be7 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/296953 Trust: Julie Qiu Reviewed-by: Jonathan Amsterdam --- .../html/helpers/_unit_directories.tmpl | 12 +-- .../static/html/helpers/_unit_outline.tmpl | 2 +- internal/frontend/directory.go | 85 ++++++++++--------- internal/frontend/directory_test.go | 85 +++++++++++-------- internal/frontend/main.go | 14 +-- 5 files changed, 104 insertions(+), 94 deletions(-) diff --git a/content/static/html/helpers/_unit_directories.tmpl b/content/static/html/helpers/_unit_directories.tmpl index e79180aef..3047e7b98 100644 --- a/content/static/html/helpers/_unit_directories.tmpl +++ b/content/static/html/helpers/_unit_directories.tmpl @@ -12,17 +12,19 @@
- {{if .Directories}} - +
- {{range .Directories}} - {{template "directory" .}} + {{range $dir := .Directories.External}} + {{template "directory" .}} + {{end}} + {{if .Directories.Internal}} + {{template "directory" .Directories.Internal}} {{end}}
Path Synopsis
- {{end}} {{end}} diff --git a/content/static/html/helpers/_unit_outline.tmpl b/content/static/html/helpers/_unit_outline.tmpl index 8a47cc7b4..46395adf1 100644 --- a/content/static/html/helpers/_unit_outline.tmpl +++ b/content/static/html/helpers/_unit_outline.tmpl @@ -47,7 +47,7 @@ {{end}} - {{if (or .Subdirectories .NestedModules)}} + {{if .Directories}}