diff options
author | Gabriel A. Giovanini <mail@gabrielgio.me> | 2024-06-15 18:42:48 +0200 |
---|---|---|
committer | Gabriel A. Giovanini <mail@gabrielgio.me> | 2024-06-15 18:42:48 +0200 |
commit | b71c6c0e5b8dd00d44e40ac0551902a23cbe19d5 (patch) | |
tree | 55dc40918dc3adb2171dd9f9bc4cfe92f9f5e769 /templates | |
parent | d2c4023832e26d3fe3f77c9fa8581588ea812cc2 (diff) | |
download | cerrado-b71c6c0e5b8dd00d44e40ac0551902a23cbe19d5.tar.gz cerrado-b71c6c0e5b8dd00d44e40ac0551902a23cbe19d5.tar.bz2 cerrado-b71c6c0e5b8dd00d44e40ac0551902a23cbe19d5.zip |
feat: Add summary page
Diffstat (limited to 'templates')
-rw-r--r-- | templates/gititemlog.qtpl | 4 | ||||
-rw-r--r-- | templates/gititemlog.qtpl.go | 4 | ||||
-rw-r--r-- | templates/gititemsummary.qtpl | 64 | ||||
-rw-r--r-- | templates/gititemsummary.qtpl.go | 223 |
4 files changed, 257 insertions, 38 deletions
diff --git a/templates/gititemlog.qtpl b/templates/gititemlog.qtpl index 1af05ca..a28e7ad 100644 --- a/templates/gititemlog.qtpl +++ b/templates/gititemlog.qtpl @@ -9,9 +9,9 @@ type GitItemLogPage struct { {% func (g *GitItemLogPage) Nav(name, ref string) %}{%= GitItemNav(name, ref, Log) %}{% endfunc %} {% func (g *GitItemLogPage) GitContent(name, ref string) %} -<div class="logs"> +<div class="event-list"> {% for _, c := range g.Commits %} - <div class="row"> + <div class="row event"> <div class="col-xxl-2"> {%s TimeFormat(c.Committer.When) %} </div> diff --git a/templates/gititemlog.qtpl.go b/templates/gititemlog.qtpl.go index 185b153..76c2432 100644 --- a/templates/gititemlog.qtpl.go +++ b/templates/gititemlog.qtpl.go @@ -62,13 +62,13 @@ func (g *GitItemLogPage) Nav(name, ref string) string { func (g *GitItemLogPage) StreamGitContent(qw422016 *qt422016.Writer, name, ref string) { //line gititemlog.qtpl:11 qw422016.N().S(` -<div class="logs"> +<div class="event-list"> `) //line gititemlog.qtpl:13 for _, c := range g.Commits { //line gititemlog.qtpl:13 qw422016.N().S(` - <div class="row"> + <div class="row event"> <div class="col-xxl-2"> `) //line gititemlog.qtpl:16 diff --git a/templates/gititemsummary.qtpl b/templates/gititemsummary.qtpl index 4cbf324..9a3e2ee 100644 --- a/templates/gititemsummary.qtpl +++ b/templates/gititemsummary.qtpl @@ -1,10 +1,72 @@ +{% import "github.com/go-git/go-git/v5/plumbing" %} +{% import "github.com/go-git/go-git/v5/plumbing/object" %} + {% code type GitItemSummaryPage struct { + Tags []*plumbing.Reference + Branches []*plumbing.Reference + Commits []*object.Commit } %} {% func (g *GitItemSummaryPage) Nav(name, ref string) %}{%= GitItemNav(name, ref, Summary) %}{% endfunc %} {% func (g *GitItemSummaryPage) GitContent(name, ref string) %} -<h4>Summary</h4> +<div class="row"> + <div class="col-md-8"> + {% if len(g.Tags) > 0 %} + <div class="event-list"> + {% for _, t := range g.Tags %} + <div class="row event me-md-2"> + <div class="col-4"> + {%s t.Name().Short() %} + </div> + <div class="col-8"> + <div class="float-end"> + <a href="/{%s name %}/tree/{%s t.Name().Short() %}">tree</a> + <a href="/{%s name %}/log/{%s t.Name().Short() %}">log</a> + </div> + </div> + </div> + {% endfor %} + </div> + {% else %} + <p> No tags </p> + {% endif %} + </div> + <div class="col-md-4"> + <div class="event-list"> + {% for _, b := range g.Branches %} + <div class="row event"> + <div class="col-4"> + {%s b.Name().Short() %} + </div> + <div class="col-8"> + <div class="float-end"> + <a href="/{%s name %}/tree/{%s b.Name().Short() %}">tree</a> + <a href="/{%s name %}/log/{%s b.Name().Short() %}">log</a> + </div> + </div> + </div> + {% endfor %} + </div> + </div> +</div> +<div class="row"> + <div class="event-list"> + {% for _, c := range g.Commits %} + <div class="row event"> + <div class="col-xxl-2"> + {%s TimeFormat(c.Committer.When) %} + </div> + <div class="col-xxl-7 code-view"> + <pre>{%s c.Message %}</pre> + </div> + <div class="col-xxl-3"> + <small>{%s c.Committer.Name %} <{%s c.Committer.Email %}></small> + </div> + </div> + {% endfor %} + </div> +</div> {% endfunc %} diff --git a/templates/gititemsummary.qtpl.go b/templates/gititemsummary.qtpl.go index d8606a5..cf1c07c 100644 --- a/templates/gititemsummary.qtpl.go +++ b/templates/gititemsummary.qtpl.go @@ -5,86 +5,243 @@ package templates //line gititemsummary.qtpl:1 +import "github.com/go-git/go-git/v5/plumbing" + +//line gititemsummary.qtpl:2 +import "github.com/go-git/go-git/v5/plumbing/object" + +//line gititemsummary.qtpl:4 import ( qtio422016 "io" qt422016 "github.com/valyala/quicktemplate" ) -//line gititemsummary.qtpl:1 +//line gititemsummary.qtpl:4 var ( _ = qtio422016.Copy _ = qt422016.AcquireByteBuffer ) -//line gititemsummary.qtpl:2 +//line gititemsummary.qtpl:5 type GitItemSummaryPage struct { + Tags []*plumbing.Reference + Branches []*plumbing.Reference + Commits []*object.Commit } -//line gititemsummary.qtpl:6 +//line gititemsummary.qtpl:12 func (g *GitItemSummaryPage) StreamNav(qw422016 *qt422016.Writer, name, ref string) { -//line gititemsummary.qtpl:6 +//line gititemsummary.qtpl:12 StreamGitItemNav(qw422016, name, ref, Summary) -//line gititemsummary.qtpl:6 +//line gititemsummary.qtpl:12 } -//line gititemsummary.qtpl:6 +//line gititemsummary.qtpl:12 func (g *GitItemSummaryPage) WriteNav(qq422016 qtio422016.Writer, name, ref string) { -//line gititemsummary.qtpl:6 +//line gititemsummary.qtpl:12 qw422016 := qt422016.AcquireWriter(qq422016) -//line gititemsummary.qtpl:6 +//line gititemsummary.qtpl:12 g.StreamNav(qw422016, name, ref) -//line gititemsummary.qtpl:6 +//line gititemsummary.qtpl:12 qt422016.ReleaseWriter(qw422016) -//line gititemsummary.qtpl:6 +//line gititemsummary.qtpl:12 } -//line gititemsummary.qtpl:6 +//line gititemsummary.qtpl:12 func (g *GitItemSummaryPage) Nav(name, ref string) string { -//line gititemsummary.qtpl:6 +//line gititemsummary.qtpl:12 qb422016 := qt422016.AcquireByteBuffer() -//line gititemsummary.qtpl:6 +//line gititemsummary.qtpl:12 g.WriteNav(qb422016, name, ref) -//line gititemsummary.qtpl:6 +//line gititemsummary.qtpl:12 qs422016 := string(qb422016.B) -//line gititemsummary.qtpl:6 +//line gititemsummary.qtpl:12 qt422016.ReleaseByteBuffer(qb422016) -//line gititemsummary.qtpl:6 +//line gititemsummary.qtpl:12 return qs422016 -//line gititemsummary.qtpl:6 +//line gititemsummary.qtpl:12 } -//line gititemsummary.qtpl:8 +//line gititemsummary.qtpl:14 func (g *GitItemSummaryPage) StreamGitContent(qw422016 *qt422016.Writer, name, ref string) { -//line gititemsummary.qtpl:8 +//line gititemsummary.qtpl:14 + qw422016.N().S(` +<div class="row"> + <div class="col-md-8"> + `) +//line gititemsummary.qtpl:17 + if len(g.Tags) > 0 { +//line gititemsummary.qtpl:17 + qw422016.N().S(` + <div class="event-list"> + `) +//line gititemsummary.qtpl:19 + for _, t := range g.Tags { +//line gititemsummary.qtpl:19 + qw422016.N().S(` + <div class="row event me-md-2"> + <div class="col-4"> + `) +//line gititemsummary.qtpl:22 + qw422016.E().S(t.Name().Short()) +//line gititemsummary.qtpl:22 + qw422016.N().S(` + </div> + <div class="col-8"> + <div class="float-end"> + <a href="/`) +//line gititemsummary.qtpl:26 + qw422016.E().S(name) +//line gititemsummary.qtpl:26 + qw422016.N().S(`/tree/`) +//line gititemsummary.qtpl:26 + qw422016.E().S(t.Name().Short()) +//line gititemsummary.qtpl:26 + qw422016.N().S(`">tree</a> + <a href="/`) +//line gititemsummary.qtpl:27 + qw422016.E().S(name) +//line gititemsummary.qtpl:27 + qw422016.N().S(`/log/`) +//line gititemsummary.qtpl:27 + qw422016.E().S(t.Name().Short()) +//line gititemsummary.qtpl:27 + qw422016.N().S(`">log</a> + </div> + </div> + </div> + `) +//line gititemsummary.qtpl:31 + } +//line gititemsummary.qtpl:31 + qw422016.N().S(` + </div> + `) +//line gititemsummary.qtpl:33 + } else { +//line gititemsummary.qtpl:33 + qw422016.N().S(` + <p> No tags </p> + `) +//line gititemsummary.qtpl:35 + } +//line gititemsummary.qtpl:35 + qw422016.N().S(` + </div> + <div class="col-md-4"> + <div class="event-list"> + `) +//line gititemsummary.qtpl:39 + for _, b := range g.Branches { +//line gititemsummary.qtpl:39 + qw422016.N().S(` + <div class="row event"> + <div class="col-4"> + `) +//line gititemsummary.qtpl:42 + qw422016.E().S(b.Name().Short()) +//line gititemsummary.qtpl:42 + qw422016.N().S(` + </div> + <div class="col-8"> + <div class="float-end"> + <a href="/`) +//line gititemsummary.qtpl:46 + qw422016.E().S(name) +//line gititemsummary.qtpl:46 + qw422016.N().S(`/tree/`) +//line gititemsummary.qtpl:46 + qw422016.E().S(b.Name().Short()) +//line gititemsummary.qtpl:46 + qw422016.N().S(`">tree</a> + <a href="/`) +//line gititemsummary.qtpl:47 + qw422016.E().S(name) +//line gititemsummary.qtpl:47 + qw422016.N().S(`/log/`) +//line gititemsummary.qtpl:47 + qw422016.E().S(b.Name().Short()) +//line gititemsummary.qtpl:47 + qw422016.N().S(`">log</a> + </div> + </div> + </div> + `) +//line gititemsummary.qtpl:51 + } +//line gititemsummary.qtpl:51 + qw422016.N().S(` + </div> + </div> +</div> +<div class="row"> + <div class="event-list"> + `) +//line gititemsummary.qtpl:57 + for _, c := range g.Commits { +//line gititemsummary.qtpl:57 + qw422016.N().S(` + <div class="row event"> + <div class="col-xxl-2"> + `) +//line gititemsummary.qtpl:60 + qw422016.E().S(TimeFormat(c.Committer.When)) +//line gititemsummary.qtpl:60 + qw422016.N().S(` + </div> + <div class="col-xxl-7 code-view"> + <pre>`) +//line gititemsummary.qtpl:63 + qw422016.E().S(c.Message) +//line gititemsummary.qtpl:63 + qw422016.N().S(`</pre> + </div> + <div class="col-xxl-3"> + <small>`) +//line gititemsummary.qtpl:66 + qw422016.E().S(c.Committer.Name) +//line gititemsummary.qtpl:66 + qw422016.N().S(` <`) +//line gititemsummary.qtpl:66 + qw422016.E().S(c.Committer.Email) +//line gititemsummary.qtpl:66 + qw422016.N().S(`></small> + </div> + </div> + `) +//line gititemsummary.qtpl:69 + } +//line gititemsummary.qtpl:69 qw422016.N().S(` -<h4>Summary</h4> + </div> +</div> `) -//line gititemsummary.qtpl:10 +//line gititemsummary.qtpl:72 } -//line gititemsummary.qtpl:10 +//line gititemsummary.qtpl:72 func (g *GitItemSummaryPage) WriteGitContent(qq422016 qtio422016.Writer, name, ref string) { -//line gititemsummary.qtpl:10 +//line gititemsummary.qtpl:72 qw422016 := qt422016.AcquireWriter(qq422016) -//line gititemsummary.qtpl:10 +//line gititemsummary.qtpl:72 g.StreamGitContent(qw422016, name, ref) -//line gititemsummary.qtpl:10 +//line gititemsummary.qtpl:72 qt422016.ReleaseWriter(qw422016) -//line gititemsummary.qtpl:10 +//line gititemsummary.qtpl:72 } -//line gititemsummary.qtpl:10 +//line gititemsummary.qtpl:72 func (g *GitItemSummaryPage) GitContent(name, ref string) string { -//line gititemsummary.qtpl:10 +//line gititemsummary.qtpl:72 qb422016 := qt422016.AcquireByteBuffer() -//line gititemsummary.qtpl:10 +//line gititemsummary.qtpl:72 g.WriteGitContent(qb422016, name, ref) -//line gititemsummary.qtpl:10 +//line gititemsummary.qtpl:72 qs422016 := string(qb422016.B) -//line gititemsummary.qtpl:10 +//line gititemsummary.qtpl:72 qt422016.ReleaseByteBuffer(qb422016) -//line gititemsummary.qtpl:10 +//line gititemsummary.qtpl:72 return qs422016 -//line gititemsummary.qtpl:10 +//line gititemsummary.qtpl:72 } |