all repos — elgit @ 74eea2ebbccc8458b5b62002d281b2b49f5c30c4

fork of legit: web frontend for git, written in go

switch to gomponents

Alan Pearce
commit

74eea2ebbccc8458b5b62002d281b2b49f5c30c4

parent

776a7b0dafa651c5ba71381608e9726d9756c3b1

1 file changed, 36 insertions(+), 0 deletions(-)

changed files
A templates/index.go
@@ -0,0 +1,36 @@
+package templates + +import ( + "time" + + g "go.alanpearce.eu/gomponents" + . "go.alanpearce.eu/gomponents/html" +) + +type RepoInfo struct { + DisplayName string + Name string + Desc string + Idle string + LastCommit time.Time +} + +func Index(data PageData, repos []RepoInfo) g.Node { + return Page(data, g.Group{ + Header( + H1(g.Text(data.Meta.Title)), + H2(g.Text(data.Meta.Description)), + ), + Main( + Div(Class("index"), + g.Map(repos, func(repo RepoInfo) g.Node { + return g.Group{ + Div(Class("index-name"), A(Href("/"+repo.Name), g.Text(repo.DisplayName))), + Div(Class("desc"), g.Text(repo.Desc)), + Div(g.Text(repo.Idle)), + } + }), + ), + ), + }) +}