aboutsummaryrefslogtreecommitdiff
path: root/templates
diff options
context:
space:
mode:
authorGravatar Abhinav Gupta <mail@abhinavg.net> 2023-04-29 11:48:34 -0700
committerGravatar GitHub <noreply@github.com> 2023-04-29 11:48:34 -0700
commit29d8e3f3835cc7543c390a8a8f5bdfd67bcd3c2d (patch)
tree5a151adbee7a1d94d3b1b91542f0bafbf83024cf /templates
parent8d9e76b1f11fd164ef83614bdc485ffd71088d9c (diff)
downloadsally-29d8e3f3835cc7543c390a8a8f5bdfd67bcd3c2d.tar.gz
sally-29d8e3f3835cc7543c390a8a8f5bdfd67bcd3c2d.tar.zst
sally-29d8e3f3835cc7543c390a8a8f5bdfd67bcd3c2d.zip
refactor(indexHandler): Don't retain configuration (#86)
Similar to the previous patch, this patch removes knowledge of the configuration from the index handler. Instead, the index handler is now passed a list of packageInfo structs each containing just the information needed to render the index page. This also obviates the need to duplicate the logic to compute the package import path in the index.html template.
Diffstat (limited to 'templates')
-rw-r--r--templates/index.html14
1 files changed, 5 insertions, 9 deletions
diff --git a/templates/index.html b/templates/index.html
index d193263..fa061f1 100644
--- a/templates/index.html
+++ b/templates/index.html
@@ -24,24 +24,20 @@
<div class="five columns"><strong>Source</strong></div>
<div class="two columns"><strong>Documentation</strong></div>
</div>
- {{ range $key, $value := .Packages }}
- {{ $importPath := printf "%v/%v" $.URL $key }}
- {{ if ne $value.URL "" }}
- {{ $importPath = printf "%v/%v" $value.URL $key }}
- {{ end }}
+ {{ range .Packages }}
<hr class="separator">
<div class="row">
<div class="five columns">
<span class="inline-header">Package:</span>
- {{ $importPath }}
+ {{ .ImportPath }}
</div>
<div class="five columns">
<span class="inline-header">Source:</span>
- <a href="//{{ $value.Repo }}">{{ $value.Repo }}</a>
+ <a href="//{{ .GitURL }}">{{ .GitURL }}</a>
</div>
<div class="two columns">
- <a href="//{{ $.Godoc.Host }}/{{ $importPath }}">
- <img src="//pkg.go.dev/badge/{{ $importPath }}.svg" alt="Go Reference" />
+ <a href="//{{ .GodocHome }}">
+ <img src="//pkg.go.dev/badge/{{ .ImportPath }}.svg" alt="Go Reference" />
</a>
</div>
</div>