aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGabriel A. Giovanini <mail@gabrielgio.me>2024-05-26 21:40:22 +0200
committerGabriel A. Giovanini <mail@gabrielgio.me>2024-05-26 21:40:22 +0200
commitadc207d2e6c39fa31283d83021e76300c0099c37 (patch)
tree3131b1353028d81e71055a4bf87a15c8427d86c5
parent4534dffb865eb1a50bfbc291a5c3798183081caf (diff)
downloadcerrado-adc207d2e6c39fa31283d83021e76300c0099c37.tar.gz
cerrado-adc207d2e6c39fa31283d83021e76300c0099c37.tar.bz2
cerrado-adc207d2e6c39fa31283d83021e76300c0099c37.zip
feat: Simplify listing
-rw-r--r--scss/main.scss39
-rw-r--r--templates/base.qtpl15
-rw-r--r--templates/base.qtpl.go139
-rw-r--r--templates/gitlist.qtpl30
-rw-r--r--templates/gitlist.qtpl.go183
5 files changed, 204 insertions, 202 deletions
diff --git a/scss/main.scss b/scss/main.scss
index 26218e8..ac8d2c4 100644
--- a/scss/main.scss
+++ b/scss/main.scss
@@ -1,8 +1,9 @@
-//$card-border-width: 0;
-$card-border-radius: 0;
-$card-cap-padding-y: 0;
-$card-cap-padding-x: 5px;
-$card-group-margin: 10 px;
+// disable gutter
+$grid-gutter-width: 0;
+
+$base-font-size: 1rem;
+$font_family_monospace: monospace;
+$headings-margin-bottom: 0;
// basic functionality
@import "bootstrap/scss/_functions.scss";
@@ -17,7 +18,6 @@ $card-group-margin: 10 px;
@import "bootstrap/scss/_containers.scss";
@import "bootstrap/scss/_nav.scss";
@import "bootstrap/scss/_navbar.scss";
-@import "bootstrap/scss/_card.scss";
@import "bootstrap/scss/_grid.scss";
@@ -29,3 +29,30 @@ body {
.card-body {
padding: 5px;
}
+
+.navbar-nav {
+ margin-top: 0px
+}
+
+.event-list {
+ margin-bottom: 1rem;
+}
+
+.event:first-child {
+ margin-top: 0;
+}
+
+.event {
+ text-overflow: ellipsis;
+ overflow: hidden;
+ padding: 0.5rem;
+ margin: 0.5rem 0;
+ background: #f8f9fa;
+}
+
+.event > h4 {
+ margin: 0;
+}
+.event > p {
+ margin: 0.5rem 0;
+}
diff --git a/templates/base.qtpl b/templates/base.qtpl
index df6c6fc..6654f42 100644
--- a/templates/base.qtpl
+++ b/templates/base.qtpl
@@ -31,15 +31,12 @@ Page prints a page implementing Page interface.
<meta name="viewport" content="width=device-width, initial-scale=1" />
</head>
<body>
- <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 class="container navbar navbar-expand-sm">
+ <ul class="navbar-nav">
+ <li class="nav-link" href="/git">git</li>
+ <li class="nav-link" href="/list">list</li>
+ <li class="nav-link" href="/about">about</li>
+ </ul>
</nav>
<div class="container">
{%= p.Content() %}
diff --git a/templates/base.qtpl.go b/templates/base.qtpl.go
index f78744d..2573b99 100644
--- a/templates/base.qtpl.go
+++ b/templates/base.qtpl.go
@@ -73,156 +73,153 @@ func StreamPageTemplate(qw422016 *qt422016.Writer, p Page) {
<meta name="viewport" content="width=device-width, initial-scale=1" />
</head>
<body>
- <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 class="container navbar navbar-expand-sm">
+ <ul class="navbar-nav">
+ <li class="nav-link" href="/git">git</li>
+ <li class="nav-link" href="/list">list</li>
+ <li class="nav-link" href="/about">about</li>
+ </ul>
</nav>
<div class="container">
`)
-//line base.qtpl:45
+//line base.qtpl:42
p.StreamContent(qw422016)
-//line base.qtpl:45
+//line base.qtpl:42
qw422016.N().S(`
</div>
</body>
`)
-//line base.qtpl:48
+//line base.qtpl:45
p.StreamScript(qw422016)
-//line base.qtpl:48
+//line base.qtpl:45
qw422016.N().S(`
</html>
`)
-//line base.qtpl:50
+//line base.qtpl:47
}
-//line base.qtpl:50
+//line base.qtpl:47
func WritePageTemplate(qq422016 qtio422016.Writer, p Page) {
-//line base.qtpl:50
+//line base.qtpl:47
qw422016 := qt422016.AcquireWriter(qq422016)
-//line base.qtpl:50
+//line base.qtpl:47
StreamPageTemplate(qw422016, p)
-//line base.qtpl:50
+//line base.qtpl:47
qt422016.ReleaseWriter(qw422016)
-//line base.qtpl:50
+//line base.qtpl:47
}
-//line base.qtpl:50
+//line base.qtpl:47
func PageTemplate(p Page) string {
-//line base.qtpl:50
+//line base.qtpl:47
qb422016 := qt422016.AcquireByteBuffer()
-//line base.qtpl:50
+//line base.qtpl:47
WritePageTemplate(qb422016, p)
-//line base.qtpl:50
+//line base.qtpl:47
qs422016 := string(qb422016.B)
-//line base.qtpl:50
+//line base.qtpl:47
qt422016.ReleaseByteBuffer(qb422016)
-//line base.qtpl:50
+//line base.qtpl:47
return qs422016
-//line base.qtpl:50
+//line base.qtpl:47
}
-//line base.qtpl:52
+//line base.qtpl:49
type BasePage struct{}
-//line base.qtpl:53
+//line base.qtpl:50
func (p *BasePage) StreamTitle(qw422016 *qt422016.Writer) {
-//line base.qtpl:53
+//line base.qtpl:50
qw422016.N().S(`Empty`)
-//line base.qtpl:53
+//line base.qtpl:50
}
-//line base.qtpl:53
+//line base.qtpl:50
func (p *BasePage) WriteTitle(qq422016 qtio422016.Writer) {
-//line base.qtpl:53
+//line base.qtpl:50
qw422016 := qt422016.AcquireWriter(qq422016)
-//line base.qtpl:53
+//line base.qtpl:50
p.StreamTitle(qw422016)
-//line base.qtpl:53
+//line base.qtpl:50
qt422016.ReleaseWriter(qw422016)
-//line base.qtpl:53
+//line base.qtpl:50
}
-//line base.qtpl:53
+//line base.qtpl:50
func (p *BasePage) Title() string {
-//line base.qtpl:53
+//line base.qtpl:50
qb422016 := qt422016.AcquireByteBuffer()
-//line base.qtpl:53
+//line base.qtpl:50
p.WriteTitle(qb422016)
-//line base.qtpl:53
+//line base.qtpl:50
qs422016 := string(qb422016.B)
-//line base.qtpl:53
+//line base.qtpl:50
qt422016.ReleaseByteBuffer(qb422016)
-//line base.qtpl:53
+//line base.qtpl:50
return qs422016
-//line base.qtpl:53
+//line base.qtpl:50
}
-//line base.qtpl:54
+//line base.qtpl:51
func (p *BasePage) StreamBody(qw422016 *qt422016.Writer) {
-//line base.qtpl:54
+//line base.qtpl:51
qw422016.N().S(`HelloWorld`)
-//line base.qtpl:54
+//line base.qtpl:51
}
-//line base.qtpl:54
+//line base.qtpl:51
func (p *BasePage) WriteBody(qq422016 qtio422016.Writer) {
-//line base.qtpl:54
+//line base.qtpl:51
qw422016 := qt422016.AcquireWriter(qq422016)
-//line base.qtpl:54
+//line base.qtpl:51
p.StreamBody(qw422016)
-//line base.qtpl:54
+//line base.qtpl:51
qt422016.ReleaseWriter(qw422016)
-//line base.qtpl:54
+//line base.qtpl:51
}
-//line base.qtpl:54
+//line base.qtpl:51
func (p *BasePage) Body() string {
-//line base.qtpl:54
+//line base.qtpl:51
qb422016 := qt422016.AcquireByteBuffer()
-//line base.qtpl:54
+//line base.qtpl:51
p.WriteBody(qb422016)
-//line base.qtpl:54
+//line base.qtpl:51
qs422016 := string(qb422016.B)
-//line base.qtpl:54
+//line base.qtpl:51
qt422016.ReleaseByteBuffer(qb422016)
-//line base.qtpl:54
+//line base.qtpl:51
return qs422016
-//line base.qtpl:54
+//line base.qtpl:51
}
-//line base.qtpl:55
+//line base.qtpl:52
func (p *BasePage) StreamScript(qw422016 *qt422016.Writer) {
-//line base.qtpl:55
+//line base.qtpl:52
}
-//line base.qtpl:55
+//line base.qtpl:52
func (p *BasePage) WriteScript(qq422016 qtio422016.Writer) {
-//line base.qtpl:55
+//line base.qtpl:52
qw422016 := qt422016.AcquireWriter(qq422016)
-//line base.qtpl:55
+//line base.qtpl:52
p.StreamScript(qw422016)
-//line base.qtpl:55
+//line base.qtpl:52
qt422016.ReleaseWriter(qw422016)
-//line base.qtpl:55
+//line base.qtpl:52
}
-//line base.qtpl:55
+//line base.qtpl:52
func (p *BasePage) Script() string {
-//line base.qtpl:55
+//line base.qtpl:52
qb422016 := qt422016.AcquireByteBuffer()
-//line base.qtpl:55
+//line base.qtpl:52
p.WriteScript(qb422016)
-//line base.qtpl:55
+//line base.qtpl:52
qs422016 := string(qb422016.B)
-//line base.qtpl:55
+//line base.qtpl:52
qt422016.ReleaseByteBuffer(qb422016)
-//line base.qtpl:55
+//line base.qtpl:52
return qs422016
-//line base.qtpl:55
+//line base.qtpl:52
}
diff --git a/templates/gitlist.qtpl b/templates/gitlist.qtpl
index 84a42f9..fef9126 100644
--- a/templates/gitlist.qtpl
+++ b/templates/gitlist.qtpl
@@ -1,6 +1,4 @@
{% import "git.gabrielgio.me/cerrado/pkg/service" %}
-{% import "git.gabrielgio.me/cerrado/pkg/u" %}
-
{% code
type GitListPage struct {
@@ -11,27 +9,23 @@ type GitListPage struct {
{% func (p *GitListPage) Title() %}Git | List{% endfunc %}
{% func (p *GitListPage) Content() %}
-{% for _, c := range u.ChunkBy(p.Respositories, 3) %}
<div class="row">
- {% for _, r := range c %}
- <div class="col-md g-1">
- <div class="card">
- <div class="card-header">
- <a href="/{%s r.Name %}" class="btn btn-primary">{%s r.Title %}</a>
- </div>
- <div class="card-body">
- <p class="card-text lead">{%s r.LastCommitMessage %}</p>
- <p class="card-text"><small>{%s r.LastCommitDate %}</small></p>
- <a href="#" class="card-link">summary</a>
- <a href="#" class="card-link">log</a>
- <a href="#" class="card-link">tree</a>
+ <div class="col-md-8 offset-md-2">
+ <div class="event-list">
+ {% for _, r := range p.Respositories %}
+ <div class="event">
+ <h4>
+ <a href="/{%s r.Name %}">{%s r.Name %}</a>
+ </h4>
+ </hr>
+ <p>{%s r.LastCommitMessage %}</p>
+ <p><small>{%s r.LastCommitDate %}</small></p>
</div>
+ {% endfor %}
</div>
+ {% endfunc %}
</div>
- {% endfor %}
</div>
-{% endfor %}
-{% endfunc %}
{% func (p *GitListPage) Script() %}
{% endfunc %}
diff --git a/templates/gitlist.qtpl.go b/templates/gitlist.qtpl.go
index d16b8d5..89d1d71 100644
--- a/templates/gitlist.qtpl.go
+++ b/templates/gitlist.qtpl.go
@@ -7,176 +7,163 @@ package templates
//line gitlist.qtpl:1
import "git.gabrielgio.me/cerrado/pkg/service"
-//line gitlist.qtpl:2
-import "git.gabrielgio.me/cerrado/pkg/u"
-
-//line gitlist.qtpl:5
+//line gitlist.qtpl:3
import (
qtio422016 "io"
qt422016 "github.com/valyala/quicktemplate"
)
-//line gitlist.qtpl:5
+//line gitlist.qtpl:3
var (
_ = qtio422016.Copy
_ = qt422016.AcquireByteBuffer
)
-//line gitlist.qtpl:6
+//line gitlist.qtpl:4
type GitListPage struct {
Respositories []*service.Repository
}
-//line gitlist.qtpl:11
+//line gitlist.qtpl:9
func (p *GitListPage) StreamTitle(qw422016 *qt422016.Writer) {
-//line gitlist.qtpl:11
+//line gitlist.qtpl:9
qw422016.N().S(`Git | List`)
-//line gitlist.qtpl:11
+//line gitlist.qtpl:9
}
-//line gitlist.qtpl:11
+//line gitlist.qtpl:9
func (p *GitListPage) WriteTitle(qq422016 qtio422016.Writer) {
-//line gitlist.qtpl:11
+//line gitlist.qtpl:9
qw422016 := qt422016.AcquireWriter(qq422016)
-//line gitlist.qtpl:11
+//line gitlist.qtpl:9
p.StreamTitle(qw422016)
-//line gitlist.qtpl:11
+//line gitlist.qtpl:9
qt422016.ReleaseWriter(qw422016)
-//line gitlist.qtpl:11
+//line gitlist.qtpl:9
}
-//line gitlist.qtpl:11
+//line gitlist.qtpl:9
func (p *GitListPage) Title() string {
-//line gitlist.qtpl:11
+//line gitlist.qtpl:9
qb422016 := qt422016.AcquireByteBuffer()
-//line gitlist.qtpl:11
+//line gitlist.qtpl:9
p.WriteTitle(qb422016)
-//line gitlist.qtpl:11
+//line gitlist.qtpl:9
qs422016 := string(qb422016.B)
-//line gitlist.qtpl:11
+//line gitlist.qtpl:9
qt422016.ReleaseByteBuffer(qb422016)
-//line gitlist.qtpl:11
+//line gitlist.qtpl:9
return qs422016
-//line gitlist.qtpl:11
+//line gitlist.qtpl:9
}
-//line gitlist.qtpl:13
+//line gitlist.qtpl:11
func (p *GitListPage) StreamContent(qw422016 *qt422016.Writer) {
-//line gitlist.qtpl:13
+//line gitlist.qtpl:11
qw422016.N().S(`
-`)
-//line gitlist.qtpl:14
- for _, c := range u.ChunkBy(p.Respositories, 3) {
-//line gitlist.qtpl:14
- qw422016.N().S(`
<div class="row">
- `)
-//line gitlist.qtpl:16
- for _, r := range c {
-//line gitlist.qtpl:16
- qw422016.N().S(`
- <div class="col-md g-1">
- <div class="card">
- <div class="card-header">
- <a href="/`)
-//line gitlist.qtpl:20
- qw422016.E().S(r.Name)
-//line gitlist.qtpl:20
- qw422016.N().S(`" class="btn btn-primary">`)
-//line gitlist.qtpl:20
- qw422016.E().S(r.Title)
-//line gitlist.qtpl:20
- qw422016.N().S(`</a>
+ <div class="col-md-8 offset-md-2">
+ <div class="event-list">
+ `)
+//line gitlist.qtpl:15
+ for _, r := range p.Respositories {
+//line gitlist.qtpl:15
+ qw422016.N().S(`
+ <div class="event">
+ <h4>
+ <a href="/`)
+//line gitlist.qtpl:18
+ qw422016.E().S(r.Name)
+//line gitlist.qtpl:18
+ qw422016.N().S(`">`)
+//line gitlist.qtpl:18
+ qw422016.E().S(r.Name)
+//line gitlist.qtpl:18
+ qw422016.N().S(`</a>
+ </h4>
+ </hr>
+ <p>`)
+//line gitlist.qtpl:21
+ qw422016.E().S(r.LastCommitMessage)
+//line gitlist.qtpl:21
+ qw422016.N().S(`</p>
+ <p><small>`)
+//line gitlist.qtpl:22
+ qw422016.E().S(r.LastCommitDate)
+//line gitlist.qtpl:22
+ qw422016.N().S(`</small></p>
</div>
- <div class="card-body">
- <p class="card-text lead">`)
-//line gitlist.qtpl:23
- qw422016.E().S(r.LastCommitMessage)
-//line gitlist.qtpl:23
- qw422016.N().S(`</p>
- <p class="card-text"><small>`)
+ `)
//line gitlist.qtpl:24
- qw422016.E().S(r.LastCommitDate)
+ }
//line gitlist.qtpl:24
- qw422016.N().S(`</small></p>
- <a href="#" class="card-link">summary</a>
- <a href="#" class="card-link">log</a>
- <a href="#" class="card-link">tree</a>
- </div>
+ qw422016.N().S(`
</div>
- </div>
`)
-//line gitlist.qtpl:31
- }
-//line gitlist.qtpl:31
- qw422016.N().S(`
-</div>
-`)
-//line gitlist.qtpl:33
- }
-//line gitlist.qtpl:33
- qw422016.N().S(`
-`)
-//line gitlist.qtpl:34
+//line gitlist.qtpl:26
}
-//line gitlist.qtpl:34
+//line gitlist.qtpl:26
func (p *GitListPage) WriteContent(qq422016 qtio422016.Writer) {
-//line gitlist.qtpl:34
+//line gitlist.qtpl:26
qw422016 := qt422016.AcquireWriter(qq422016)
-//line gitlist.qtpl:34
+//line gitlist.qtpl:26
p.StreamContent(qw422016)
-//line gitlist.qtpl:34
+//line gitlist.qtpl:26
qt422016.ReleaseWriter(qw422016)
-//line gitlist.qtpl:34
+//line gitlist.qtpl:26
}
-//line gitlist.qtpl:34
+//line gitlist.qtpl:26
func (p *GitListPage) Content() string {
-//line gitlist.qtpl:34
+//line gitlist.qtpl:26
qb422016 := qt422016.AcquireByteBuffer()
-//line gitlist.qtpl:34
+//line gitlist.qtpl:26
p.WriteContent(qb422016)
-//line gitlist.qtpl:34
+//line gitlist.qtpl:26
qs422016 := string(qb422016.B)
-//line gitlist.qtpl:34
+//line gitlist.qtpl:26
qt422016.ReleaseByteBuffer(qb422016)
-//line gitlist.qtpl:34
+//line gitlist.qtpl:26
return qs422016
-//line gitlist.qtpl:34
+//line gitlist.qtpl:26
}
-//line gitlist.qtpl:36
+// </div>
+// </div>
+//
+
+//line gitlist.qtpl:30
func (p *GitListPage) StreamScript(qw422016 *qt422016.Writer) {
-//line gitlist.qtpl:36
+//line gitlist.qtpl:30
qw422016.N().S(`
`)
-//line gitlist.qtpl:37
+//line gitlist.qtpl:31
}
-//line gitlist.qtpl:37
+//line gitlist.qtpl:31
func (p *GitListPage) WriteScript(qq422016 qtio422016.Writer) {
-//line gitlist.qtpl:37
+//line gitlist.qtpl:31
qw422016 := qt422016.AcquireWriter(qq422016)
-//line gitlist.qtpl:37
+//line gitlist.qtpl:31
p.StreamScript(qw422016)
-//line gitlist.qtpl:37
+//line gitlist.qtpl:31
qt422016.ReleaseWriter(qw422016)
-//line gitlist.qtpl:37
+//line gitlist.qtpl:31
}
-//line gitlist.qtpl:37
+//line gitlist.qtpl:31
func (p *GitListPage) Script() string {
-//line gitlist.qtpl:37
+//line gitlist.qtpl:31
qb422016 := qt422016.AcquireByteBuffer()
-//line gitlist.qtpl:37
+//line gitlist.qtpl:31
p.WriteScript(qb422016)
-//line gitlist.qtpl:37
+//line gitlist.qtpl:31
qs422016 := string(qb422016.B)
-//line gitlist.qtpl:37
+//line gitlist.qtpl:31
qt422016.ReleaseByteBuffer(qb422016)
-//line gitlist.qtpl:37
+//line gitlist.qtpl:31
return qs422016
-//line gitlist.qtpl:37
+//line gitlist.qtpl:31
}