- commit
- ae0a14c
- parent
- 0083d5e
- author
- Eric Bower
- date
- 2024-05-31 18:48:14 -0400 EDT
style: tweaks
2 files changed,
+16,
-8
+1,
-1
1@@ -13,7 +13,7 @@
2 <div class="group">
3 {{range .Repos}}
4 <div class="box">
5- <h3 class="text-lg"><a href="{{.Url}}">{{.Text}}</a></h3>
6+ <h3 class="text-lg m-0 p-0"><a href="{{.Url}}">{{.Text}}</a></h3>
7 <div class="text-sm">{{.Desc}}</div>
8 </div>
9 {{end}}
M
web.go
+15,
-7
1@@ -81,8 +81,13 @@ type LinkData struct {
2 Text string
3 }
4
5+type RepoData struct {
6+ LinkData
7+ Desc string
8+}
9+
10 type RepoListData struct {
11- Repos []LinkData
12+ Repos []RepoData
13 }
14
15 func repoListHandler(w http.ResponseWriter, r *http.Request) {
16@@ -99,19 +104,22 @@ func repoListHandler(w http.ResponseWriter, r *http.Request) {
17 return
18 }
19
20- repoUrls := []LinkData{}
21+ repoData := []RepoData{}
22 for _, repo := range repos {
23- url := LinkData{
24- Url: template.URL("/repos/" + repo.ID),
25- Text: repo.ID,
26+ d := RepoData{
27+ Desc: repo.Desc,
28+ LinkData: LinkData{
29+ Url: template.URL("/repos/" + repo.ID),
30+ Text: repo.ID,
31+ },
32 }
33- repoUrls = append(repoUrls, url)
34+ repoData = append(repoData, d)
35 }
36
37 w.Header().Set("content-type", "text/html")
38 tmpl := getTemplate("repo-list.html")
39 err = tmpl.Execute(w, RepoListData{
40- Repos: repoUrls,
41+ Repos: repoData,
42 })
43 if err != nil {
44 fmt.Println(err)