diff --git a/Makefile b/Makefile
index 38db3a9c283ce4cd2538f1fc454111ed9ff12035..61df8351f7c79059ecf9ef2db0351c527b37e023 100644
--- a/Makefile
+++ b/Makefile
@@ -1,5 +1,3 @@
-.ONESHELL:
-
build: sass tmpl
go build -o bin/cerrado
@@ -10,10 +8,12 @@ test:
go test -v --tags=unit ./...
sass:
- @make -p static
+ @mkdir -p static
sassc \
-I scss scss/main.scss static/main.css
tmpl:
- cd ./templates
+ cd ./templates && \
qtc *
+
+.PHONY: sass
diff --git a/main.go b/main.go
index 3d6411d1c2cac54353b520600f1ffe6fa21054b3..d2452e8a5766b22174b55f2ffbdcd2bc2149a954 100644
--- a/main.go
+++ b/main.go
@@ -5,6 +5,7 @@ "bytes"
"context"
"encoding/json"
"flag"
+ "io/fs"
"log/slog"
"net/http"
"os"
@@ -17,6 +18,7 @@ "github.com/alecthomas/chroma/v2/styles"
"git.gabrielgio.me/cerrado/pkg/config"
"git.gabrielgio.me/cerrado/pkg/worker"
+ "git.gabrielgio.me/cerrado/static"
"git.gabrielgio.me/cerrado/templates"
)
@@ -25,6 +27,7 @@
ctx, stop := signal.NotifyContext(context.Background(), os.Interrupt, os.Kill)
defer stop()
if err := run(ctx); err != nil {
+ slog.Error("Error", "error", err)
os.Exit(1)
}
}
@@ -37,6 +40,13 @@
flag.Parse()
mux := http.NewServeMux()
+
+ staticFs, err := fs.Sub(static.Static, ".")
+ if err != nil {
+ return err
+ }
+
+ mux.Handle("/static/", http.StripPrefix("/static/", http.FileServer(http.FS(staticFs))))
mux.HandleFunc("/", func(w http.ResponseWriter, _ *http.Request) {
slog.Info("Handling index")
diff --git a/scss/main.scss b/scss/main.scss
index ae493855c99c453d9ac962645ce58497402ac5b2..7273c9f36be42a2a85fa8774639400a13bb7668a 100644
--- a/scss/main.scss
+++ b/scss/main.scss
@@ -1,3 +1,4 @@
+
@import "bootstrap/scss/_functions.scss";
@import "bootstrap/scss/_variables.scss";
@import "bootstrap/scss/_variables-dark.scss";
@@ -7,3 +8,12 @@ @import "bootstrap/scss/_utilities.scss";
@import "bootstrap/scss/_root.scss";
+@import "bootstrap/scss/_containers.scss";
+@import "bootstrap/scss/_nav.scss";
+@import "bootstrap/scss/_navbar.scss";
+
+
+body {
+ font-family: $font-family-monospace;
+
+}
diff --git a/templates/base.qtpl b/templates/base.qtpl
index 1683981b506d0ed3e46c9331cc1841189422929a..6bef9863b93963da9f9b9cc854c830a3757b6c66 100644
--- a/templates/base.qtpl
+++ b/templates/base.qtpl
@@ -25,12 +25,22 @@ {% func PageTemplate(p Page) %}
<html lang="en">
<head>
<meta charset="utf-8">
- <title>img | {%= p.Title() %}</title>
+ <title>cerrado | {%= p.Title() %}</title>
<link rel="stylesheet" href="/static/main.css">
<meta name="viewport" content="width=device-width, initial-scale=1" />
</head>
<body>
- <div>
+ <nav class="navbar navbar-expand bg-body-tertiary">
+ <div class="container-fluid">
+ <div class="collapse navbar-collapse">
+ <div class="navbar-nav">
+ <a class="nav-link" href="/git">git</a>
+ <a class="nav-link" href="/list">list</a>
+ </div>
+ </div>
+ </div>
+ </nav>
+ <div class="container">
{%= p.Content() %}
</div>
</body>
diff --git a/templates/base.qtpl.go b/templates/base.qtpl.go
index 8d93fa82b1607475b09d4077628d6598b628af6e..ffee940f7a00b30ecf95ca6d7fa2bce970300ead 100644
--- a/templates/base.qtpl.go
+++ b/templates/base.qtpl.go
@@ -63,7 +63,7 @@ qw422016.N().S(`
<html lang="en">
<head>
<meta charset="utf-8">
- <title>img | `)
+ <title>cerrado | `)
//line base.qtpl:28
p.StreamTitle(qw422016)
//line base.qtpl:28
@@ -72,146 +72,156 @@ <link rel="stylesheet" href="/static/main.css">
<meta name="viewport" content="width=device-width, initial-scale=1" />
</head>
<body>
- <div>
+ <nav class="navbar navbar-expand bg-body-tertiary">
+ <div class="container-fluid">
+ <div class="collapse navbar-collapse">
+ <div class="navbar-nav">
+ <a class="nav-link" href="/git">git</a>
+ <a class="nav-link" href="/list">list</a>
+ </div>
+ </div>
+ </div>
+ </nav>
+ <div class="container">
`)
-//line base.qtpl:34
+//line base.qtpl:44
p.StreamContent(qw422016)
-//line base.qtpl:34
+//line base.qtpl:44
qw422016.N().S(`
</div>
</body>
`)
-//line base.qtpl:37
+//line base.qtpl:47
p.StreamScript(qw422016)
-//line base.qtpl:37
+//line base.qtpl:47
qw422016.N().S(`
</html>
`)
-//line base.qtpl:39
+//line base.qtpl:49
}
-//line base.qtpl:39
+//line base.qtpl:49
func WritePageTemplate(qq422016 qtio422016.Writer, p Page) {
-//line base.qtpl:39
+//line base.qtpl:49
qw422016 := qt422016.AcquireWriter(qq422016)
-//line base.qtpl:39
+//line base.qtpl:49
StreamPageTemplate(qw422016, p)
-//line base.qtpl:39
+//line base.qtpl:49
qt422016.ReleaseWriter(qw422016)
-//line base.qtpl:39
+//line base.qtpl:49
}
-//line base.qtpl:39
+//line base.qtpl:49
func PageTemplate(p Page) string {
-//line base.qtpl:39
+//line base.qtpl:49
qb422016 := qt422016.AcquireByteBuffer()
-//line base.qtpl:39
+//line base.qtpl:49
WritePageTemplate(qb422016, p)
-//line base.qtpl:39
+//line base.qtpl:49
qs422016 := string(qb422016.B)
-//line base.qtpl:39
+//line base.qtpl:49
qt422016.ReleaseByteBuffer(qb422016)
-//line base.qtpl:39
+//line base.qtpl:49
return qs422016
-//line base.qtpl:39
+//line base.qtpl:49
}
-//line base.qtpl:41
+//line base.qtpl:51
type BasePage struct{}
-//line base.qtpl:42
+//line base.qtpl:52
func (p *BasePage) StreamTitle(qw422016 *qt422016.Writer) {
-//line base.qtpl:42
+//line base.qtpl:52
qw422016.N().S(`Empty`)
-//line base.qtpl:42
+//line base.qtpl:52
}
-//line base.qtpl:42
+//line base.qtpl:52
func (p *BasePage) WriteTitle(qq422016 qtio422016.Writer) {
-//line base.qtpl:42
+//line base.qtpl:52
qw422016 := qt422016.AcquireWriter(qq422016)
-//line base.qtpl:42
+//line base.qtpl:52
p.StreamTitle(qw422016)
-//line base.qtpl:42
+//line base.qtpl:52
qt422016.ReleaseWriter(qw422016)
-//line base.qtpl:42
+//line base.qtpl:52
}
-//line base.qtpl:42
+//line base.qtpl:52
func (p *BasePage) Title() string {
-//line base.qtpl:42
+//line base.qtpl:52
qb422016 := qt422016.AcquireByteBuffer()
-//line base.qtpl:42
+//line base.qtpl:52
p.WriteTitle(qb422016)
-//line base.qtpl:42
+//line base.qtpl:52
qs422016 := string(qb422016.B)
-//line base.qtpl:42
+//line base.qtpl:52
qt422016.ReleaseByteBuffer(qb422016)
-//line base.qtpl:42
+//line base.qtpl:52
return qs422016
-//line base.qtpl:42
+//line base.qtpl:52
}
-//line base.qtpl:43
+//line base.qtpl:53
func (p *BasePage) StreamBody(qw422016 *qt422016.Writer) {
-//line base.qtpl:43
+//line base.qtpl:53
qw422016.N().S(`HelloWorld`)
-//line base.qtpl:43
+//line base.qtpl:53
}
-//line base.qtpl:43
+//line base.qtpl:53
func (p *BasePage) WriteBody(qq422016 qtio422016.Writer) {
-//line base.qtpl:43
+//line base.qtpl:53
qw422016 := qt422016.AcquireWriter(qq422016)
-//line base.qtpl:43
+//line base.qtpl:53
p.StreamBody(qw422016)
-//line base.qtpl:43
+//line base.qtpl:53
qt422016.ReleaseWriter(qw422016)
-//line base.qtpl:43
+//line base.qtpl:53
}
-//line base.qtpl:43
+//line base.qtpl:53
func (p *BasePage) Body() string {
-//line base.qtpl:43
+//line base.qtpl:53
qb422016 := qt422016.AcquireByteBuffer()
-//line base.qtpl:43
+//line base.qtpl:53
p.WriteBody(qb422016)
-//line base.qtpl:43
+//line base.qtpl:53
qs422016 := string(qb422016.B)
-//line base.qtpl:43
+//line base.qtpl:53
qt422016.ReleaseByteBuffer(qb422016)
-//line base.qtpl:43
+//line base.qtpl:53
return qs422016
-//line base.qtpl:43
+//line base.qtpl:53
}
-//line base.qtpl:44
+//line base.qtpl:54
func (p *BasePage) StreamScript(qw422016 *qt422016.Writer) {
-//line base.qtpl:44
+//line base.qtpl:54
}
-//line base.qtpl:44
+//line base.qtpl:54
func (p *BasePage) WriteScript(qq422016 qtio422016.Writer) {
-//line base.qtpl:44
+//line base.qtpl:54
qw422016 := qt422016.AcquireWriter(qq422016)
-//line base.qtpl:44
+//line base.qtpl:54
p.StreamScript(qw422016)
-//line base.qtpl:44
+//line base.qtpl:54
qt422016.ReleaseWriter(qw422016)
-//line base.qtpl:44
+//line base.qtpl:54
}
-//line base.qtpl:44
+//line base.qtpl:54
func (p *BasePage) Script() string {
-//line base.qtpl:44
+//line base.qtpl:54
qb422016 := qt422016.AcquireByteBuffer()
-//line base.qtpl:44
+//line base.qtpl:54
p.WriteScript(qb422016)
-//line base.qtpl:44
+//line base.qtpl:54
qs422016 := string(qb422016.B)
-//line base.qtpl:44
+//line base.qtpl:54
qt422016.ReleaseByteBuffer(qb422016)
-//line base.qtpl:44
+//line base.qtpl:54
return qs422016
-//line base.qtpl:44
+//line base.qtpl:54
}