diff options
-rw-r--r-- | pkg/handler/git/handler.go | 45 | ||||
-rw-r--r-- | templates/gititem.qtpl | 44 | ||||
-rw-r--r-- | templates/gititem.qtpl.go | 171 | ||||
-rw-r--r-- | templates/gititemabout.qtpl | 10 | ||||
-rw-r--r-- | templates/gititemabout.qtpl.go | 90 | ||||
-rw-r--r-- | templates/gititemlog.qtpl | 10 | ||||
-rw-r--r-- | templates/gititemlog.qtpl.go | 90 | ||||
-rw-r--r-- | templates/gititemrefs.qtpl | 10 | ||||
-rw-r--r-- | templates/gititemrefs.qtpl.go | 90 | ||||
-rw-r--r-- | templates/gititemsummary.qtpl | 10 | ||||
-rw-r--r-- | templates/gititemsummary.qtpl.go | 90 | ||||
-rw-r--r-- | templates/gititemtree.qtpl | 10 | ||||
-rw-r--r-- | templates/gititemtree.qtpl.go | 90 | ||||
-rw-r--r-- | templates/gitlist.qtpl | 8 | ||||
-rw-r--r-- | templates/gitlist.qtpl.go | 80 | ||||
-rw-r--r-- | templates/navbar.qtpl | 32 | ||||
-rw-r--r-- | templates/navbar.qtpl.go | 188 |
17 files changed, 883 insertions, 185 deletions
diff --git a/pkg/handler/git/handler.go b/pkg/handler/git/handler.go index e088749..45cd865 100644 --- a/pkg/handler/git/handler.go +++ b/pkg/handler/git/handler.go @@ -6,6 +6,7 @@ import ( "git.gabrielgio.me/cerrado/pkg/service" "git.gabrielgio.me/cerrado/templates" + "github.com/gorilla/mux" ) type ( @@ -35,7 +36,47 @@ func (g *GitHandler) List(w http.ResponseWriter, _ *http.Request) { templates.WritePageTemplate(w, gitList) } -func (g *GitHandler) Item(w http.ResponseWriter, _ *http.Request) { - gitList := &templates.GitItemPage{} +func (g *GitHandler) Summary(w http.ResponseWriter, r *http.Request) { + name := mux.Vars(r)["name"] + gitList := &templates.GitItemPage{ + Name: name, + GitItemBase: &templates.GitItemSummaryPage{}, + } + templates.WritePageTemplate(w, gitList) +} + +func (g *GitHandler) About(w http.ResponseWriter, r *http.Request) { + name := mux.Vars(r)["name"] + gitList := &templates.GitItemPage{ + Name: name, + GitItemBase: &templates.GitItemAboutPage{}, + } + templates.WritePageTemplate(w, gitList) +} + +func (g *GitHandler) Refs(w http.ResponseWriter, r *http.Request) { + name := mux.Vars(r)["name"] + gitList := &templates.GitItemPage{ + Name: name, + GitItemBase: &templates.GitItemRefsPage{}, + } + templates.WritePageTemplate(w, gitList) +} + +func (g *GitHandler) Tree(w http.ResponseWriter, r *http.Request) { + name := mux.Vars(r)["name"] + gitList := &templates.GitItemPage{ + Name: name, + GitItemBase: &templates.GitItemTreePage{}, + } + templates.WritePageTemplate(w, gitList) +} + +func (g *GitHandler) Log(w http.ResponseWriter, r *http.Request) { + name := mux.Vars(r)["name"] + gitList := &templates.GitItemPage{ + Name: name, + GitItemBase: &templates.GitItemLogPage{}, + } templates.WritePageTemplate(w, gitList) } diff --git a/templates/gititem.qtpl b/templates/gititem.qtpl index 156325f..4a6c49a 100644 --- a/templates/gititem.qtpl +++ b/templates/gititem.qtpl @@ -1,46 +1,30 @@ +{% interface +GitItemBase { + Nav(name string) + GitContent() +} +%} + {% code type GitItemPage struct { + Name string + GitItemBase } %} - -{% func insertIfEqual(s, d Selection) %}{% if s == d %} selected{% endif %}{% endfunc %} - - -{% func Navbar (s Selection) %} - <nav class="container navbar navbar-expand"> - <div class="navbar-nav"> - <a class="nav-link{%= insertIfEqual(s, Git) %}" href="/">git</a> - <a class="nav-link{%= insertIfEqual(s, List) %}" href="/list">list</a> - <a class="nav-link{%= insertIfEqual(s, About) %}" href="/about">about</a> - <a class="nav-link{%= insertIfEqual(s, Config) %}" href="/config">config</a> - </div> - </nav> -{% endfunc %} - {% func (p *GitItemPage) Title() %}Git | List{% endfunc %} {% func (p *GitItemPage) Navbar() %}{%= Navbar(Git) %}{% endfunc %} {% func (p *GitItemPage) Content() %} <div class="row"> - <h3>AoC2022.git</h3> + <h3>{%s p.Name %}</h3> +</div> +<div class="row"> +{%= p.Nav(p.Name) %} </div> <div class="row"> - <ul class="nav"> - <li class="nav-item"> - <a class="nav-link" aria-current="page" href="#">about</a> - </li> - <li class="nav-item"> - <a class="nav-link" aria-current="page" href="#">summary</a> - </li> - <li class="nav-item"> - <a class="nav-link" aria-current="page" href="#">refs</a> - </li> - <li class="nav-item"> - <a class="nav-link" aria-current="page" href="#">tree</a> - </li> - </ul> +{%= p.GitContent() %} </div> {% endfunc %} diff --git a/templates/gititem.qtpl.go b/templates/gititem.qtpl.go index 8c14856..f978c4d 100644 --- a/templates/gititem.qtpl.go +++ b/templates/gititem.qtpl.go @@ -18,158 +18,179 @@ var ( ) //line gititem.qtpl:2 +type GitItemBase interface { +//line gititem.qtpl:2 + Nav(name string) string +//line gititem.qtpl:2 + StreamNav(qw422016 *qt422016.Writer, name string) +//line gititem.qtpl:2 + WriteNav(qq422016 qtio422016.Writer, name string) +//line gititem.qtpl:2 + GitContent() string +//line gititem.qtpl:2 + StreamGitContent(qw422016 *qt422016.Writer) +//line gititem.qtpl:2 + WriteGitContent(qq422016 qtio422016.Writer) +//line gititem.qtpl:2 +} + +//line gititem.qtpl:9 type GitItemPage struct { + Name string + GitItemBase } -//line gititem.qtpl:6 +//line gititem.qtpl:15 func (p *GitItemPage) StreamTitle(qw422016 *qt422016.Writer) { -//line gititem.qtpl:6 +//line gititem.qtpl:15 qw422016.N().S(`Git | List`) -//line gititem.qtpl:6 +//line gititem.qtpl:15 } -//line gititem.qtpl:6 +//line gititem.qtpl:15 func (p *GitItemPage) WriteTitle(qq422016 qtio422016.Writer) { -//line gititem.qtpl:6 +//line gititem.qtpl:15 qw422016 := qt422016.AcquireWriter(qq422016) -//line gititem.qtpl:6 +//line gititem.qtpl:15 p.StreamTitle(qw422016) -//line gititem.qtpl:6 +//line gititem.qtpl:15 qt422016.ReleaseWriter(qw422016) -//line gititem.qtpl:6 +//line gititem.qtpl:15 } -//line gititem.qtpl:6 +//line gititem.qtpl:15 func (p *GitItemPage) Title() string { -//line gititem.qtpl:6 +//line gititem.qtpl:15 qb422016 := qt422016.AcquireByteBuffer() -//line gititem.qtpl:6 +//line gititem.qtpl:15 p.WriteTitle(qb422016) -//line gititem.qtpl:6 +//line gititem.qtpl:15 qs422016 := string(qb422016.B) -//line gititem.qtpl:6 +//line gititem.qtpl:15 qt422016.ReleaseByteBuffer(qb422016) -//line gititem.qtpl:6 +//line gititem.qtpl:15 return qs422016 -//line gititem.qtpl:6 +//line gititem.qtpl:15 } -//line gititem.qtpl:8 +//line gititem.qtpl:17 func (p *GitItemPage) StreamNavbar(qw422016 *qt422016.Writer) { -//line gititem.qtpl:8 +//line gititem.qtpl:17 StreamNavbar(qw422016, Git) -//line gititem.qtpl:8 +//line gititem.qtpl:17 } -//line gititem.qtpl:8 +//line gititem.qtpl:17 func (p *GitItemPage) WriteNavbar(qq422016 qtio422016.Writer) { -//line gititem.qtpl:8 +//line gititem.qtpl:17 qw422016 := qt422016.AcquireWriter(qq422016) -//line gititem.qtpl:8 +//line gititem.qtpl:17 p.StreamNavbar(qw422016) -//line gititem.qtpl:8 +//line gititem.qtpl:17 qt422016.ReleaseWriter(qw422016) -//line gititem.qtpl:8 +//line gititem.qtpl:17 } -//line gititem.qtpl:8 +//line gititem.qtpl:17 func (p *GitItemPage) Navbar() string { -//line gititem.qtpl:8 +//line gititem.qtpl:17 qb422016 := qt422016.AcquireByteBuffer() -//line gititem.qtpl:8 +//line gititem.qtpl:17 p.WriteNavbar(qb422016) -//line gititem.qtpl:8 +//line gititem.qtpl:17 qs422016 := string(qb422016.B) -//line gititem.qtpl:8 +//line gititem.qtpl:17 qt422016.ReleaseByteBuffer(qb422016) -//line gititem.qtpl:8 +//line gititem.qtpl:17 return qs422016 -//line gititem.qtpl:8 +//line gititem.qtpl:17 } -//line gititem.qtpl:10 +//line gititem.qtpl:19 func (p *GitItemPage) StreamContent(qw422016 *qt422016.Writer) { -//line gititem.qtpl:10 +//line gititem.qtpl:19 qw422016.N().S(` <div class="row"> - <h3>AoC2022.git</h3> + <h3>`) +//line gititem.qtpl:21 + qw422016.E().S(p.Name) +//line gititem.qtpl:21 + qw422016.N().S(`</h3> </div> <div class="row"> - <ul class="nav"> - <li class="nav-item"> - <a class="nav-link" aria-current="page" href="#">about</a> - </li> - <li class="nav-item"> - <a class="nav-link" aria-current="page" href="#">summary</a> - </li> - <li class="nav-item"> - <a class="nav-link" aria-current="page" href="#">refs</a> - </li> - <li class="nav-item"> - <a class="nav-link" aria-current="page" href="#">tree</a> - </li> - </ul> +`) +//line gititem.qtpl:24 + p.StreamNav(qw422016, p.Name) +//line gititem.qtpl:24 + qw422016.N().S(` +</div> +<div class="row"> +`) +//line gititem.qtpl:27 + p.StreamGitContent(qw422016) +//line gititem.qtpl:27 + qw422016.N().S(` </div> `) -//line gititem.qtpl:30 +//line gititem.qtpl:29 } -//line gititem.qtpl:30 +//line gititem.qtpl:29 func (p *GitItemPage) WriteContent(qq422016 qtio422016.Writer) { -//line gititem.qtpl:30 +//line gititem.qtpl:29 qw422016 := qt422016.AcquireWriter(qq422016) -//line gititem.qtpl:30 +//line gititem.qtpl:29 p.StreamContent(qw422016) -//line gititem.qtpl:30 +//line gititem.qtpl:29 qt422016.ReleaseWriter(qw422016) -//line gititem.qtpl:30 +//line gititem.qtpl:29 } -//line gititem.qtpl:30 +//line gititem.qtpl:29 func (p *GitItemPage) Content() string { -//line gititem.qtpl:30 +//line gititem.qtpl:29 qb422016 := qt422016.AcquireByteBuffer() -//line gititem.qtpl:30 +//line gititem.qtpl:29 p.WriteContent(qb422016) -//line gititem.qtpl:30 +//line gititem.qtpl:29 qs422016 := string(qb422016.B) -//line gititem.qtpl:30 +//line gititem.qtpl:29 qt422016.ReleaseByteBuffer(qb422016) -//line gititem.qtpl:30 +//line gititem.qtpl:29 return qs422016 -//line gititem.qtpl:30 +//line gititem.qtpl:29 } -//line gititem.qtpl:32 +//line gititem.qtpl:31 func (p *GitItemPage) StreamScript(qw422016 *qt422016.Writer) { -//line gititem.qtpl:32 +//line gititem.qtpl:31 qw422016.N().S(` `) -//line gititem.qtpl:33 +//line gititem.qtpl:32 } -//line gititem.qtpl:33 +//line gititem.qtpl:32 func (p *GitItemPage) WriteScript(qq422016 qtio422016.Writer) { -//line gititem.qtpl:33 +//line gititem.qtpl:32 qw422016 := qt422016.AcquireWriter(qq422016) -//line gititem.qtpl:33 +//line gititem.qtpl:32 p.StreamScript(qw422016) -//line gititem.qtpl:33 +//line gititem.qtpl:32 qt422016.ReleaseWriter(qw422016) -//line gititem.qtpl:33 +//line gititem.qtpl:32 } -//line gititem.qtpl:33 +//line gititem.qtpl:32 func (p *GitItemPage) Script() string { -//line gititem.qtpl:33 +//line gititem.qtpl:32 qb422016 := qt422016.AcquireByteBuffer() -//line gititem.qtpl:33 +//line gititem.qtpl:32 p.WriteScript(qb422016) -//line gititem.qtpl:33 +//line gititem.qtpl:32 qs422016 := string(qb422016.B) -//line gititem.qtpl:33 +//line gititem.qtpl:32 qt422016.ReleaseByteBuffer(qb422016) -//line gititem.qtpl:33 +//line gititem.qtpl:32 return qs422016 -//line gititem.qtpl:33 +//line gititem.qtpl:32 } diff --git a/templates/gititemabout.qtpl b/templates/gititemabout.qtpl new file mode 100644 index 0000000..67d43f1 --- /dev/null +++ b/templates/gititemabout.qtpl @@ -0,0 +1,10 @@ +{% code +type GitItemAboutPage struct { +} +%} + +{% func (g *GitItemAboutPage) Nav(name string) %}{%= GitItemNav(name, Readme) %}{% endfunc %} + +{% func (g *GitItemAboutPage) GitContent() %} +<h4>About</h4> +{% endfunc %} diff --git a/templates/gititemabout.qtpl.go b/templates/gititemabout.qtpl.go new file mode 100644 index 0000000..7b772e5 --- /dev/null +++ b/templates/gititemabout.qtpl.go @@ -0,0 +1,90 @@ +// Code generated by qtc from "gititemabout.qtpl". DO NOT EDIT. +// See https://github.com/valyala/quicktemplate for details. + +//line gititemabout.qtpl:1 +package templates + +//line gititemabout.qtpl:1 +import ( + qtio422016 "io" + + qt422016 "github.com/valyala/quicktemplate" +) + +//line gititemabout.qtpl:1 +var ( + _ = qtio422016.Copy + _ = qt422016.AcquireByteBuffer +) + +//line gititemabout.qtpl:2 +type GitItemAboutPage struct { +} + +//line gititemabout.qtpl:6 +func (g *GitItemAboutPage) StreamNav(qw422016 *qt422016.Writer, name string) { +//line gititemabout.qtpl:6 + StreamGitItemNav(qw422016, name, Readme) +//line gititemabout.qtpl:6 +} + +//line gititemabout.qtpl:6 +func (g *GitItemAboutPage) WriteNav(qq422016 qtio422016.Writer, name string) { +//line gititemabout.qtpl:6 + qw422016 := qt422016.AcquireWriter(qq422016) +//line gititemabout.qtpl:6 + g.StreamNav(qw422016, name) +//line gititemabout.qtpl:6 + qt422016.ReleaseWriter(qw422016) +//line gititemabout.qtpl:6 +} + +//line gititemabout.qtpl:6 +func (g *GitItemAboutPage) Nav(name string) string { +//line gititemabout.qtpl:6 + qb422016 := qt422016.AcquireByteBuffer() +//line gititemabout.qtpl:6 + g.WriteNav(qb422016, name) +//line gititemabout.qtpl:6 + qs422016 := string(qb422016.B) +//line gititemabout.qtpl:6 + qt422016.ReleaseByteBuffer(qb422016) +//line gititemabout.qtpl:6 + return qs422016 +//line gititemabout.qtpl:6 +} + +//line gititemabout.qtpl:8 +func (g *GitItemAboutPage) StreamGitContent(qw422016 *qt422016.Writer) { +//line gititemabout.qtpl:8 + qw422016.N().S(` +<h4>About</h4> +`) +//line gititemabout.qtpl:10 +} + +//line gititemabout.qtpl:10 +func (g *GitItemAboutPage) WriteGitContent(qq422016 qtio422016.Writer) { +//line gititemabout.qtpl:10 + qw422016 := qt422016.AcquireWriter(qq422016) +//line gititemabout.qtpl:10 + g.StreamGitContent(qw422016) +//line gititemabout.qtpl:10 + qt422016.ReleaseWriter(qw422016) +//line gititemabout.qtpl:10 +} + +//line gititemabout.qtpl:10 +func (g *GitItemAboutPage) GitContent() string { +//line gititemabout.qtpl:10 + qb422016 := qt422016.AcquireByteBuffer() +//line gititemabout.qtpl:10 + g.WriteGitContent(qb422016) +//line gititemabout.qtpl:10 + qs422016 := string(qb422016.B) +//line gititemabout.qtpl:10 + qt422016.ReleaseByteBuffer(qb422016) +//line gititemabout.qtpl:10 + return qs422016 +//line gititemabout.qtpl:10 +} diff --git a/templates/gititemlog.qtpl b/templates/gititemlog.qtpl new file mode 100644 index 0000000..ae88a52 --- /dev/null +++ b/templates/gititemlog.qtpl @@ -0,0 +1,10 @@ +{% code +type GitItemLogPage struct { +} +%} + +{% func (g *GitItemLogPage) Nav(name string) %}{%= GitItemNav(name, Log) %}{% endfunc %} + +{% func (g *GitItemLogPage) GitContent() %} +<h4>Log</h4> +{% endfunc %} diff --git a/templates/gititemlog.qtpl.go b/templates/gititemlog.qtpl.go new file mode 100644 index 0000000..2d559d7 --- /dev/null +++ b/templates/gititemlog.qtpl.go @@ -0,0 +1,90 @@ +// Code generated by qtc from "gititemlog.qtpl". DO NOT EDIT. +// See https://github.com/valyala/quicktemplate for details. + +//line gititemlog.qtpl:1 +package templates + +//line gititemlog.qtpl:1 +import ( + qtio422016 "io" + + qt422016 "github.com/valyala/quicktemplate" +) + +//line gititemlog.qtpl:1 +var ( + _ = qtio422016.Copy + _ = qt422016.AcquireByteBuffer +) + +//line gititemlog.qtpl:2 +type GitItemLogPage struct { +} + +//line gititemlog.qtpl:6 +func (g *GitItemLogPage) StreamNav(qw422016 *qt422016.Writer, name string) { +//line gititemlog.qtpl:6 + StreamGitItemNav(qw422016, name, Log) +//line gititemlog.qtpl:6 +} + +//line gititemlog.qtpl:6 +func (g *GitItemLogPage) WriteNav(qq422016 qtio422016.Writer, name string) { +//line gititemlog.qtpl:6 + qw422016 := qt422016.AcquireWriter(qq422016) +//line gititemlog.qtpl:6 + g.StreamNav(qw422016, name) +//line gititemlog.qtpl:6 + qt422016.ReleaseWriter(qw422016) +//line gititemlog.qtpl:6 +} + +//line gititemlog.qtpl:6 +func (g *GitItemLogPage) Nav(name string) string { +//line gititemlog.qtpl:6 + qb422016 := qt422016.AcquireByteBuffer() +//line gititemlog.qtpl:6 + g.WriteNav(qb422016, name) +//line gititemlog.qtpl:6 + qs422016 := string(qb422016.B) +//line gititemlog.qtpl:6 + qt422016.ReleaseByteBuffer(qb422016) +//line gititemlog.qtpl:6 + return qs422016 +//line gititemlog.qtpl:6 +} + +//line gititemlog.qtpl:8 +func (g *GitItemLogPage) StreamGitContent(qw422016 *qt422016.Writer) { +//line gititemlog.qtpl:8 + qw422016.N().S(` +<h4>Log</h4> +`) +//line gititemlog.qtpl:10 +} + +//line gititemlog.qtpl:10 +func (g *GitItemLogPage) WriteGitContent(qq422016 qtio422016.Writer) { +//line gititemlog.qtpl:10 + qw422016 := qt422016.AcquireWriter(qq422016) +//line gititemlog.qtpl:10 + g.StreamGitContent(qw422016) +//line gititemlog.qtpl:10 + qt422016.ReleaseWriter(qw422016) +//line gititemlog.qtpl:10 +} + +//line gititemlog.qtpl:10 +func (g *GitItemLogPage) GitContent() string { +//line gititemlog.qtpl:10 + qb422016 := qt422016.AcquireByteBuffer() +//line gititemlog.qtpl:10 + g.WriteGitContent(qb422016) +//line gititemlog.qtpl:10 + qs422016 := string(qb422016.B) +//line gititemlog.qtpl:10 + qt422016.ReleaseByteBuffer(qb422016) +//line gititemlog.qtpl:10 + return qs422016 +//line gititemlog.qtpl:10 +} diff --git a/templates/gititemrefs.qtpl b/templates/gititemrefs.qtpl new file mode 100644 index 0000000..5fed393 --- /dev/null +++ b/templates/gititemrefs.qtpl @@ -0,0 +1,10 @@ +{% code +type GitItemRefsPage struct { +} +%} + +{% func (g *GitItemRefsPage) Nav(name string) %}{%= GitItemNav(name ,Refs) %}{% endfunc %} + +{% func (g *GitItemRefsPage) GitContent() %} +<h4>Refs</h4> +{% endfunc %} diff --git a/templates/gititemrefs.qtpl.go b/templates/gititemrefs.qtpl.go new file mode 100644 index 0000000..5294bf9 --- /dev/null +++ b/templates/gititemrefs.qtpl.go @@ -0,0 +1,90 @@ +// Code generated by qtc from "gititemrefs.qtpl". DO NOT EDIT. +// See https://github.com/valyala/quicktemplate for details. + +//line gititemrefs.qtpl:1 +package templates + +//line gititemrefs.qtpl:1 +import ( + qtio422016 "io" + + qt422016 "github.com/valyala/quicktemplate" +) + +//line gititemrefs.qtpl:1 +var ( + _ = qtio422016.Copy + _ = qt422016.AcquireByteBuffer +) + +//line gititemrefs.qtpl:2 +type GitItemRefsPage struct { +} + +//line gititemrefs.qtpl:6 +func (g *GitItemRefsPage) StreamNav(qw422016 *qt422016.Writer, name string) { +//line gititemrefs.qtpl:6 + StreamGitItemNav(qw422016, name, Refs) +//line gititemrefs.qtpl:6 +} + +//line gititemrefs.qtpl:6 +func (g *GitItemRefsPage) WriteNav(qq422016 qtio422016.Writer, name string) { +//line gititemrefs.qtpl:6 + qw422016 := qt422016.AcquireWriter(qq422016) +//line gititemrefs.qtpl:6 + g.StreamNav(qw422016, name) +//line gititemrefs.qtpl:6 + qt422016.ReleaseWriter(qw422016) +//line gititemrefs.qtpl:6 +} + +//line gititemrefs.qtpl:6 +func (g *GitItemRefsPage) Nav(name string) string { +//line gititemrefs.qtpl:6 + qb422016 := qt422016.AcquireByteBuffer() +//line gititemrefs.qtpl:6 + g.WriteNav(qb422016, name) +//line gititemrefs.qtpl:6 + qs422016 := string(qb422016.B) +//line gititemrefs.qtpl:6 + qt422016.ReleaseByteBuffer(qb422016) +//line gititemrefs.qtpl:6 + return qs422016 +//line gititemrefs.qtpl:6 +} + +//line gititemrefs.qtpl:8 +func (g *GitItemRefsPage) StreamGitContent(qw422016 *qt422016.Writer) { +//line gititemrefs.qtpl:8 + qw422016.N().S(` +<h4>Refs</h4> +`) +//line gititemrefs.qtpl:10 +} + +//line gititemrefs.qtpl:10 +func (g *GitItemRefsPage) WriteGitContent(qq422016 qtio422016.Writer) { +//line gititemrefs.qtpl:10 + qw422016 := qt422016.AcquireWriter(qq422016) +//line gititemrefs.qtpl:10 + g.StreamGitContent(qw422016) +//line gititemrefs.qtpl:10 + qt422016.ReleaseWriter(qw422016) +//line gititemrefs.qtpl:10 +} + +//line gititemrefs.qtpl:10 +func (g *GitItemRefsPage) GitContent() string { +//line gititemrefs.qtpl:10 + qb422016 := qt422016.AcquireByteBuffer() +//line gititemrefs.qtpl:10 + g.WriteGitContent(qb422016) +//line gititemrefs.qtpl:10 + qs422016 := string(qb422016.B) +//line gititemrefs.qtpl:10 + qt422016.ReleaseByteBuffer(qb422016) +//line gititemrefs.qtpl:10 + return qs422016 +//line gititemrefs.qtpl:10 +} diff --git a/templates/gititemsummary.qtpl b/templates/gititemsummary.qtpl new file mode 100644 index 0000000..f4b0dd6 --- /dev/null +++ b/templates/gititemsummary.qtpl @@ -0,0 +1,10 @@ +{% code +type GitItemSummaryPage struct { +} +%} + +{% func (g *GitItemSummaryPage) Nav(name string) %}{%= GitItemNav(name, Summary) %}{% endfunc %} + +{% func (g *GitItemSummaryPage) GitContent() %} +<h4>Summary</h4> +{% endfunc %} diff --git a/templates/gititemsummary.qtpl.go b/templates/gititemsummary.qtpl.go new file mode 100644 index 0000000..aa41a17 --- /dev/null +++ b/templates/gititemsummary.qtpl.go @@ -0,0 +1,90 @@ +// Code generated by qtc from "gititemsummary.qtpl". DO NOT EDIT. +// See https://github.com/valyala/quicktemplate for details. + +//line gititemsummary.qtpl:1 +package templates + +//line gititemsummary.qtpl:1 +import ( + qtio422016 "io" + + qt422016 "github.com/valyala/quicktemplate" +) + +//line gititemsummary.qtpl:1 +var ( + _ = qtio422016.Copy + _ = qt422016.AcquireByteBuffer +) + +//line gititemsummary.qtpl:2 +type GitItemSummaryPage struct { +} + +//line gititemsummary.qtpl:6 +func (g *GitItemSummaryPage) StreamNav(qw422016 *qt422016.Writer, name string) { +//line gititemsummary.qtpl:6 + StreamGitItemNav(qw422016, name, Summary) +//line gititemsummary.qtpl:6 +} + +//line gititemsummary.qtpl:6 +func (g *GitItemSummaryPage) WriteNav(qq422016 qtio422016.Writer, name string) { +//line gititemsummary.qtpl:6 + qw422016 := qt422016.AcquireWriter(qq422016) +//line gititemsummary.qtpl:6 + g.StreamNav(qw422016, name) +//line gititemsummary.qtpl:6 + qt422016.ReleaseWriter(qw422016) +//line gititemsummary.qtpl:6 +} + +//line gititemsummary.qtpl:6 +func (g *GitItemSummaryPage) Nav(name string) string { +//line gititemsummary.qtpl:6 + qb422016 := qt422016.AcquireByteBuffer() +//line gititemsummary.qtpl:6 + g.WriteNav(qb422016, name) +//line gititemsummary.qtpl:6 + qs422016 := string(qb422016.B) +//line gititemsummary.qtpl:6 + qt422016.ReleaseByteBuffer(qb422016) +//line gititemsummary.qtpl:6 + return qs422016 +//line gititemsummary.qtpl:6 +} + +//line gititemsummary.qtpl:8 +func (g *GitItemSummaryPage) StreamGitContent(qw422016 *qt422016.Writer) { +//line gititemsummary.qtpl:8 + qw422016.N().S(` +<h4>Summary</h4> +`) +//line gititemsummary.qtpl:10 +} + +//line gititemsummary.qtpl:10 +func (g *GitItemSummaryPage) WriteGitContent(qq422016 qtio422016.Writer) { +//line gititemsummary.qtpl:10 + qw422016 := qt422016.AcquireWriter(qq422016) +//line gititemsummary.qtpl:10 + g.StreamGitContent(qw422016) +//line gititemsummary.qtpl:10 + qt422016.ReleaseWriter(qw422016) +//line gititemsummary.qtpl:10 +} + +//line gititemsummary.qtpl:10 +func (g *GitItemSummaryPage) GitContent() string { +//line gititemsummary.qtpl:10 + qb422016 := qt422016.AcquireByteBuffer() +//line gititemsummary.qtpl:10 + g.WriteGitContent(qb422016) +//line gititemsummary.qtpl:10 + qs422016 := string(qb422016.B) +//line gititemsummary.qtpl:10 + qt422016.ReleaseByteBuffer(qb422016) +//line gititemsummary.qtpl:10 + return qs422016 +//line gititemsummary.qtpl:10 +} diff --git a/templates/gititemtree.qtpl b/templates/gititemtree.qtpl new file mode 100644 index 0000000..778cc00 --- /dev/null +++ b/templates/gititemtree.qtpl @@ -0,0 +1,10 @@ +{% code +type GitItemTreePage struct { +} +%} + +{% func (g *GitItemTreePage) Nav(name string) %}{%= GitItemNav(name, Tree) %}{% endfunc %} + +{% func (g *GitItemTreePage) GitContent() %} +<h4>Tree</h4> +{% endfunc %} diff --git a/templates/gititemtree.qtpl.go b/templates/gititemtree.qtpl.go new file mode 100644 index 0000000..04861d1 --- /dev/null +++ b/templates/gititemtree.qtpl.go @@ -0,0 +1,90 @@ +// Code generated by qtc from "gititemtree.qtpl". DO NOT EDIT. +// See https://github.com/valyala/quicktemplate for details. + +//line gititemtree.qtpl:1 +package templates + +//line gititemtree.qtpl:1 +import ( + qtio422016 "io" + + qt422016 "github.com/valyala/quicktemplate" +) + +//line gititemtree.qtpl:1 +var ( + _ = qtio422016.Copy + _ = qt422016.AcquireByteBuffer +) + +//line gititemtree.qtpl:2 +type GitItemTreePage struct { +} + +//line gititemtree.qtpl:6 +func (g *GitItemTreePage) StreamNav(qw422016 *qt422016.Writer, name string) { +//line gititemtree.qtpl:6 + StreamGitItemNav(qw422016, name, Tree) +//line gititemtree.qtpl:6 +} + +//line gititemtree.qtpl:6 +func (g *GitItemTreePage) WriteNav(qq422016 qtio422016.Writer, name string) { +//line gititemtree.qtpl:6 + qw422016 := qt422016.AcquireWriter(qq422016) +//line gititemtree.qtpl:6 + g.StreamNav(qw422016, name) +//line gititemtree.qtpl:6 + qt422016.ReleaseWriter(qw422016) +//line gititemtree.qtpl:6 +} + +//line gititemtree.qtpl:6 +func (g *GitItemTreePage) Nav(name string) string { +//line gititemtree.qtpl:6 + qb422016 := qt422016.AcquireByteBuffer() +//line gititemtree.qtpl:6 + g.WriteNav(qb422016, name) +//line gititemtree.qtpl:6 + qs422016 := string(qb422016.B) +//line gititemtree.qtpl:6 + qt422016.ReleaseByteBuffer(qb422016) +//line gititemtree.qtpl:6 + return qs422016 +//line gititemtree.qtpl:6 +} + +//line gititemtree.qtpl:8 +func (g *GitItemTreePage) StreamGitContent(qw422016 *qt422016.Writer) { +//line gititemtree.qtpl:8 + qw422016.N().S(` +<h4>Tree</h4> +`) +//line gititemtree.qtpl:10 +} + +//line gititemtree.qtpl:10 +func (g *GitItemTreePage) WriteGitContent(qq422016 qtio422016.Writer) { +//line gititemtree.qtpl:10 + qw422016 := qt422016.AcquireWriter(qq422016) +//line gititemtree.qtpl:10 + g.StreamGitContent(qw422016) +//line gititemtree.qtpl:10 + qt422016.ReleaseWriter(qw422016) +//line gititemtree.qtpl:10 +} + +//line gititemtree.qtpl:10 +func (g *GitItemTreePage) GitContent() string { +//line gititemtree.qtpl:10 + qb422016 := qt422016.AcquireByteBuffer() +//line gititemtree.qtpl:10 + g.WriteGitContent(qb422016) +//line gititemtree.qtpl:10 + qs422016 := string(qb422016.B) +//line gititemtree.qtpl:10 + qt422016.ReleaseByteBuffer(qb422016) +//line gititemtree.qtpl:10 + return qs422016 +//line gititemtree.qtpl:10 +} diff --git a/templates/gitlist.qtpl b/templates/gitlist.qtpl index e07f199..b7beca5 100644 --- a/templates/gitlist.qtpl +++ b/templates/gitlist.qtpl @@ -17,12 +17,16 @@ type GitListPage struct { {% for _, r := range p.Respositories %} <div class="event"> <h4> - <a href="/{%s r.Name %}">{%s r.Name %}</a> + <a href="/{%s r.Name %}/summary">{%s r.Name %}</a> </h4> </hr> <p>{%s r.LastCommitMessage %}</p> <p><small>{%s r.LastCommitDate %}</small></p> - <p><a href="#">summary</a> <a href="#">log</a> <a href="#">tree</a></p> + <p> + <a href="/{%s r.Name %}/summary">summary</a> + <a href="/{%s r.Name %}/log">log</a> + <a href="/{%s r.Name %}/tree">tree</a> + </p> </div> {% endfor %} </div> diff --git a/templates/gitlist.qtpl.go b/templates/gitlist.qtpl.go index 130db5d..73f887a 100644 --- a/templates/gitlist.qtpl.go +++ b/templates/gitlist.qtpl.go @@ -109,7 +109,7 @@ func (p *GitListPage) StreamContent(qw422016 *qt422016.Writer) { //line gitlist.qtpl:20 qw422016.E().S(r.Name) //line gitlist.qtpl:20 - qw422016.N().S(`">`) + qw422016.N().S(`/summary">`) //line gitlist.qtpl:20 qw422016.E().S(r.Name) //line gitlist.qtpl:20 @@ -126,78 +126,94 @@ func (p *GitListPage) StreamContent(qw422016 *qt422016.Writer) { qw422016.E().S(r.LastCommitDate) //line gitlist.qtpl:24 qw422016.N().S(`</small></p> - <p><a href="#">summary</a> <a href="#">log</a> <a href="#">tree</a></p> + <p> + <a href="/`) +//line gitlist.qtpl:26 + qw422016.E().S(r.Name) +//line gitlist.qtpl:26 + qw422016.N().S(`/summary">summary</a> + <a href="/`) +//line gitlist.qtpl:27 + qw422016.E().S(r.Name) +//line gitlist.qtpl:27 + qw422016.N().S(`/log">log</a> + <a href="/`) +//line gitlist.qtpl:28 + qw422016.E().S(r.Name) +//line gitlist.qtpl:28 + qw422016.N().S(`/tree">tree</a> + </p> </div> `) -//line gitlist.qtpl:27 +//line gitlist.qtpl:31 } -//line gitlist.qtpl:27 +//line gitlist.qtpl:31 qw422016.N().S(` </div> `) -//line gitlist.qtpl:29 +//line gitlist.qtpl:33 } -//line gitlist.qtpl:29 +//line gitlist.qtpl:33 func (p *GitListPage) WriteContent(qq422016 qtio422016.Writer) { -//line gitlist.qtpl:29 +//line gitlist.qtpl:33 qw422016 := qt422016.AcquireWriter(qq422016) -//line gitlist.qtpl:29 +//line gitlist.qtpl:33 p.StreamContent(qw422016) -//line gitlist.qtpl:29 +//line gitlist.qtpl:33 qt422016.ReleaseWriter(qw422016) -//line gitlist.qtpl:29 +//line gitlist.qtpl:33 } -//line gitlist.qtpl:29 +//line gitlist.qtpl:33 func (p *GitListPage) Content() string { -//line gitlist.qtpl:29 +//line gitlist.qtpl:33 qb422016 := qt422016.AcquireByteBuffer() -//line gitlist.qtpl:29 +//line gitlist.qtpl:33 p.WriteContent(qb422016) -//line gitlist.qtpl:29 +//line gitlist.qtpl:33 qs422016 := string(qb422016.B) -//line gitlist.qtpl:29 +//line gitlist.qtpl:33 qt422016.ReleaseByteBuffer(qb422016) -//line gitlist.qtpl:29 +//line gitlist.qtpl:33 return qs422016 -//line gitlist.qtpl:29 +//line gitlist.qtpl:33 } // </div> // </div> // -//line gitlist.qtpl:33 +//line gitlist.qtpl:37 func (p *GitListPage) StreamScript(qw422016 *qt422016.Writer) { -//line gitlist.qtpl:33 +//line gitlist.qtpl:37 qw422016.N().S(` `) -//line gitlist.qtpl:34 +//line gitlist.qtpl:38 } -//line gitlist.qtpl:34 +//line gitlist.qtpl:38 func (p *GitListPage) WriteScript(qq422016 qtio422016.Writer) { -//line gitlist.qtpl:34 +//line gitlist.qtpl:38 qw422016 := qt422016.AcquireWriter(qq422016) -//line gitlist.qtpl:34 +//line gitlist.qtpl:38 p.StreamScript(qw422016) -//line gitlist.qtpl:34 +//line gitlist.qtpl:38 qt422016.ReleaseWriter(qw422016) -//line gitlist.qtpl:34 +//line gitlist.qtpl:38 } -//line gitlist.qtpl:34 +//line gitlist.qtpl:38 func (p *GitListPage) Script() string { -//line gitlist.qtpl:34 +//line gitlist.qtpl:38 qb422016 := qt422016.AcquireByteBuffer() -//line gitlist.qtpl:34 +//line gitlist.qtpl:38 p.WriteScript(qb422016) -//line gitlist.qtpl:34 +//line gitlist.qtpl:38 qs422016 := string(qb422016.B) -//line gitlist.qtpl:34 +//line gitlist.qtpl:38 qt422016.ReleaseByteBuffer(qb422016) -//line gitlist.qtpl:34 +//line gitlist.qtpl:38 return qs422016 -//line gitlist.qtpl:34 +//line gitlist.qtpl:38 } diff --git a/templates/navbar.qtpl b/templates/navbar.qtpl index 636c619..8b0799d 100644 --- a/templates/navbar.qtpl +++ b/templates/navbar.qtpl @@ -8,8 +8,18 @@ const ( ) %} -{% func insertIfEqual(s, d Selection) %}{% if s == d %} selected{% endif %}{% endfunc %} +{% code +type GitSelection int +const ( + Readme GitSelection = iota + Log + Summary + Refs + Tree +) +%} +{% func insertIfEqual(s, d any) %}{% if s == d %} selected{% endif %}{% endfunc %} {% func Navbar (s Selection) %} <nav class="container navbar navbar-expand"> @@ -21,3 +31,23 @@ const ( </div> </nav> {% endfunc %} + +{% func GitItemNav (name string, s GitSelection) %} + <ul class="nav"> + <li class="nav-item"> + <a class="nav-link{%= insertIfEqual(s, Readme) %}" aria-current="page" href="/{%s name %}/about">about</a> + </li> + <li class="nav-item"> + <a class="nav-link{%= insertIfEqual(s, Log) %}" aria-current="page" href="/{%s name %}/log">log</a> + </li> + <li class="nav-item"> + <a class="nav-link{%= insertIfEqual(s, Summary) %}" aria-current="page" href="/{%s name %}/summary">summary</a> + </li> + <li class="nav-item"> + <a class="nav-link{%= insertIfEqual(s, Refs) %}" aria-current="page" href="/{%s name %}/refs">refs</a> + </li> + <li class="nav-item"> + <a class="nav-link{%= insertIfEqual(s, Tree) %}" aria-current="page" href="/{%s name %}/tree">tree</a> + </li> + </ul> +{% endfunc %} diff --git a/templates/navbar.qtpl.go b/templates/navbar.qtpl.go index 1caade2..acf21b4 100644 --- a/templates/navbar.qtpl.go +++ b/templates/navbar.qtpl.go @@ -27,97 +27,199 @@ const ( Config ) -//line navbar.qtpl:11 -func streaminsertIfEqual(qw422016 *qt422016.Writer, s, d Selection) { -//line navbar.qtpl:11 +//line navbar.qtpl:12 +type GitSelection int + +const ( + Readme GitSelection = iota + Log + Summary + Refs + Tree +) + +//line navbar.qtpl:22 +func streaminsertIfEqual(qw422016 *qt422016.Writer, s, d any) { +//line navbar.qtpl:22 if s == d { -//line navbar.qtpl:11 +//line navbar.qtpl:22 qw422016.N().S(` selected`) -//line navbar.qtpl:11 +//line navbar.qtpl:22 } -//line navbar.qtpl:11 +//line navbar.qtpl:22 } -//line navbar.qtpl:11 -func writeinsertIfEqual(qq422016 qtio422016.Writer, s, d Selection) { -//line navbar.qtpl:11 +//line navbar.qtpl:22 +func writeinsertIfEqual(qq422016 qtio422016.Writer, s, d any) { +//line navbar.qtpl:22 qw422016 := qt422016.AcquireWriter(qq422016) -//line navbar.qtpl:11 +//line navbar.qtpl:22 streaminsertIfEqual(qw422016, s, d) -//line navbar.qtpl:11 +//line navbar.qtpl:22 qt422016.ReleaseWriter(qw422016) -//line navbar.qtpl:11 +//line navbar.qtpl:22 } -//line navbar.qtpl:11 -func insertIfEqual(s, d Selection) string { -//line navbar.qtpl:11 +//line navbar.qtpl:22 +func insertIfEqual(s, d any) string { +//line navbar.qtpl:22 qb422016 := qt422016.AcquireByteBuffer() -//line navbar.qtpl:11 +//line navbar.qtpl:22 writeinsertIfEqual(qb422016, s, d) -//line navbar.qtpl:11 +//line navbar.qtpl:22 qs422016 := string(qb422016.B) -//line navbar.qtpl:11 +//line navbar.qtpl:22 qt422016.ReleaseByteBuffer(qb422016) -//line navbar.qtpl:11 +//line navbar.qtpl:22 return qs422016 -//line navbar.qtpl:11 +//line navbar.qtpl:22 } -//line navbar.qtpl:14 +//line navbar.qtpl:24 func StreamNavbar(qw422016 *qt422016.Writer, s Selection) { -//line navbar.qtpl:14 +//line navbar.qtpl:24 qw422016.N().S(` <nav class="container navbar navbar-expand"> <div class="navbar-nav"> <a class="nav-link`) -//line navbar.qtpl:17 +//line navbar.qtpl:27 streaminsertIfEqual(qw422016, s, Git) -//line navbar.qtpl:17 +//line navbar.qtpl:27 qw422016.N().S(`" href="/">git</a> <a class="nav-link`) -//line navbar.qtpl:18 +//line navbar.qtpl:28 streaminsertIfEqual(qw422016, s, List) -//line navbar.qtpl:18 +//line navbar.qtpl:28 qw422016.N().S(`" href="/list">list</a> <a class="nav-link`) -//line navbar.qtpl:19 +//line navbar.qtpl:29 streaminsertIfEqual(qw422016, s, About) -//line navbar.qtpl:19 +//line navbar.qtpl:29 qw422016.N().S(`" href="/about">about</a> <a class="nav-link`) -//line navbar.qtpl:20 +//line navbar.qtpl:30 streaminsertIfEqual(qw422016, s, Config) -//line navbar.qtpl:20 +//line navbar.qtpl:30 qw422016.N().S(`" href="/config">config</a> </div> </nav> `) -//line navbar.qtpl:23 +//line navbar.qtpl:33 } -//line navbar.qtpl:23 +//line navbar.qtpl:33 func WriteNavbar(qq422016 qtio422016.Writer, s Selection) { -//line navbar.qtpl:23 +//line navbar.qtpl:33 qw422016 := qt422016.AcquireWriter(qq422016) -//line navbar.qtpl:23 +//line navbar.qtpl:33 StreamNavbar(qw422016, s) -//line navbar.qtpl:23 +//line navbar.qtpl:33 qt422016.ReleaseWriter(qw422016) -//line navbar.qtpl:23 +//line navbar.qtpl:33 } -//line navbar.qtpl:23 +//line navbar.qtpl:33 func Navbar(s Selection) string { -//line navbar.qtpl:23 +//line navbar.qtpl:33 qb422016 := qt422016.AcquireByteBuffer() -//line navbar.qtpl:23 +//line navbar.qtpl:33 WriteNavbar(qb422016, s) -//line navbar.qtpl:23 +//line navbar.qtpl:33 + qs422016 := string(qb422016.B) +//line navbar.qtpl:33 + qt422016.ReleaseByteBuffer(qb422016) +//line navbar.qtpl:33 + return qs422016 +//line navbar.qtpl:33 +} + +//line navbar.qtpl:35 +func StreamGitItemNav(qw422016 *qt422016.Writer, name string, s GitSelection) { +//line navbar.qtpl:35 + qw422016.N().S(` + <ul class="nav"> + <li class="nav-item"> + <a class="nav-link`) +//line navbar.qtpl:38 + streaminsertIfEqual(qw422016, s, Readme) +//line navbar.qtpl:38 + qw422016.N().S(`" aria-current="page" href="/`) +//line navbar.qtpl:38 + qw422016.E().S(name) +//line navbar.qtpl:38 + qw422016.N().S(`/about">about</a> + </li> + <li class="nav-item"> + <a class="nav-link`) +//line navbar.qtpl:41 + streaminsertIfEqual(qw422016, s, Log) +//line navbar.qtpl:41 + qw422016.N().S(`" aria-current="page" href="/`) +//line navbar.qtpl:41 + qw422016.E().S(name) +//line navbar.qtpl:41 + qw422016.N().S(`/log">log</a> + </li> + <li class="nav-item"> + <a class="nav-link`) +//line navbar.qtpl:44 + streaminsertIfEqual(qw422016, s, Summary) +//line navbar.qtpl:44 + qw422016.N().S(`" aria-current="page" href="/`) +//line navbar.qtpl:44 + qw422016.E().S(name) +//line navbar.qtpl:44 + qw422016.N().S(`/summary">summary</a> + </li> + <li class="nav-item"> + <a class="nav-link`) +//line navbar.qtpl:47 + streaminsertIfEqual(qw422016, s, Refs) +//line navbar.qtpl:47 + qw422016.N().S(`" aria-current="page" href="/`) +//line navbar.qtpl:47 + qw422016.E().S(name) +//line navbar.qtpl:47 + qw422016.N().S(`/refs">refs</a> + </li> + <li class="nav-item"> + <a class="nav-link`) +//line navbar.qtpl:50 + streaminsertIfEqual(qw422016, s, Tree) +//line navbar.qtpl:50 + qw422016.N().S(`" aria-current="page" href="/`) +//line navbar.qtpl:50 + qw422016.E().S(name) +//line navbar.qtpl:50 + qw422016.N().S(`/tree">tree</a> + </li> + </ul> +`) +//line navbar.qtpl:53 +} + +//line navbar.qtpl:53 +func WriteGitItemNav(qq422016 qtio422016.Writer, name string, s GitSelection) { +//line navbar.qtpl:53 + qw422016 := qt422016.AcquireWriter(qq422016) +//line navbar.qtpl:53 + StreamGitItemNav(qw422016, name, s) +//line navbar.qtpl:53 + qt422016.ReleaseWriter(qw422016) +//line navbar.qtpl:53 +} + +//line navbar.qtpl:53 +func GitItemNav(name string, s GitSelection) string { +//line navbar.qtpl:53 + qb422016 := qt422016.AcquireByteBuffer() +//line navbar.qtpl:53 + WriteGitItemNav(qb422016, name, s) +//line navbar.qtpl:53 qs422016 := string(qb422016.B) -//line navbar.qtpl:23 +//line navbar.qtpl:53 qt422016.ReleaseByteBuffer(qb422016) -//line navbar.qtpl:23 +//line navbar.qtpl:53 return qs422016 -//line navbar.qtpl:23 +//line navbar.qtpl:53 } |