aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGabriel A. Giovanini <mail@gabrielgio.me>2024-05-30 15:06:28 +0200
committerGabriel A. Giovanini <mail@gabrielgio.me>2024-05-30 15:06:28 +0200
commit242ba7f412d4e54f21385afff3f2b884f57f6ced (patch)
tree574b05ad544b0473f53a66d474591751989add94
parent2dd4cf35aab8324608a83d337459fd8354521b92 (diff)
downloadcerrado-242ba7f412d4e54f21385afff3f2b884f57f6ced.tar.gz
cerrado-242ba7f412d4e54f21385afff3f2b884f57f6ced.tar.bz2
cerrado-242ba7f412d4e54f21385afff3f2b884f57f6ced.zip
feat: Add navbar selection
-rw-r--r--pkg/handler/about/handler.go2
-rw-r--r--pkg/handler/config/handler.go2
-rw-r--r--scss/main.scss4
-rw-r--r--templates/about.qtpl16
-rw-r--r--templates/about.qtpl.go162
-rw-r--r--templates/base.qtpl20
-rw-r--r--templates/base.qtpl.go183
-rw-r--r--templates/config.qtpl16
-rw-r--r--templates/config.qtpl.go162
-rw-r--r--templates/gitlist.qtpl2
-rw-r--r--templates/gitlist.qtpl.go115
-rw-r--r--templates/helloworld.qtpl14
-rw-r--r--templates/helloworld.qtpl.go129
-rw-r--r--templates/navbar.qtpl23
-rw-r--r--templates/navbar.qtpl.go123
15 files changed, 684 insertions, 289 deletions
diff --git a/pkg/handler/about/handler.go b/pkg/handler/about/handler.go
index a2caa4e..1acde60 100644
--- a/pkg/handler/about/handler.go
+++ b/pkg/handler/about/handler.go
@@ -50,7 +50,7 @@ func (g *AboutHandler) About(w http.ResponseWriter, _ *http.Request) {
bs = markdown.Render(doc, renderer)
- gitList := &templates.HelloPage{
+ gitList := &templates.AboutPage{
Body: bs,
}
templates.WritePageTemplate(w, gitList)
diff --git a/pkg/handler/config/handler.go b/pkg/handler/config/handler.go
index c278e35..30f4283 100644
--- a/pkg/handler/config/handler.go
+++ b/pkg/handler/config/handler.go
@@ -56,7 +56,7 @@ func ConfigFile(configRepo configurationRepository) func(http.ResponseWriter, *h
return
}
- hello := &templates.HelloPage{
+ hello := &templates.ConfigPage{
Body: code.Bytes(),
}
diff --git a/scss/main.scss b/scss/main.scss
index fc16ca5..f57579a 100644
--- a/scss/main.scss
+++ b/scss/main.scss
@@ -50,6 +50,10 @@ body {
background: #f8f9fa;
}
+.selected {
+ text-decoration: underline;
+}
+
.event > h4 {
margin: 0;
}
diff --git a/templates/about.qtpl b/templates/about.qtpl
new file mode 100644
index 0000000..faee50e
--- /dev/null
+++ b/templates/about.qtpl
@@ -0,0 +1,16 @@
+{% code
+type AboutPage struct {
+ Body []byte
+}
+%}
+
+{% func (p *AboutPage) Title() %}Hello{% endfunc %}
+
+{% func (p *AboutPage) Navbar() %}{%= Navbar(About) %}{% endfunc %}
+
+{% func (p *AboutPage) Content() %}
+{%z= p.Body %}
+{% endfunc %}
+
+{% func (p *AboutPage) Script() %}
+{% endfunc %}
diff --git a/templates/about.qtpl.go b/templates/about.qtpl.go
new file mode 100644
index 0000000..aaa2514
--- /dev/null
+++ b/templates/about.qtpl.go
@@ -0,0 +1,162 @@
+// Code generated by qtc from "about.qtpl". DO NOT EDIT.
+// See https://github.com/valyala/quicktemplate for details.
+
+//line about.qtpl:1
+package templates
+
+//line about.qtpl:1
+import (
+ qtio422016 "io"
+
+ qt422016 "github.com/valyala/quicktemplate"
+)
+
+//line about.qtpl:1
+var (
+ _ = qtio422016.Copy
+ _ = qt422016.AcquireByteBuffer
+)
+
+//line about.qtpl:2
+type AboutPage struct {
+ Body []byte
+}
+
+//line about.qtpl:7
+func (p *AboutPage) StreamTitle(qw422016 *qt422016.Writer) {
+//line about.qtpl:7
+ qw422016.N().S(`Hello`)
+//line about.qtpl:7
+}
+
+//line about.qtpl:7
+func (p *AboutPage) WriteTitle(qq422016 qtio422016.Writer) {
+//line about.qtpl:7
+ qw422016 := qt422016.AcquireWriter(qq422016)
+//line about.qtpl:7
+ p.StreamTitle(qw422016)
+//line about.qtpl:7
+ qt422016.ReleaseWriter(qw422016)
+//line about.qtpl:7
+}
+
+//line about.qtpl:7
+func (p *AboutPage) Title() string {
+//line about.qtpl:7
+ qb422016 := qt422016.AcquireByteBuffer()
+//line about.qtpl:7
+ p.WriteTitle(qb422016)
+//line about.qtpl:7
+ qs422016 := string(qb422016.B)
+//line about.qtpl:7
+ qt422016.ReleaseByteBuffer(qb422016)
+//line about.qtpl:7
+ return qs422016
+//line about.qtpl:7
+}
+
+//line about.qtpl:9
+func (p *AboutPage) StreamNavbar(qw422016 *qt422016.Writer) {
+//line about.qtpl:9
+ StreamNavbar(qw422016, About)
+//line about.qtpl:9
+}
+
+//line about.qtpl:9
+func (p *AboutPage) WriteNavbar(qq422016 qtio422016.Writer) {
+//line about.qtpl:9
+ qw422016 := qt422016.AcquireWriter(qq422016)
+//line about.qtpl:9
+ p.StreamNavbar(qw422016)
+//line about.qtpl:9
+ qt422016.ReleaseWriter(qw422016)
+//line about.qtpl:9
+}
+
+//line about.qtpl:9
+func (p *AboutPage) Navbar() string {
+//line about.qtpl:9
+ qb422016 := qt422016.AcquireByteBuffer()
+//line about.qtpl:9
+ p.WriteNavbar(qb422016)
+//line about.qtpl:9
+ qs422016 := string(qb422016.B)
+//line about.qtpl:9
+ qt422016.ReleaseByteBuffer(qb422016)
+//line about.qtpl:9
+ return qs422016
+//line about.qtpl:9
+}
+
+//line about.qtpl:11
+func (p *AboutPage) StreamContent(qw422016 *qt422016.Writer) {
+//line about.qtpl:11
+ qw422016.N().S(`
+`)
+//line about.qtpl:12
+ qw422016.N().Z(p.Body)
+//line about.qtpl:12
+ qw422016.N().S(`
+`)
+//line about.qtpl:13
+}
+
+//line about.qtpl:13
+func (p *AboutPage) WriteContent(qq422016 qtio422016.Writer) {
+//line about.qtpl:13
+ qw422016 := qt422016.AcquireWriter(qq422016)
+//line about.qtpl:13
+ p.StreamContent(qw422016)
+//line about.qtpl:13
+ qt422016.ReleaseWriter(qw422016)
+//line about.qtpl:13
+}
+
+//line about.qtpl:13
+func (p *AboutPage) Content() string {
+//line about.qtpl:13
+ qb422016 := qt422016.AcquireByteBuffer()
+//line about.qtpl:13
+ p.WriteContent(qb422016)
+//line about.qtpl:13
+ qs422016 := string(qb422016.B)
+//line about.qtpl:13
+ qt422016.ReleaseByteBuffer(qb422016)
+//line about.qtpl:13
+ return qs422016
+//line about.qtpl:13
+}
+
+//line about.qtpl:15
+func (p *AboutPage) StreamScript(qw422016 *qt422016.Writer) {
+//line about.qtpl:15
+ qw422016.N().S(`
+`)
+//line about.qtpl:16
+}
+
+//line about.qtpl:16
+func (p *AboutPage) WriteScript(qq422016 qtio422016.Writer) {
+//line about.qtpl:16
+ qw422016 := qt422016.AcquireWriter(qq422016)
+//line about.qtpl:16
+ p.StreamScript(qw422016)
+//line about.qtpl:16
+ qt422016.ReleaseWriter(qw422016)
+//line about.qtpl:16
+}
+
+//line about.qtpl:16
+func (p *AboutPage) Script() string {
+//line about.qtpl:16
+ qb422016 := qt422016.AcquireByteBuffer()
+//line about.qtpl:16
+ p.WriteScript(qb422016)
+//line about.qtpl:16
+ qs422016 := string(qb422016.B)
+//line about.qtpl:16
+ qt422016.ReleaseByteBuffer(qb422016)
+//line about.qtpl:16
+ return qs422016
+//line about.qtpl:16
+}
diff --git a/templates/base.qtpl b/templates/base.qtpl
index d8d1d34..ba32aad 100644
--- a/templates/base.qtpl
+++ b/templates/base.qtpl
@@ -2,15 +2,20 @@ This is a base page template. All the other template pages implement this interf
{% import "strconv" %}
+{% code
+ var Slug = ""
+%}
+
{% interface
Page {
Title()
Content()
Script()
+ Navbar()
}
-
%}
+
{% code func FromUInttoString(u *uint) string {
if u != nil {
return strconv.FormatUint(uint64(*u), 10)
@@ -19,10 +24,6 @@ Page {
}
%}
-{% code
- var Slug = ""
-%}
-
Page prints a page implementing Page interface.
{% func PageTemplate(p Page) %}
<html lang="en">
@@ -34,14 +35,7 @@ Page prints a page implementing Page interface.
<meta name="viewport" content="width=device-width, initial-scale=1" />
</head>
<body>
- <nav class="container navbar navbar-expand-sm">
- <div class="navbar-nav">
- <a class="nav-link" href="/git">git</a>
- <a class="nav-link" href="/list">list</a>
- <a class="nav-link" href="/about">about</a>
- <a class="nav-link" href="/config">config</a>
- </div>
- </nav>
+ {%= p.Navbar() %}
<div class="container">
{%= p.Content() %}
</div>
diff --git a/templates/base.qtpl.go b/templates/base.qtpl.go
index 15c9e4f..2f419c6 100644
--- a/templates/base.qtpl.go
+++ b/templates/base.qtpl.go
@@ -24,29 +24,38 @@ var (
)
//line base.qtpl:6
+var Slug = ""
+
+//line base.qtpl:10
type Page interface {
-//line base.qtpl:6
+//line base.qtpl:10
Title() string
-//line base.qtpl:6
+//line base.qtpl:10
StreamTitle(qw422016 *qt422016.Writer)
-//line base.qtpl:6
+//line base.qtpl:10
WriteTitle(qq422016 qtio422016.Writer)
-//line base.qtpl:6
+//line base.qtpl:10
Content() string
-//line base.qtpl:6
+//line base.qtpl:10
StreamContent(qw422016 *qt422016.Writer)
-//line base.qtpl:6
+//line base.qtpl:10
WriteContent(qq422016 qtio422016.Writer)
-//line base.qtpl:6
+//line base.qtpl:10
Script() string
-//line base.qtpl:6
+//line base.qtpl:10
StreamScript(qw422016 *qt422016.Writer)
-//line base.qtpl:6
+//line base.qtpl:10
WriteScript(qq422016 qtio422016.Writer)
-//line base.qtpl:6
+//line base.qtpl:10
+ Navbar() string
+//line base.qtpl:10
+ StreamNavbar(qw422016 *qt422016.Writer)
+//line base.qtpl:10
+ WriteNavbar(qq422016 qtio422016.Writer)
+//line base.qtpl:10
}
-//line base.qtpl:14
+//line base.qtpl:19
func FromUInttoString(u *uint) string {
if u != nil {
return strconv.FormatUint(uint64(*u), 10)
@@ -54,180 +63,174 @@ func FromUInttoString(u *uint) string {
return ""
}
-//line base.qtpl:23
-var Slug = ""
-
// Page prints a page implementing Page interface.
-//line base.qtpl:27
+//line base.qtpl:28
func StreamPageTemplate(qw422016 *qt422016.Writer, p Page) {
-//line base.qtpl:27
+//line base.qtpl:28
qw422016.N().S(`
<html lang="en">
<head>
<meta charset="utf-8">
<link rel="icon" href="data:,">
<title>cerrado | `)
-//line base.qtpl:32
+//line base.qtpl:33
p.StreamTitle(qw422016)
-//line base.qtpl:32
+//line base.qtpl:33
qw422016.N().S(`</title>
<link rel="stylesheet" href="/static/main`)
-//line base.qtpl:33
+//line base.qtpl:34
qw422016.E().S(Slug)
-//line base.qtpl:33
+//line base.qtpl:34
qw422016.N().S(`.css">
<meta name="viewport" content="width=device-width, initial-scale=1" />
</head>
<body>
- <nav class="container navbar navbar-expand-sm">
- <div class="navbar-nav">
- <a class="nav-link" href="/git">git</a>
- <a class="nav-link" href="/list">list</a>
- <a class="nav-link" href="/about">about</a>
- <a class="nav-link" href="/config">config</a>
- </div>
- </nav>
+ `)
+//line base.qtpl:38
+ p.StreamNavbar(qw422016)
+//line base.qtpl:38
+ qw422016.N().S(`
<div class="container">
`)
-//line base.qtpl:46
+//line base.qtpl:40
p.StreamContent(qw422016)
-//line base.qtpl:46
+//line base.qtpl:40
qw422016.N().S(`
</div>
</body>
`)
-//line base.qtpl:49
+//line base.qtpl:43
p.StreamScript(qw422016)
-//line base.qtpl:49
+//line base.qtpl:43
qw422016.N().S(`
</html>
`)
-//line base.qtpl:51
+//line base.qtpl:45
}
-//line base.qtpl:51
+//line base.qtpl:45
func WritePageTemplate(qq422016 qtio422016.Writer, p Page) {
-//line base.qtpl:51
+//line base.qtpl:45
qw422016 := qt422016.AcquireWriter(qq422016)
-//line base.qtpl:51
+//line base.qtpl:45
StreamPageTemplate(qw422016, p)
-//line base.qtpl:51
+//line base.qtpl:45
qt422016.ReleaseWriter(qw422016)
-//line base.qtpl:51
+//line base.qtpl:45
}
-//line base.qtpl:51
+//line base.qtpl:45
func PageTemplate(p Page) string {
-//line base.qtpl:51
+//line base.qtpl:45
qb422016 := qt422016.AcquireByteBuffer()
-//line base.qtpl:51
+//line base.qtpl:45
WritePageTemplate(qb422016, p)
-//line base.qtpl:51
+//line base.qtpl:45
qs422016 := string(qb422016.B)
-//line base.qtpl:51
+//line base.qtpl:45
qt422016.ReleaseByteBuffer(qb422016)
-//line base.qtpl:51
+//line base.qtpl:45
return qs422016
-//line base.qtpl:51
+//line base.qtpl:45
}
-//line base.qtpl:53
+//line base.qtpl:47
type BasePage struct{}
-//line base.qtpl:54
+//line base.qtpl:48
func (p *BasePage) StreamTitle(qw422016 *qt422016.Writer) {
-//line base.qtpl:54
+//line base.qtpl:48
qw422016.N().S(`Empty`)
-//line base.qtpl:54
+//line base.qtpl:48
}
-//line base.qtpl:54
+//line base.qtpl:48
func (p *BasePage) WriteTitle(qq422016 qtio422016.Writer) {
-//line base.qtpl:54
+//line base.qtpl:48
qw422016 := qt422016.AcquireWriter(qq422016)
-//line base.qtpl:54
+//line base.qtpl:48
p.StreamTitle(qw422016)
-//line base.qtpl:54
+//line base.qtpl:48
qt422016.ReleaseWriter(qw422016)
-//line base.qtpl:54
+//line base.qtpl:48
}
-//line base.qtpl:54
+//line base.qtpl:48
func (p *BasePage) Title() string {
-//line base.qtpl:54
+//line base.qtpl:48
qb422016 := qt422016.AcquireByteBuffer()
-//line base.qtpl:54
+//line base.qtpl:48
p.WriteTitle(qb422016)
-//line base.qtpl:54
+//line base.qtpl:48
qs422016 := string(qb422016.B)
-//line base.qtpl:54
+//line base.qtpl:48
qt422016.ReleaseByteBuffer(qb422016)
-//line base.qtpl:54
+//line base.qtpl:48
return qs422016
-//line base.qtpl:54
+//line base.qtpl:48
}
-//line base.qtpl:55
+//line base.qtpl:49
func (p *BasePage) StreamBody(qw422016 *qt422016.Writer) {
-//line base.qtpl:55
+//line base.qtpl:49
qw422016.N().S(`HelloWorld`)
-//line base.qtpl:55
+//line base.qtpl:49
}
-//line base.qtpl:55
+//line base.qtpl:49
func (p *BasePage) WriteBody(qq422016 qtio422016.Writer) {
-//line base.qtpl:55
+//line base.qtpl:49
qw422016 := qt422016.AcquireWriter(qq422016)
-//line base.qtpl:55
+//line base.qtpl:49
p.StreamBody(qw422016)
-//line base.qtpl:55
+//line base.qtpl:49
qt422016.ReleaseWriter(qw422016)
-//line base.qtpl:55
+//line base.qtpl:49
}
-//line base.qtpl:55
+//line base.qtpl:49
func (p *BasePage) Body() string {
-//line base.qtpl:55
+//line base.qtpl:49
qb422016 := qt422016.AcquireByteBuffer()
-//line base.qtpl:55
+//line base.qtpl:49
p.WriteBody(qb422016)
-//line base.qtpl:55
+//line base.qtpl:49
qs422016 := string(qb422016.B)
-//line base.qtpl:55
+//line base.qtpl:49
qt422016.ReleaseByteBuffer(qb422016)
-//line base.qtpl:55
+//line base.qtpl:49
return qs422016
-//line base.qtpl:55
+//line base.qtpl:49
}
-//line base.qtpl:56
+//line base.qtpl:50
func (p *BasePage) StreamScript(qw422016 *qt422016.Writer) {
-//line base.qtpl:56
+//line base.qtpl:50
}
-//line base.qtpl:56
+//line base.qtpl:50
func (p *BasePage) WriteScript(qq422016 qtio422016.Writer) {
-//line base.qtpl:56
+//line base.qtpl:50
qw422016 := qt422016.AcquireWriter(qq422016)
-//line base.qtpl:56
+//line base.qtpl:50
p.StreamScript(qw422016)
-//line base.qtpl:56
+//line base.qtpl:50
qt422016.ReleaseWriter(qw422016)
-//line base.qtpl:56
+//line base.qtpl:50
}
-//line base.qtpl:56
+//line base.qtpl:50
func (p *BasePage) Script() string {
-//line base.qtpl:56
+//line base.qtpl:50
qb422016 := qt422016.AcquireByteBuffer()
-//line base.qtpl:56
+//line base.qtpl:50
p.WriteScript(qb422016)
-//line base.qtpl:56
+//line base.qtpl:50
qs422016 := string(qb422016.B)
-//line base.qtpl:56
+//line base.qtpl:50
qt422016.ReleaseByteBuffer(qb422016)
-//line base.qtpl:56
+//line base.qtpl:50
return qs422016
-//line base.qtpl:56
+//line base.qtpl:50
}
diff --git a/templates/config.qtpl b/templates/config.qtpl
new file mode 100644
index 0000000..c5146b8
--- /dev/null
+++ b/templates/config.qtpl
@@ -0,0 +1,16 @@
+{% code
+type ConfigPage struct {
+ Body []byte
+}
+%}
+
+{% func (p *ConfigPage) Title() %}Hello{% endfunc %}
+
+{% func (p *ConfigPage) Navbar() %}{%= Navbar(Config) %}{% endfunc %}
+
+{% func (p *ConfigPage) Content() %}
+{%z= p.Body %}
+{% endfunc %}
+
+{% func (p *ConfigPage) Script() %}
+{% endfunc %}
diff --git a/templates/config.qtpl.go b/templates/config.qtpl.go
new file mode 100644
index 0000000..a5df086
--- /dev/null
+++ b/templates/config.qtpl.go
@@ -0,0 +1,162 @@
+// Code generated by qtc from "config.qtpl". DO NOT EDIT.
+// See https://github.com/valyala/quicktemplate for details.
+
+//line config.qtpl:1
+package templates
+
+//line config.qtpl:1
+import (
+ qtio422016 "io"
+
+ qt422016 "github.com/valyala/quicktemplate"
+)
+
+//line config.qtpl:1
+var (
+ _ = qtio422016.Copy
+ _ = qt422016.AcquireByteBuffer
+)
+
+//line config.qtpl:2
+type ConfigPage struct {
+ Body []byte
+}
+
+//line config.qtpl:7
+func (p *ConfigPage) StreamTitle(qw422016 *qt422016.Writer) {
+//line config.qtpl:7
+ qw422016.N().S(`Hello`)
+//line config.qtpl:7
+}
+
+//line config.qtpl:7
+func (p *ConfigPage) WriteTitle(qq422016 qtio422016.Writer) {
+//line config.qtpl:7
+ qw422016 := qt422016.AcquireWriter(qq422016)
+//line config.qtpl:7
+ p.StreamTitle(qw422016)
+//line config.qtpl:7
+ qt422016.ReleaseWriter(qw422016)
+//line config.qtpl:7
+}
+
+//line config.qtpl:7
+func (p *ConfigPage) Title() string {
+//line config.qtpl:7
+ qb422016 := qt422016.AcquireByteBuffer()
+//line config.qtpl:7
+ p.WriteTitle(qb422016)
+//line config.qtpl:7
+ qs422016 := string(qb422016.B)
+//line config.qtpl:7
+ qt422016.ReleaseByteBuffer(qb422016)
+//line config.qtpl:7
+ return qs422016
+//line config.qtpl:7
+}
+
+//line config.qtpl:9
+func (p *ConfigPage) StreamNavbar(qw422016 *qt422016.Writer) {
+//line config.qtpl:9
+ StreamNavbar(qw422016, Config)
+//line config.qtpl:9
+}
+
+//line config.qtpl:9
+func (p *ConfigPage) WriteNavbar(qq422016 qtio422016.Writer) {
+//line config.qtpl:9
+ qw422016 := qt422016.AcquireWriter(qq422016)
+//line config.qtpl:9
+ p.StreamNavbar(qw422016)
+//line config.qtpl:9
+ qt422016.ReleaseWriter(qw422016)
+//line config.qtpl:9
+}
+
+//line config.qtpl:9
+func (p *ConfigPage) Navbar() string {
+//line config.qtpl:9
+ qb422016 := qt422016.AcquireByteBuffer()
+//line config.qtpl:9
+ p.WriteNavbar(qb422016)
+//line config.qtpl:9
+ qs422016 := string(qb422016.B)
+//line config.qtpl:9
+ qt422016.ReleaseByteBuffer(qb422016)
+//line config.qtpl:9
+ return qs422016
+//line config.qtpl:9
+}
+
+//line config.qtpl:11
+func (p *ConfigPage) StreamContent(qw422016 *qt422016.Writer) {
+//line config.qtpl:11
+ qw422016.N().S(`
+`)
+//line config.qtpl:12
+ qw422016.N().Z(p.Body)
+//line config.qtpl:12
+ qw422016.N().S(`
+`)
+//line config.qtpl:13
+}
+
+//line config.qtpl:13
+func (p *ConfigPage) WriteContent(qq422016 qtio422016.Writer) {
+//line config.qtpl:13
+ qw422016 := qt422016.AcquireWriter(qq422016)
+//line config.qtpl:13
+ p.StreamContent(qw422016)
+//line config.qtpl:13
+ qt422016.ReleaseWriter(qw422016)
+//line config.qtpl:13
+}
+
+//line config.qtpl:13
+func (p *ConfigPage) Content() string {
+//line config.qtpl:13
+ qb422016 := qt422016.AcquireByteBuffer()
+//line config.qtpl:13
+ p.WriteContent(qb422016)
+//line config.qtpl:13
+ qs422016 := string(qb422016.B)
+//line config.qtpl:13
+ qt422016.ReleaseByteBuffer(qb422016)
+//line config.qtpl:13
+ return qs422016
+//line config.qtpl:13
+}
+
+//line config.qtpl:15
+func (p *ConfigPage) StreamScript(qw422016 *qt422016.Writer) {
+//line config.qtpl:15
+ qw422016.N().S(`
+`)
+//line config.qtpl:16
+}
+
+//line config.qtpl:16
+func (p *ConfigPage) WriteScript(qq422016 qtio422016.Writer) {
+//line config.qtpl:16
+ qw422016 := qt422016.AcquireWriter(qq422016)
+//line config.qtpl:16
+ p.StreamScript(qw422016)
+//line config.qtpl:16
+ qt422016.ReleaseWriter(qw422016)
+//line config.qtpl:16
+}
+
+//line config.qtpl:16
+func (p *ConfigPage) Script() string {
+//line config.qtpl:16
+ qb422016 := qt422016.AcquireByteBuffer()
+//line config.qtpl:16
+ p.WriteScript(qb422016)
+//line config.qtpl:16
+ qs422016 := string(qb422016.B)
+//line config.qtpl:16
+ qt422016.ReleaseByteBuffer(qb422016)
+//line config.qtpl:16
+ return qs422016
+//line config.qtpl:16
+}
diff --git a/templates/gitlist.qtpl b/templates/gitlist.qtpl
index fef9126..588c264 100644
--- a/templates/gitlist.qtpl
+++ b/templates/gitlist.qtpl
@@ -8,6 +8,8 @@ type GitListPage struct {
{% func (p *GitListPage) Title() %}Git | List{% endfunc %}
+{% func (p *GitListPage) Navbar() %}{%= Navbar(Git) %}{% endfunc %}
+
{% func (p *GitListPage) Content() %}
<div class="row">
<div class="col-md-8 offset-md-2">
diff --git a/templates/gitlist.qtpl.go b/templates/gitlist.qtpl.go
index 89d1d71..5438729 100644
--- a/templates/gitlist.qtpl.go
+++ b/templates/gitlist.qtpl.go
@@ -59,111 +59,144 @@ func (p *GitListPage) Title() string {
}
//line gitlist.qtpl:11
-func (p *GitListPage) StreamContent(qw422016 *qt422016.Writer) {
+func (p *GitListPage) StreamNavbar(qw422016 *qt422016.Writer) {
+//line gitlist.qtpl:11
+ StreamNavbar(qw422016, Git)
+//line gitlist.qtpl:11
+}
+
+//line gitlist.qtpl:11
+func (p *GitListPage) WriteNavbar(qq422016 qtio422016.Writer) {
+//line gitlist.qtpl:11
+ qw422016 := qt422016.AcquireWriter(qq422016)
+//line gitlist.qtpl:11
+ p.StreamNavbar(qw422016)
+//line gitlist.qtpl:11
+ qt422016.ReleaseWriter(qw422016)
+//line gitlist.qtpl:11
+}
+
+//line gitlist.qtpl:11
+func (p *GitListPage) Navbar() string {
+//line gitlist.qtpl:11
+ qb422016 := qt422016.AcquireByteBuffer()
+//line gitlist.qtpl:11
+ p.WriteNavbar(qb422016)
+//line gitlist.qtpl:11
+ qs422016 := string(qb422016.B)
+//line gitlist.qtpl:11
+ qt422016.ReleaseByteBuffer(qb422016)
+//line gitlist.qtpl:11
+ return qs422016
//line gitlist.qtpl:11
+}
+
+//line gitlist.qtpl:13
+func (p *GitListPage) StreamContent(qw422016 *qt422016.Writer) {
+//line gitlist.qtpl:13
qw422016.N().S(`
<div class="row">
<div class="col-md-8 offset-md-2">
<div class="event-list">
`)
-//line gitlist.qtpl:15
+//line gitlist.qtpl:17
for _, r := range p.Respositories {
-//line gitlist.qtpl:15
+//line gitlist.qtpl:17
qw422016.N().S(`
<div class="event">
<h4>
<a href="/`)
-//line gitlist.qtpl:18
+//line gitlist.qtpl:20
qw422016.E().S(r.Name)
-//line gitlist.qtpl:18
+//line gitlist.qtpl:20
qw422016.N().S(`">`)
-//line gitlist.qtpl:18
+//line gitlist.qtpl:20
qw422016.E().S(r.Name)
-//line gitlist.qtpl:18
+//line gitlist.qtpl:20
qw422016.N().S(`</a>
</h4>
</hr>
<p>`)
-//line gitlist.qtpl:21
+//line gitlist.qtpl:23
qw422016.E().S(r.LastCommitMessage)
-//line gitlist.qtpl:21
+//line gitlist.qtpl:23
qw422016.N().S(`</p>
<p><small>`)
-//line gitlist.qtpl:22
+//line gitlist.qtpl:24
qw422016.E().S(r.LastCommitDate)
-//line gitlist.qtpl:22
+//line gitlist.qtpl:24
qw422016.N().S(`</small></p>
</div>
`)
-//line gitlist.qtpl:24
+//line gitlist.qtpl:26
}
-//line gitlist.qtpl:24
+//line gitlist.qtpl:26
qw422016.N().S(`
</div>
`)
-//line gitlist.qtpl:26
+//line gitlist.qtpl:28
}
-//line gitlist.qtpl:26
+//line gitlist.qtpl:28
func (p *GitListPage) WriteContent(qq422016 qtio422016.Writer) {
-//line gitlist.qtpl:26
+//line gitlist.qtpl:28
qw422016 := qt422016.AcquireWriter(qq422016)
-//line gitlist.qtpl:26
+//line gitlist.qtpl:28
p.StreamContent(qw422016)
-//line gitlist.qtpl:26
+//line gitlist.qtpl:28
qt422016.ReleaseWriter(qw422016)
-//line gitlist.qtpl:26
+//line gitlist.qtpl:28
}
-//line gitlist.qtpl:26
+//line gitlist.qtpl:28
func (p *GitListPage) Content() string {
-//line gitlist.qtpl:26
+//line gitlist.qtpl:28
qb422016 := qt422016.AcquireByteBuffer()
-//line gitlist.qtpl:26
+//line gitlist.qtpl:28
p.WriteContent(qb422016)
-//line gitlist.qtpl:26
+//line gitlist.qtpl:28
qs422016 := string(qb422016.B)
-//line gitlist.qtpl:26
+//line gitlist.qtpl:28
qt422016.ReleaseByteBuffer(qb422016)
-//line gitlist.qtpl:26
+//line gitlist.qtpl:28
return qs422016
-//line gitlist.qtpl:26
+//line gitlist.qtpl:28
}
// </div>
// </div>
//
-//line gitlist.qtpl:30
+//line gitlist.qtpl:32
func (p *GitListPage) StreamScript(qw422016 *qt422016.Writer) {
-//line gitlist.qtpl:30
+//line gitlist.qtpl:32
qw422016.N().S(`
`)
-//line gitlist.qtpl:31
+//line gitlist.qtpl:33
}
-//line gitlist.qtpl:31
+//line gitlist.qtpl:33
func (p *GitListPage) WriteScript(qq422016 qtio422016.Writer) {
-//line gitlist.qtpl:31
+//line gitlist.qtpl:33
qw422016 := qt422016.AcquireWriter(qq422016)
-//line gitlist.qtpl:31
+//line gitlist.qtpl:33
p.StreamScript(qw422016)
-//line gitlist.qtpl:31
+//line gitlist.qtpl:33
qt422016.ReleaseWriter(qw422016)
-//line gitlist.qtpl:31
+//line gitlist.qtpl:33
}
-//line gitlist.qtpl:31
+//line gitlist.qtpl:33
func (p *GitListPage) Script() string {
-//line gitlist.qtpl:31
+//line gitlist.qtpl:33
qb422016 := qt422016.AcquireByteBuffer()
-//line gitlist.qtpl:31
+//line gitlist.qtpl:33
p.WriteScript(qb422016)
-//line gitlist.qtpl:31
+//line gitlist.qtpl:33
qs422016 := string(qb422016.B)
-//line gitlist.qtpl:31
+//line gitlist.qtpl:33
qt422016.ReleaseByteBuffer(qb422016)
-//line gitlist.qtpl:31
+//line gitlist.qtpl:33
return qs422016
-//line gitlist.qtpl:31
+//line gitlist.qtpl:33
}
diff --git a/templates/helloworld.qtpl b/templates/helloworld.qtpl
deleted file mode 100644
index 1785bb5..0000000
--- a/templates/helloworld.qtpl
+++ /dev/null
@@ -1,14 +0,0 @@
-{% code
-type HelloPage struct {
- Body []byte
-}
-%}
-
-{% func (p *HelloPage) Title() %}Hello{% endfunc %}
-
-{% func (p *HelloPage) Content() %}
-{%z= p.Body %}
-{% endfunc %}
-
-{% func (p *HelloPage) Script() %}
-{% endfunc %}
diff --git a/templates/helloworld.qtpl.go b/templates/helloworld.qtpl.go
deleted file mode 100644
index 7e37f3b..0000000
--- a/templates/helloworld.qtpl.go
+++ /dev/null
@@ -1,129 +0,0 @@
-// Code generated by qtc from "helloworld.qtpl". DO NOT EDIT.
-// See https://github.com/valyala/quicktemplate for details.
-
-//line helloworld.qtpl:1
-package templates
-
-//line helloworld.qtpl:1
-import (
- qtio422016 "io"
-
- qt422016 "github.com/valyala/quicktemplate"
-)
-
-//line helloworld.qtpl:1
-var (
- _ = qtio422016.Copy
- _ = qt422016.AcquireByteBuffer
-)
-
-//line helloworld.qtpl:2
-type HelloPage struct {
- Body []byte
-}
-
-//line helloworld.qtpl:7
-func (p *HelloPage) StreamTitle(qw422016 *qt422016.Writer) {
-//line helloworld.qtpl:7
- qw422016.N().S(`Hello`)
-//line helloworld.qtpl:7
-}
-
-//line helloworld.qtpl:7
-func (p *HelloPage) WriteTitle(qq422016 qtio422016.Writer) {
-//line helloworld.qtpl:7
- qw422016 := qt422016.AcquireWriter(qq422016)
-//line helloworld.qtpl:7
- p.StreamTitle(qw422016)
-//line helloworld.qtpl:7
- qt422016.ReleaseWriter(qw422016)
-//line helloworld.qtpl:7
-}
-
-//line helloworld.qtpl:7
-func (p *HelloPage) Title() string {
-//line helloworld.qtpl:7
- qb422016 := qt422016.AcquireByteBuffer()
-//line helloworld.qtpl:7
- p.WriteTitle(qb422016)
-//line helloworld.qtpl:7
- qs422016 := string(qb422016.B)
-//line helloworld.qtpl:7
- qt422016.ReleaseByteBuffer(qb422016)
-//line helloworld.qtpl:7
- return qs422016
-//line helloworld.qtpl:7
-}
-
-//line helloworld.qtpl:9
-func (p *HelloPage) StreamContent(qw422016 *qt422016.Writer) {
-//line helloworld.qtpl:9
- qw422016.N().S(`
-`)
-//line helloworld.qtpl:10
- qw422016.N().Z(p.Body)
-//line helloworld.qtpl:10
- qw422016.N().S(`
-`)
-//line helloworld.qtpl:11
-}
-
-//line helloworld.qtpl:11
-func (p *HelloPage) WriteContent(qq422016 qtio422016.Writer) {
-//line helloworld.qtpl:11
- qw422016 := qt422016.AcquireWriter(qq422016)
-//line helloworld.qtpl:11
- p.StreamContent(qw422016)
-//line helloworld.qtpl:11
- qt422016.ReleaseWriter(qw422016)
-//line helloworld.qtpl:11
-}
-
-//line helloworld.qtpl:11
-func (p *HelloPage) Content() string {
-//line helloworld.qtpl:11
- qb422016 := qt422016.AcquireByteBuffer()
-//line helloworld.qtpl:11
- p.WriteContent(qb422016)
-//line helloworld.qtpl:11
- qs422016 := string(qb422016.B)
-//line helloworld.qtpl:11
- qt422016.ReleaseByteBuffer(qb422016)
-//line helloworld.qtpl:11
- return qs422016
-//line helloworld.qtpl:11
-}
-
-//line helloworld.qtpl:13
-func (p *HelloPage) StreamScript(qw422016 *qt422016.Writer) {
-//line helloworld.qtpl:13
- qw422016.N().S(`
-`)
-//line helloworld.qtpl:14
-}
-
-//line helloworld.qtpl:14
-func (p *HelloPage) WriteScript(qq422016 qtio422016.Writer) {
-//line helloworld.qtpl:14
- qw422016 := qt422016.AcquireWriter(qq422016)
-//line helloworld.qtpl:14
- p.StreamScript(qw422016)
-//line helloworld.qtpl:14
- qt422016.ReleaseWriter(qw422016)
-//line helloworld.qtpl:14
-}
-
-//line helloworld.qtpl:14
-func (p *HelloPage) Script() string {
-//line helloworld.qtpl:14
- qb422016 := qt422016.AcquireByteBuffer()
-//line helloworld.qtpl:14
- p.WriteScript(qb422016)
-//line helloworld.qtpl:14
- qs422016 := string(qb422016.B)
-//line helloworld.qtpl:14
- qt422016.ReleaseByteBuffer(qb422016)
-//line helloworld.qtpl:14
- return qs422016
-//line helloworld.qtpl:14
-}
diff --git a/templates/navbar.qtpl b/templates/navbar.qtpl
new file mode 100644
index 0000000..26991a3
--- /dev/null
+++ b/templates/navbar.qtpl
@@ -0,0 +1,23 @@
+{% code
+type Selection int
+const (
+ Git Selection = iota
+ List
+ About
+ Config
+)
+%}
+
+{% func insertIfEqual(s, d Selection) %}{% if s == d %} selected{% endif %}{% endfunc %}
+
+
+{% func Navbar (s Selection) %}
+ <nav class="container navbar navbar-expand-sm">
+ <div class="navbar-nav">
+ <a class="nav-link{%= insertIfEqual(s, Git) %}" href="/git">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 %}
diff --git a/templates/navbar.qtpl.go b/templates/navbar.qtpl.go
new file mode 100644
index 0000000..e2b738c
--- /dev/null
+++ b/templates/navbar.qtpl.go
@@ -0,0 +1,123 @@
+// Code generated by qtc from "navbar.qtpl". DO NOT EDIT.
+// See https://github.com/valyala/quicktemplate for details.
+
+//line navbar.qtpl:1
+package templates
+
+//line navbar.qtpl:1
+import (
+ qtio422016 "io"
+
+ qt422016 "github.com/valyala/quicktemplate"
+)
+
+//line navbar.qtpl:1
+var (
+ _ = qtio422016.Copy
+ _ = qt422016.AcquireByteBuffer
+)
+
+//line navbar.qtpl:2
+type Selection int
+
+const (
+ Git Selection = iota
+ List
+ About
+ Config
+)
+
+//line navbar.qtpl:11
+func streaminsertIfEqual(qw422016 *qt422016.Writer, s, d Selection) {
+//line navbar.qtpl:11
+ if s == d {
+//line navbar.qtpl:11
+ qw422016.N().S(` selected`)
+//line navbar.qtpl:11
+ }
+//line navbar.qtpl:11
+}
+
+//line navbar.qtpl:11
+func writeinsertIfEqual(qq422016 qtio422016.Writer, s, d Selection) {
+//line navbar.qtpl:11
+ qw422016 := qt422016.AcquireWriter(qq422016)
+//line navbar.qtpl:11
+ streaminsertIfEqual(qw422016, s, d)
+//line navbar.qtpl:11
+ qt422016.ReleaseWriter(qw422016)
+//line navbar.qtpl:11
+}
+
+//line navbar.qtpl:11
+func insertIfEqual(s, d Selection) string {
+//line navbar.qtpl:11
+ qb422016 := qt422016.AcquireByteBuffer()
+//line navbar.qtpl:11
+ writeinsertIfEqual(qb422016, s, d)
+//line navbar.qtpl:11
+ qs422016 := string(qb422016.B)
+//line navbar.qtpl:11
+ qt422016.ReleaseByteBuffer(qb422016)
+//line navbar.qtpl:11
+ return qs422016
+//line navbar.qtpl:11
+}
+
+//line navbar.qtpl:14
+func StreamNavbar(qw422016 *qt422016.Writer, s Selection) {
+//line navbar.qtpl:14
+ qw422016.N().S(`
+ <nav class="container navbar navbar-expand-sm">
+ <div class="navbar-nav">
+ <a class="nav-link`)
+//line navbar.qtpl:17
+ streaminsertIfEqual(qw422016, s, Git)
+//line navbar.qtpl:17
+ qw422016.N().S(`" href="/git">git</a>
+ <a class="nav-link`)
+//line navbar.qtpl:18
+ streaminsertIfEqual(qw422016, s, List)
+//line navbar.qtpl:18
+ qw422016.N().S(`" href="/list">list</a>
+ <a class="nav-link`)
+//line navbar.qtpl:19
+ streaminsertIfEqual(qw422016, s, About)
+//line navbar.qtpl:19
+ qw422016.N().S(`" href="/about">about</a>
+ <a class="nav-link`)
+//line navbar.qtpl:20
+ streaminsertIfEqual(qw422016, s, Config)
+//line navbar.qtpl:20
+ qw422016.N().S(`" href="/config">config</a>
+ </div>
+ </nav>
+`)
+//line navbar.qtpl:23
+}
+
+//line navbar.qtpl:23
+func WriteNavbar(qq422016 qtio422016.Writer, s Selection) {
+//line navbar.qtpl:23
+ qw422016 := qt422016.AcquireWriter(qq422016)
+//line navbar.qtpl:23
+ StreamNavbar(qw422016, s)
+//line navbar.qtpl:23
+ qt422016.ReleaseWriter(qw422016)
+//line navbar.qtpl:23
+}
+
+//line navbar.qtpl:23
+func Navbar(s Selection) string {
+//line navbar.qtpl:23
+ qb422016 := qt422016.AcquireByteBuffer()
+//line navbar.qtpl:23
+ WriteNavbar(qb422016, s)
+//line navbar.qtpl:23
+ qs422016 := string(qb422016.B)
+//line navbar.qtpl:23
+ qt422016.ReleaseByteBuffer(qb422016)
+//line navbar.qtpl:23
+ return qs422016
+//line navbar.qtpl:23
+}