diff options
Diffstat (limited to 'templates')
33 files changed, 1913 insertions, 1293 deletions
diff --git a/templates/about.qtpl b/templates/about.qtpl index faee50e..cfbf0d9 100644 --- a/templates/about.qtpl +++ b/templates/about.qtpl @@ -1,16 +1,19 @@ +{% import "context" %} + {% code type AboutPage struct { + LoggedIn bool Body []byte } %} -{% func (p *AboutPage) Title() %}Hello{% endfunc %} +{% func (p *AboutPage) Title(ctx context.Context) %}Hello{% endfunc %} -{% func (p *AboutPage) Navbar() %}{%= Navbar(About) %}{% endfunc %} +{% func (p *AboutPage) Navbar(ctx context.Context) %}{%= Navbar(ctx, About) %}{% endfunc %} -{% func (p *AboutPage) Content() %} +{% func (p *AboutPage) Content(ctx context.Context) %} {%z= p.Body %} {% endfunc %} -{% func (p *AboutPage) Script() %} +{% func (p *AboutPage) Script(ctx context.Context) %} {% endfunc %} diff --git a/templates/about.qtpl.go b/templates/about.qtpl.go index aaa2514..a640f7e 100644 --- a/templates/about.qtpl.go +++ b/templates/about.qtpl.go @@ -1,162 +1,166 @@ // Code generated by qtc from "about.qtpl". DO NOT EDIT. // See https://github.com/valyala/quicktemplate for details. -//line about.qtpl:1 +//line templates/about.qtpl:1 package templates -//line about.qtpl:1 +//line templates/about.qtpl:1 +import "context" + +//line templates/about.qtpl:3 import ( qtio422016 "io" qt422016 "github.com/valyala/quicktemplate" ) -//line about.qtpl:1 +//line templates/about.qtpl:3 var ( _ = qtio422016.Copy _ = qt422016.AcquireByteBuffer ) -//line about.qtpl:2 +//line templates/about.qtpl:4 type AboutPage struct { - Body []byte + LoggedIn bool + Body []byte } -//line about.qtpl:7 -func (p *AboutPage) StreamTitle(qw422016 *qt422016.Writer) { -//line about.qtpl:7 +//line templates/about.qtpl:10 +func (p *AboutPage) StreamTitle(qw422016 *qt422016.Writer, ctx context.Context) { +//line templates/about.qtpl:10 qw422016.N().S(`Hello`) -//line about.qtpl:7 +//line templates/about.qtpl:10 } -//line about.qtpl:7 -func (p *AboutPage) WriteTitle(qq422016 qtio422016.Writer) { -//line about.qtpl:7 +//line templates/about.qtpl:10 +func (p *AboutPage) WriteTitle(qq422016 qtio422016.Writer, ctx context.Context) { +//line templates/about.qtpl:10 qw422016 := qt422016.AcquireWriter(qq422016) -//line about.qtpl:7 - p.StreamTitle(qw422016) -//line about.qtpl:7 +//line templates/about.qtpl:10 + p.StreamTitle(qw422016, ctx) +//line templates/about.qtpl:10 qt422016.ReleaseWriter(qw422016) -//line about.qtpl:7 +//line templates/about.qtpl:10 } -//line about.qtpl:7 -func (p *AboutPage) Title() string { -//line about.qtpl:7 +//line templates/about.qtpl:10 +func (p *AboutPage) Title(ctx context.Context) string { +//line templates/about.qtpl:10 qb422016 := qt422016.AcquireByteBuffer() -//line about.qtpl:7 - p.WriteTitle(qb422016) -//line about.qtpl:7 +//line templates/about.qtpl:10 + p.WriteTitle(qb422016, ctx) +//line templates/about.qtpl:10 qs422016 := string(qb422016.B) -//line about.qtpl:7 +//line templates/about.qtpl:10 qt422016.ReleaseByteBuffer(qb422016) -//line about.qtpl:7 +//line templates/about.qtpl:10 return qs422016 -//line about.qtpl:7 +//line templates/about.qtpl:10 } -//line about.qtpl:9 -func (p *AboutPage) StreamNavbar(qw422016 *qt422016.Writer) { -//line about.qtpl:9 - StreamNavbar(qw422016, About) -//line about.qtpl:9 +//line templates/about.qtpl:12 +func (p *AboutPage) StreamNavbar(qw422016 *qt422016.Writer, ctx context.Context) { +//line templates/about.qtpl:12 + StreamNavbar(qw422016, ctx, About) +//line templates/about.qtpl:12 } -//line about.qtpl:9 -func (p *AboutPage) WriteNavbar(qq422016 qtio422016.Writer) { -//line about.qtpl:9 +//line templates/about.qtpl:12 +func (p *AboutPage) WriteNavbar(qq422016 qtio422016.Writer, ctx context.Context) { +//line templates/about.qtpl:12 qw422016 := qt422016.AcquireWriter(qq422016) -//line about.qtpl:9 - p.StreamNavbar(qw422016) -//line about.qtpl:9 +//line templates/about.qtpl:12 + p.StreamNavbar(qw422016, ctx) +//line templates/about.qtpl:12 qt422016.ReleaseWriter(qw422016) -//line about.qtpl:9 +//line templates/about.qtpl:12 } -//line about.qtpl:9 -func (p *AboutPage) Navbar() string { -//line about.qtpl:9 +//line templates/about.qtpl:12 +func (p *AboutPage) Navbar(ctx context.Context) string { +//line templates/about.qtpl:12 qb422016 := qt422016.AcquireByteBuffer() -//line about.qtpl:9 - p.WriteNavbar(qb422016) -//line about.qtpl:9 +//line templates/about.qtpl:12 + p.WriteNavbar(qb422016, ctx) +//line templates/about.qtpl:12 qs422016 := string(qb422016.B) -//line about.qtpl:9 +//line templates/about.qtpl:12 qt422016.ReleaseByteBuffer(qb422016) -//line about.qtpl:9 +//line templates/about.qtpl:12 return qs422016 -//line about.qtpl:9 +//line templates/about.qtpl:12 } -//line about.qtpl:11 -func (p *AboutPage) StreamContent(qw422016 *qt422016.Writer) { -//line about.qtpl:11 +//line templates/about.qtpl:14 +func (p *AboutPage) StreamContent(qw422016 *qt422016.Writer, ctx context.Context) { +//line templates/about.qtpl:14 qw422016.N().S(` `) -//line about.qtpl:12 +//line templates/about.qtpl:15 qw422016.N().Z(p.Body) -//line about.qtpl:12 +//line templates/about.qtpl:15 qw422016.N().S(` `) -//line about.qtpl:13 +//line templates/about.qtpl:16 } -//line about.qtpl:13 -func (p *AboutPage) WriteContent(qq422016 qtio422016.Writer) { -//line about.qtpl:13 +//line templates/about.qtpl:16 +func (p *AboutPage) WriteContent(qq422016 qtio422016.Writer, ctx context.Context) { +//line templates/about.qtpl:16 qw422016 := qt422016.AcquireWriter(qq422016) -//line about.qtpl:13 - p.StreamContent(qw422016) -//line about.qtpl:13 +//line templates/about.qtpl:16 + p.StreamContent(qw422016, ctx) +//line templates/about.qtpl:16 qt422016.ReleaseWriter(qw422016) -//line about.qtpl:13 +//line templates/about.qtpl:16 } -//line about.qtpl:13 -func (p *AboutPage) Content() string { -//line about.qtpl:13 +//line templates/about.qtpl:16 +func (p *AboutPage) Content(ctx context.Context) string { +//line templates/about.qtpl:16 qb422016 := qt422016.AcquireByteBuffer() -//line about.qtpl:13 - p.WriteContent(qb422016) -//line about.qtpl:13 +//line templates/about.qtpl:16 + p.WriteContent(qb422016, ctx) +//line templates/about.qtpl:16 qs422016 := string(qb422016.B) -//line about.qtpl:13 +//line templates/about.qtpl:16 qt422016.ReleaseByteBuffer(qb422016) -//line about.qtpl:13 +//line templates/about.qtpl:16 return qs422016 -//line about.qtpl:13 +//line templates/about.qtpl:16 } -//line about.qtpl:15 -func (p *AboutPage) StreamScript(qw422016 *qt422016.Writer) { -//line about.qtpl:15 +//line templates/about.qtpl:18 +func (p *AboutPage) StreamScript(qw422016 *qt422016.Writer, ctx context.Context) { +//line templates/about.qtpl:18 qw422016.N().S(` `) -//line about.qtpl:16 +//line templates/about.qtpl:19 } -//line about.qtpl:16 -func (p *AboutPage) WriteScript(qq422016 qtio422016.Writer) { -//line about.qtpl:16 +//line templates/about.qtpl:19 +func (p *AboutPage) WriteScript(qq422016 qtio422016.Writer, ctx context.Context) { +//line templates/about.qtpl:19 qw422016 := qt422016.AcquireWriter(qq422016) -//line about.qtpl:16 - p.StreamScript(qw422016) -//line about.qtpl:16 +//line templates/about.qtpl:19 + p.StreamScript(qw422016, ctx) +//line templates/about.qtpl:19 qt422016.ReleaseWriter(qw422016) -//line about.qtpl:16 +//line templates/about.qtpl:19 } -//line about.qtpl:16 -func (p *AboutPage) Script() string { -//line about.qtpl:16 +//line templates/about.qtpl:19 +func (p *AboutPage) Script(ctx context.Context) string { +//line templates/about.qtpl:19 qb422016 := qt422016.AcquireByteBuffer() -//line about.qtpl:16 - p.WriteScript(qb422016) -//line about.qtpl:16 +//line templates/about.qtpl:19 + p.WriteScript(qb422016, ctx) +//line templates/about.qtpl:19 qs422016 := string(qb422016.B) -//line about.qtpl:16 +//line templates/about.qtpl:19 qt422016.ReleaseByteBuffer(qb422016) -//line about.qtpl:16 +//line templates/about.qtpl:19 return qs422016 -//line about.qtpl:16 +//line templates/about.qtpl:19 } diff --git a/templates/base.qtpl b/templates/base.qtpl index 9e2e6ac..db9deee 100644 --- a/templates/base.qtpl +++ b/templates/base.qtpl @@ -1,5 +1,6 @@ This is a base page template. All the other template pages implement this interface. +{% import "context" %} {% import "strconv" %} {% import "time" %} @@ -9,10 +10,10 @@ This is a base page template. All the other template pages implement this interf {% interface Page { - Title() - Content() - Script() - Navbar() + Title(ctx context.Context) + Content(ctx context.Context) + Script(ctx context.Context) + Navbar(ctx context.Context) } %} @@ -25,6 +26,8 @@ Page { } %} + + {% code func TimeFormat(t time.Time) string { return t.Format("02.01.2006") } @@ -35,27 +38,37 @@ Page { } %} + +{% code func IsAuthenticationDisabled(ctx context.Context) bool { + t, ok := ctx.Value("disableAuthentication").(bool) + return ok && t + } +%} + +{% code func IsLoggedIn(ctx context.Context) bool { + t, ok := ctx.Value("logged").(bool) + return ok && t + } +%} + Page prints a page implementing Page interface. -{% func PageTemplate(p Page) %} +{% func PageTemplate(p Page, ctx context.Context) %} <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <link rel="icon" href="data:,"> - <title>{%= p.Title() %}</title> - <link rel="stylesheet" href="/static/main{%s Slug%}.css"> + <title>{%= p.Title(ctx) %}</title> + <link rel="stylesheet" href="/static/main{%s Slug %}.css"> <meta content="text/html;charset=utf-8" http-equiv="Content-Type"> <meta name="viewport" content="width=device-width, initial-scale=1" /> </head> <body> - <div class="alert alert-warning text-center" role="alert"> - This project is under development, things may be broken or incomplete. - </div> - {%= p.Navbar() %} + {%= p.Navbar(ctx) %} <div class="container"> - {%= p.Content() %} + {%= p.Content(ctx) %} </div> </body> - {%= p.Script() %} + {%= p.Script(ctx) %} </html> {% endfunc %} diff --git a/templates/base.qtpl.go b/templates/base.qtpl.go index b2356fe..796538e 100644 --- a/templates/base.qtpl.go +++ b/templates/base.qtpl.go @@ -4,61 +4,64 @@ // This is a base page template. All the other template pages implement this interface. // -//line base.qtpl:3 +//line templates/base.qtpl:3 package templates -//line base.qtpl:3 +//line templates/base.qtpl:3 +import "context" + +//line templates/base.qtpl:4 import "strconv" -//line base.qtpl:4 +//line templates/base.qtpl:5 import "time" -//line base.qtpl:6 +//line templates/base.qtpl:7 import ( qtio422016 "io" qt422016 "github.com/valyala/quicktemplate" ) -//line base.qtpl:6 +//line templates/base.qtpl:7 var ( _ = qtio422016.Copy _ = qt422016.AcquireByteBuffer ) -//line base.qtpl:7 +//line templates/base.qtpl:8 var Slug = "" -//line base.qtpl:11 +//line templates/base.qtpl:12 type Page interface { -//line base.qtpl:11 - Title() string -//line base.qtpl:11 - StreamTitle(qw422016 *qt422016.Writer) -//line base.qtpl:11 - WriteTitle(qq422016 qtio422016.Writer) -//line base.qtpl:11 - Content() string -//line base.qtpl:11 - StreamContent(qw422016 *qt422016.Writer) -//line base.qtpl:11 - WriteContent(qq422016 qtio422016.Writer) -//line base.qtpl:11 - Script() string -//line base.qtpl:11 - StreamScript(qw422016 *qt422016.Writer) -//line base.qtpl:11 - WriteScript(qq422016 qtio422016.Writer) -//line base.qtpl:11 - Navbar() string -//line base.qtpl:11 - StreamNavbar(qw422016 *qt422016.Writer) -//line base.qtpl:11 - WriteNavbar(qq422016 qtio422016.Writer) -//line base.qtpl:11 +//line templates/base.qtpl:12 + Title(ctx context.Context) string +//line templates/base.qtpl:12 + StreamTitle(qw422016 *qt422016.Writer, ctx context.Context) +//line templates/base.qtpl:12 + WriteTitle(qq422016 qtio422016.Writer, ctx context.Context) +//line templates/base.qtpl:12 + Content(ctx context.Context) string +//line templates/base.qtpl:12 + StreamContent(qw422016 *qt422016.Writer, ctx context.Context) +//line templates/base.qtpl:12 + WriteContent(qq422016 qtio422016.Writer, ctx context.Context) +//line templates/base.qtpl:12 + Script(ctx context.Context) string +//line templates/base.qtpl:12 + StreamScript(qw422016 *qt422016.Writer, ctx context.Context) +//line templates/base.qtpl:12 + WriteScript(qq422016 qtio422016.Writer, ctx context.Context) +//line templates/base.qtpl:12 + Navbar(ctx context.Context) string +//line templates/base.qtpl:12 + StreamNavbar(qw422016 *qt422016.Writer, ctx context.Context) +//line templates/base.qtpl:12 + WriteNavbar(qq422016 qtio422016.Writer, ctx context.Context) +//line templates/base.qtpl:12 } -//line base.qtpl:20 +//line templates/base.qtpl:21 func FromUInttoString(u *uint) string { if u != nil { return strconv.FormatUint(uint64(*u), 10) @@ -66,21 +69,33 @@ func FromUInttoString(u *uint) string { return "" } -//line base.qtpl:28 +//line templates/base.qtpl:31 func TimeFormat(t time.Time) string { return t.Format("02.01.2006") } -//line base.qtpl:33 +//line templates/base.qtpl:36 func Ignore[T any](v T, _ error) T { return v } +//line templates/base.qtpl:42 +func IsAuthenticationDisabled(ctx context.Context) bool { + t, ok := ctx.Value("disableAuthentication").(bool) + return ok && t +} + +//line templates/base.qtpl:48 +func IsLoggedIn(ctx context.Context) bool { + t, ok := ctx.Value("logged").(bool) + return ok && t +} + // Page prints a page implementing Page interface. -//line base.qtpl:39 -func StreamPageTemplate(qw422016 *qt422016.Writer, p Page) { -//line base.qtpl:39 +//line templates/base.qtpl:55 +func StreamPageTemplate(qw422016 *qt422016.Writer, p Page, ctx context.Context) { +//line templates/base.qtpl:55 qw422016.N().S(` <!DOCTYPE html> <html lang="en"> @@ -88,67 +103,64 @@ func StreamPageTemplate(qw422016 *qt422016.Writer, p Page) { <meta charset="utf-8"> <link rel="icon" href="data:,"> <title>`) -//line base.qtpl:45 - p.StreamTitle(qw422016) -//line base.qtpl:45 +//line templates/base.qtpl:61 + p.StreamTitle(qw422016, ctx) +//line templates/base.qtpl:61 qw422016.N().S(`</title> <link rel="stylesheet" href="/static/main`) -//line base.qtpl:46 +//line templates/base.qtpl:62 qw422016.E().S(Slug) -//line base.qtpl:46 +//line templates/base.qtpl:62 qw422016.N().S(`.css"> <meta content="text/html;charset=utf-8" http-equiv="Content-Type"> <meta name="viewport" content="width=device-width, initial-scale=1" /> </head> <body> - <div class="alert alert-warning text-center" role="alert"> - This project is under development, things may be broken or incomplete. - </div> `) -//line base.qtpl:54 - p.StreamNavbar(qw422016) -//line base.qtpl:54 +//line templates/base.qtpl:67 + p.StreamNavbar(qw422016, ctx) +//line templates/base.qtpl:67 qw422016.N().S(` <div class="container"> `) -//line base.qtpl:56 - p.StreamContent(qw422016) -//line base.qtpl:56 +//line templates/base.qtpl:69 + p.StreamContent(qw422016, ctx) +//line templates/base.qtpl:69 qw422016.N().S(` </div> </body> `) -//line base.qtpl:59 - p.StreamScript(qw422016) -//line base.qtpl:59 +//line templates/base.qtpl:72 + p.StreamScript(qw422016, ctx) +//line templates/base.qtpl:72 qw422016.N().S(` </html> `) -//line base.qtpl:61 +//line templates/base.qtpl:74 } -//line base.qtpl:61 -func WritePageTemplate(qq422016 qtio422016.Writer, p Page) { -//line base.qtpl:61 +//line templates/base.qtpl:74 +func WritePageTemplate(qq422016 qtio422016.Writer, p Page, ctx context.Context) { +//line templates/base.qtpl:74 qw422016 := qt422016.AcquireWriter(qq422016) -//line base.qtpl:61 - StreamPageTemplate(qw422016, p) -//line base.qtpl:61 +//line templates/base.qtpl:74 + StreamPageTemplate(qw422016, p, ctx) +//line templates/base.qtpl:74 qt422016.ReleaseWriter(qw422016) -//line base.qtpl:61 +//line templates/base.qtpl:74 } -//line base.qtpl:61 -func PageTemplate(p Page) string { -//line base.qtpl:61 +//line templates/base.qtpl:74 +func PageTemplate(p Page, ctx context.Context) string { +//line templates/base.qtpl:74 qb422016 := qt422016.AcquireByteBuffer() -//line base.qtpl:61 - WritePageTemplate(qb422016, p) -//line base.qtpl:61 +//line templates/base.qtpl:74 + WritePageTemplate(qb422016, p, ctx) +//line templates/base.qtpl:74 qs422016 := string(qb422016.B) -//line base.qtpl:61 +//line templates/base.qtpl:74 qt422016.ReleaseByteBuffer(qb422016) -//line base.qtpl:61 +//line templates/base.qtpl:74 return qs422016 -//line base.qtpl:61 +//line templates/base.qtpl:74 } diff --git a/templates/commit.qtpl b/templates/commit.qtpl index 2b58864..4fe92e9 100644 --- a/templates/commit.qtpl +++ b/templates/commit.qtpl @@ -1,22 +1,34 @@ -{% import "github.com/go-git/go-git/v5/plumbing/object" %} +{% import "git.gabrielgio.me/cerrado/pkg/git" %} +{% import "git.gabrielgio.me/cerrado/pkg/humanize" %} -{% func Commit(name string, c *object.Commit, showTar bool) %} +{% func Commit(name string, c *git.CommitReference, showTar bool) %} <div class="row event"> <div class="row"> <div class="col-md"> - <a title="{%s c.Hash.String() %}" href="/{%s name %}/commit/{%s c.Hash.String() %}">{%s c.Hash.String()[0:8] %}</a> + <a title="{%s c.Commit().Hash.String() %}" href="/{%s name %}/commit/{%s c.Commit().Hash.String() %}/">{%s c.Commit().Hash.String()[0:8] %}</a> — + <a title="{%s c.Commit().Committer.Email %}" href="mailto:{%s c.Commit().Author.Email %}">{%s c.Commit().Author.Name %}</a> + {% if c.HasReference() %} + — + {% for _, r := range c.References() %} + {% if r.Name().IsBranch() %} + <a class="ref branch" title="{%s c.Commit().Hash.String() %}" href="/{%s name %}/tree/{%s r.Name().Short() %}/">{%s r.Name().Short() %}</a> + {% else %} + <a class="ref tag" title="{%s c.Commit().Hash.String() %}" href="/{%s name %}/ref/{%s r.Name().Short() %}/">{%s r.Name().Short() %}</a> + {% endif %} + {% endfor %} + {%endif%} </div> {% if showTar %} <div class="col-md text-md-center"> - <a title="tar.gz for {%s c.Hash.String() %}" href="/{%s name %}/archive/{%s c.Hash.String() %}.tar.gz">tar.gz</a> + <a title="tar.gz for {%s c.Commit().Hash.String() %}" href="/{%s name %}/archive/{%s c.Commit().Hash.String() %}.tar.gz">tar.gz</a> </div> {% endif %} <div class="col-md text-md-end"> - <a title="{%s c.Committer.Email %}" href="mailto:{%s c.Committer.Email %}">{%s c.Committer.Name %}</a> + <a title="{%s c.Commit().Author.When.UTC().Format("2006-01-02 15:04:05")%} UTC">{%s humanize.Time(c.Commit().Author.When) %}</a> </div> </div> <div class="code-view"> - <pre>{%s c.Message %}</pre> + <pre>{%s c.Commit().Message %}</pre> </div> </div> {% endfunc %} diff --git a/templates/commit.qtpl.go b/templates/commit.qtpl.go index 04d1c9c..0aefbb8 100644 --- a/templates/commit.qtpl.go +++ b/templates/commit.qtpl.go @@ -1,125 +1,207 @@ // Code generated by qtc from "commit.qtpl". DO NOT EDIT. // See https://github.com/valyala/quicktemplate for details. -//line commit.qtpl:1 +//line templates/commit.qtpl:1 package templates -//line commit.qtpl:1 -import "github.com/go-git/go-git/v5/plumbing/object" +//line templates/commit.qtpl:1 +import "git.gabrielgio.me/cerrado/pkg/git" -//line commit.qtpl:3 +//line templates/commit.qtpl:2 +import "git.gabrielgio.me/cerrado/pkg/humanize" + +//line templates/commit.qtpl:4 import ( qtio422016 "io" qt422016 "github.com/valyala/quicktemplate" ) -//line commit.qtpl:3 +//line templates/commit.qtpl:4 var ( _ = qtio422016.Copy _ = qt422016.AcquireByteBuffer ) -//line commit.qtpl:3 -func StreamCommit(qw422016 *qt422016.Writer, name string, c *object.Commit, showTar bool) { -//line commit.qtpl:3 +//line templates/commit.qtpl:4 +func StreamCommit(qw422016 *qt422016.Writer, name string, c *git.CommitReference, showTar bool) { +//line templates/commit.qtpl:4 qw422016.N().S(` <div class="row event"> <div class="row"> <div class="col-md"> <a title="`) -//line commit.qtpl:7 - qw422016.E().S(c.Hash.String()) -//line commit.qtpl:7 +//line templates/commit.qtpl:8 + qw422016.E().S(c.Commit().Hash.String()) +//line templates/commit.qtpl:8 qw422016.N().S(`" href="/`) -//line commit.qtpl:7 +//line templates/commit.qtpl:8 qw422016.E().S(name) -//line commit.qtpl:7 +//line templates/commit.qtpl:8 qw422016.N().S(`/commit/`) -//line commit.qtpl:7 - qw422016.E().S(c.Hash.String()) -//line commit.qtpl:7 +//line templates/commit.qtpl:8 + qw422016.E().S(c.Commit().Hash.String()) +//line templates/commit.qtpl:8 + qw422016.N().S(`/">`) +//line templates/commit.qtpl:8 + qw422016.E().S(c.Commit().Hash.String()[0:8]) +//line templates/commit.qtpl:8 + qw422016.N().S(`</a> — + <a title="`) +//line templates/commit.qtpl:9 + qw422016.E().S(c.Commit().Committer.Email) +//line templates/commit.qtpl:9 + qw422016.N().S(`" href="mailto:`) +//line templates/commit.qtpl:9 + qw422016.E().S(c.Commit().Author.Email) +//line templates/commit.qtpl:9 qw422016.N().S(`">`) -//line commit.qtpl:7 - qw422016.E().S(c.Hash.String()[0:8]) -//line commit.qtpl:7 +//line templates/commit.qtpl:9 + qw422016.E().S(c.Commit().Author.Name) +//line templates/commit.qtpl:9 qw422016.N().S(`</a> + `) +//line templates/commit.qtpl:10 + if c.HasReference() { +//line templates/commit.qtpl:10 + qw422016.N().S(` + — + `) +//line templates/commit.qtpl:12 + for _, r := range c.References() { +//line templates/commit.qtpl:12 + qw422016.N().S(` + `) +//line templates/commit.qtpl:13 + if r.Name().IsBranch() { +//line templates/commit.qtpl:13 + qw422016.N().S(` + <a class="ref branch" title="`) +//line templates/commit.qtpl:14 + qw422016.E().S(c.Commit().Hash.String()) +//line templates/commit.qtpl:14 + qw422016.N().S(`" href="/`) +//line templates/commit.qtpl:14 + qw422016.E().S(name) +//line templates/commit.qtpl:14 + qw422016.N().S(`/tree/`) +//line templates/commit.qtpl:14 + qw422016.E().S(r.Name().Short()) +//line templates/commit.qtpl:14 + qw422016.N().S(`/">`) +//line templates/commit.qtpl:14 + qw422016.E().S(r.Name().Short()) +//line templates/commit.qtpl:14 + qw422016.N().S(`</a> + `) +//line templates/commit.qtpl:15 + } else { +//line templates/commit.qtpl:15 + qw422016.N().S(` + <a class="ref tag" title="`) +//line templates/commit.qtpl:16 + qw422016.E().S(c.Commit().Hash.String()) +//line templates/commit.qtpl:16 + qw422016.N().S(`" href="/`) +//line templates/commit.qtpl:16 + qw422016.E().S(name) +//line templates/commit.qtpl:16 + qw422016.N().S(`/ref/`) +//line templates/commit.qtpl:16 + qw422016.E().S(r.Name().Short()) +//line templates/commit.qtpl:16 + qw422016.N().S(`/">`) +//line templates/commit.qtpl:16 + qw422016.E().S(r.Name().Short()) +//line templates/commit.qtpl:16 + qw422016.N().S(`</a> + `) +//line templates/commit.qtpl:17 + } +//line templates/commit.qtpl:17 + qw422016.N().S(` + `) +//line templates/commit.qtpl:18 + } +//line templates/commit.qtpl:18 + qw422016.N().S(` + `) +//line templates/commit.qtpl:19 + } +//line templates/commit.qtpl:19 + qw422016.N().S(` </div> `) -//line commit.qtpl:9 +//line templates/commit.qtpl:21 if showTar { -//line commit.qtpl:9 +//line templates/commit.qtpl:21 qw422016.N().S(` <div class="col-md text-md-center"> <a title="tar.gz for `) -//line commit.qtpl:11 - qw422016.E().S(c.Hash.String()) -//line commit.qtpl:11 +//line templates/commit.qtpl:23 + qw422016.E().S(c.Commit().Hash.String()) +//line templates/commit.qtpl:23 qw422016.N().S(`" href="/`) -//line commit.qtpl:11 +//line templates/commit.qtpl:23 qw422016.E().S(name) -//line commit.qtpl:11 +//line templates/commit.qtpl:23 qw422016.N().S(`/archive/`) -//line commit.qtpl:11 - qw422016.E().S(c.Hash.String()) -//line commit.qtpl:11 +//line templates/commit.qtpl:23 + qw422016.E().S(c.Commit().Hash.String()) +//line templates/commit.qtpl:23 qw422016.N().S(`.tar.gz">tar.gz</a> </div> `) -//line commit.qtpl:13 +//line templates/commit.qtpl:25 } -//line commit.qtpl:13 +//line templates/commit.qtpl:25 qw422016.N().S(` <div class="col-md text-md-end"> - <a title="`) -//line commit.qtpl:15 - qw422016.E().S(c.Committer.Email) -//line commit.qtpl:15 - qw422016.N().S(`" href="mailto:`) -//line commit.qtpl:15 - qw422016.E().S(c.Committer.Email) -//line commit.qtpl:15 - qw422016.N().S(`">`) -//line commit.qtpl:15 - qw422016.E().S(c.Committer.Name) -//line commit.qtpl:15 + <a title="`) +//line templates/commit.qtpl:27 + qw422016.E().S(c.Commit().Author.When.UTC().Format("2006-01-02 15:04:05")) +//line templates/commit.qtpl:27 + qw422016.N().S(` UTC">`) +//line templates/commit.qtpl:27 + qw422016.E().S(humanize.Time(c.Commit().Author.When)) +//line templates/commit.qtpl:27 qw422016.N().S(`</a> </div> </div> <div class="code-view"> <pre>`) -//line commit.qtpl:19 - qw422016.E().S(c.Message) -//line commit.qtpl:19 +//line templates/commit.qtpl:31 + qw422016.E().S(c.Commit().Message) +//line templates/commit.qtpl:31 qw422016.N().S(`</pre> </div> </div> `) -//line commit.qtpl:22 +//line templates/commit.qtpl:34 } -//line commit.qtpl:22 -func WriteCommit(qq422016 qtio422016.Writer, name string, c *object.Commit, showTar bool) { -//line commit.qtpl:22 +//line templates/commit.qtpl:34 +func WriteCommit(qq422016 qtio422016.Writer, name string, c *git.CommitReference, showTar bool) { +//line templates/commit.qtpl:34 qw422016 := qt422016.AcquireWriter(qq422016) -//line commit.qtpl:22 +//line templates/commit.qtpl:34 StreamCommit(qw422016, name, c, showTar) -//line commit.qtpl:22 +//line templates/commit.qtpl:34 qt422016.ReleaseWriter(qw422016) -//line commit.qtpl:22 +//line templates/commit.qtpl:34 } -//line commit.qtpl:22 -func Commit(name string, c *object.Commit, showTar bool) string { -//line commit.qtpl:22 +//line templates/commit.qtpl:34 +func Commit(name string, c *git.CommitReference, showTar bool) string { +//line templates/commit.qtpl:34 qb422016 := qt422016.AcquireByteBuffer() -//line commit.qtpl:22 +//line templates/commit.qtpl:34 WriteCommit(qb422016, name, c, showTar) -//line commit.qtpl:22 +//line templates/commit.qtpl:34 qs422016 := string(qb422016.B) -//line commit.qtpl:22 +//line templates/commit.qtpl:34 qt422016.ReleaseByteBuffer(qb422016) -//line commit.qtpl:22 +//line templates/commit.qtpl:34 return qs422016 -//line commit.qtpl:22 +//line templates/commit.qtpl:34 } diff --git a/templates/config.qtpl b/templates/config.qtpl deleted file mode 100644 index b3df50e..0000000 --- a/templates/config.qtpl +++ /dev/null @@ -1,19 +0,0 @@ -{% code -type ConfigPage struct { - Body []byte -} -%} - -{% func (p *ConfigPage) Title() %}Hello{% endfunc %} - -{% func (p *ConfigPage) Navbar() %}{%= Navbar(Config) %}{% endfunc %} - -{% func (p *ConfigPage) Content() %} -<p>This is the configuration that is currently loaded</p> -<div class="code-view"> -{%z= p.Body %} -</div> -{% endfunc %} - -{% func (p *ConfigPage) Script() %} -{% endfunc %} diff --git a/templates/config.qtpl.go b/templates/config.qtpl.go deleted file mode 100644 index 58b3881..0000000 --- a/templates/config.qtpl.go +++ /dev/null @@ -1,165 +0,0 @@ -// 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(` -<p>This is the configuration that is currently loaded</p> -<div class="code-view"> -`) -//line config.qtpl:14 - qw422016.N().Z(p.Body) -//line config.qtpl:14 - qw422016.N().S(` -</div> -`) -//line config.qtpl:16 -} - -//line config.qtpl:16 -func (p *ConfigPage) WriteContent(qq422016 qtio422016.Writer) { -//line config.qtpl:16 - qw422016 := qt422016.AcquireWriter(qq422016) -//line config.qtpl:16 - p.StreamContent(qw422016) -//line config.qtpl:16 - qt422016.ReleaseWriter(qw422016) -//line config.qtpl:16 -} - -//line config.qtpl:16 -func (p *ConfigPage) Content() string { -//line config.qtpl:16 - qb422016 := qt422016.AcquireByteBuffer() -//line config.qtpl:16 - p.WriteContent(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 -} - -//line config.qtpl:18 -func (p *ConfigPage) StreamScript(qw422016 *qt422016.Writer) { -//line config.qtpl:18 - qw422016.N().S(` -`) -//line config.qtpl:19 -} - -//line config.qtpl:19 -func (p *ConfigPage) WriteScript(qq422016 qtio422016.Writer) { -//line config.qtpl:19 - qw422016 := qt422016.AcquireWriter(qq422016) -//line config.qtpl:19 - p.StreamScript(qw422016) -//line config.qtpl:19 - qt422016.ReleaseWriter(qw422016) -//line config.qtpl:19 -} - -//line config.qtpl:19 -func (p *ConfigPage) Script() string { -//line config.qtpl:19 - qb422016 := qt422016.AcquireByteBuffer() -//line config.qtpl:19 - p.WriteScript(qb422016) -//line config.qtpl:19 - qs422016 := string(qb422016.B) -//line config.qtpl:19 - qt422016.ReleaseByteBuffer(qb422016) -//line config.qtpl:19 - return qs422016 -//line config.qtpl:19 -} diff --git a/templates/error.qtpl b/templates/error.qtpl index 771d533..65e1321 100644 --- a/templates/error.qtpl +++ b/templates/error.qtpl @@ -1,16 +1,18 @@ +{% import "context" %} + {% code type ErrorPage struct { Message string } %} -{% func (p *ErrorPage) Title() %}Error{% endfunc %} +{% func (p *ErrorPage) Title(ctx context.Context) %}Error{% endfunc %} -{% func (p *ErrorPage) Navbar() %}{%= Navbar(Git) %}{% endfunc %} +{% func (p *ErrorPage) Navbar(ctx context.Context) %}{%= Navbar(ctx, Git) %}{% endfunc %} -{% func (p *ErrorPage) Content() %} +{% func (p *ErrorPage) Content(ctx context.Context) %} {%s p.Message %} {% endfunc %} -{% func (p *ErrorPage) Script() %} +{% func (p *ErrorPage) Script(ctx context.Context) %} {% endfunc %} diff --git a/templates/error.qtpl.go b/templates/error.qtpl.go index 099395f..d4732c5 100644 --- a/templates/error.qtpl.go +++ b/templates/error.qtpl.go @@ -1,162 +1,165 @@ // Code generated by qtc from "error.qtpl". DO NOT EDIT. // See https://github.com/valyala/quicktemplate for details. -//line error.qtpl:1 +//line templates/error.qtpl:1 package templates -//line error.qtpl:1 +//line templates/error.qtpl:1 +import "context" + +//line templates/error.qtpl:3 import ( qtio422016 "io" qt422016 "github.com/valyala/quicktemplate" ) -//line error.qtpl:1 +//line templates/error.qtpl:3 var ( _ = qtio422016.Copy _ = qt422016.AcquireByteBuffer ) -//line error.qtpl:2 +//line templates/error.qtpl:4 type ErrorPage struct { Message string } -//line error.qtpl:7 -func (p *ErrorPage) StreamTitle(qw422016 *qt422016.Writer) { -//line error.qtpl:7 +//line templates/error.qtpl:9 +func (p *ErrorPage) StreamTitle(qw422016 *qt422016.Writer, ctx context.Context) { +//line templates/error.qtpl:9 qw422016.N().S(`Error`) -//line error.qtpl:7 +//line templates/error.qtpl:9 } -//line error.qtpl:7 -func (p *ErrorPage) WriteTitle(qq422016 qtio422016.Writer) { -//line error.qtpl:7 +//line templates/error.qtpl:9 +func (p *ErrorPage) WriteTitle(qq422016 qtio422016.Writer, ctx context.Context) { +//line templates/error.qtpl:9 qw422016 := qt422016.AcquireWriter(qq422016) -//line error.qtpl:7 - p.StreamTitle(qw422016) -//line error.qtpl:7 +//line templates/error.qtpl:9 + p.StreamTitle(qw422016, ctx) +//line templates/error.qtpl:9 qt422016.ReleaseWriter(qw422016) -//line error.qtpl:7 +//line templates/error.qtpl:9 } -//line error.qtpl:7 -func (p *ErrorPage) Title() string { -//line error.qtpl:7 +//line templates/error.qtpl:9 +func (p *ErrorPage) Title(ctx context.Context) string { +//line templates/error.qtpl:9 qb422016 := qt422016.AcquireByteBuffer() -//line error.qtpl:7 - p.WriteTitle(qb422016) -//line error.qtpl:7 +//line templates/error.qtpl:9 + p.WriteTitle(qb422016, ctx) +//line templates/error.qtpl:9 qs422016 := string(qb422016.B) -//line error.qtpl:7 +//line templates/error.qtpl:9 qt422016.ReleaseByteBuffer(qb422016) -//line error.qtpl:7 +//line templates/error.qtpl:9 return qs422016 -//line error.qtpl:7 +//line templates/error.qtpl:9 } -//line error.qtpl:9 -func (p *ErrorPage) StreamNavbar(qw422016 *qt422016.Writer) { -//line error.qtpl:9 - StreamNavbar(qw422016, Git) -//line error.qtpl:9 +//line templates/error.qtpl:11 +func (p *ErrorPage) StreamNavbar(qw422016 *qt422016.Writer, ctx context.Context) { +//line templates/error.qtpl:11 + StreamNavbar(qw422016, ctx, Git) +//line templates/error.qtpl:11 } -//line error.qtpl:9 -func (p *ErrorPage) WriteNavbar(qq422016 qtio422016.Writer) { -//line error.qtpl:9 +//line templates/error.qtpl:11 +func (p *ErrorPage) WriteNavbar(qq422016 qtio422016.Writer, ctx context.Context) { +//line templates/error.qtpl:11 qw422016 := qt422016.AcquireWriter(qq422016) -//line error.qtpl:9 - p.StreamNavbar(qw422016) -//line error.qtpl:9 +//line templates/error.qtpl:11 + p.StreamNavbar(qw422016, ctx) +//line templates/error.qtpl:11 qt422016.ReleaseWriter(qw422016) -//line error.qtpl:9 +//line templates/error.qtpl:11 } -//line error.qtpl:9 -func (p *ErrorPage) Navbar() string { -//line error.qtpl:9 +//line templates/error.qtpl:11 +func (p *ErrorPage) Navbar(ctx context.Context) string { +//line templates/error.qtpl:11 qb422016 := qt422016.AcquireByteBuffer() -//line error.qtpl:9 - p.WriteNavbar(qb422016) -//line error.qtpl:9 +//line templates/error.qtpl:11 + p.WriteNavbar(qb422016, ctx) +//line templates/error.qtpl:11 qs422016 := string(qb422016.B) -//line error.qtpl:9 +//line templates/error.qtpl:11 qt422016.ReleaseByteBuffer(qb422016) -//line error.qtpl:9 +//line templates/error.qtpl:11 return qs422016 -//line error.qtpl:9 +//line templates/error.qtpl:11 } -//line error.qtpl:11 -func (p *ErrorPage) StreamContent(qw422016 *qt422016.Writer) { -//line error.qtpl:11 +//line templates/error.qtpl:13 +func (p *ErrorPage) StreamContent(qw422016 *qt422016.Writer, ctx context.Context) { +//line templates/error.qtpl:13 qw422016.N().S(` `) -//line error.qtpl:12 +//line templates/error.qtpl:14 qw422016.E().S(p.Message) -//line error.qtpl:12 +//line templates/error.qtpl:14 qw422016.N().S(` `) -//line error.qtpl:13 +//line templates/error.qtpl:15 } -//line error.qtpl:13 -func (p *ErrorPage) WriteContent(qq422016 qtio422016.Writer) { -//line error.qtpl:13 +//line templates/error.qtpl:15 +func (p *ErrorPage) WriteContent(qq422016 qtio422016.Writer, ctx context.Context) { +//line templates/error.qtpl:15 qw422016 := qt422016.AcquireWriter(qq422016) -//line error.qtpl:13 - p.StreamContent(qw422016) -//line error.qtpl:13 +//line templates/error.qtpl:15 + p.StreamContent(qw422016, ctx) +//line templates/error.qtpl:15 qt422016.ReleaseWriter(qw422016) -//line error.qtpl:13 +//line templates/error.qtpl:15 } -//line error.qtpl:13 -func (p *ErrorPage) Content() string { -//line error.qtpl:13 +//line templates/error.qtpl:15 +func (p *ErrorPage) Content(ctx context.Context) string { +//line templates/error.qtpl:15 qb422016 := qt422016.AcquireByteBuffer() -//line error.qtpl:13 - p.WriteContent(qb422016) -//line error.qtpl:13 +//line templates/error.qtpl:15 + p.WriteContent(qb422016, ctx) +//line templates/error.qtpl:15 qs422016 := string(qb422016.B) -//line error.qtpl:13 +//line templates/error.qtpl:15 qt422016.ReleaseByteBuffer(qb422016) -//line error.qtpl:13 +//line templates/error.qtpl:15 return qs422016 -//line error.qtpl:13 +//line templates/error.qtpl:15 } -//line error.qtpl:15 -func (p *ErrorPage) StreamScript(qw422016 *qt422016.Writer) { -//line error.qtpl:15 +//line templates/error.qtpl:17 +func (p *ErrorPage) StreamScript(qw422016 *qt422016.Writer, ctx context.Context) { +//line templates/error.qtpl:17 qw422016.N().S(` `) -//line error.qtpl:16 +//line templates/error.qtpl:18 } -//line error.qtpl:16 -func (p *ErrorPage) WriteScript(qq422016 qtio422016.Writer) { -//line error.qtpl:16 +//line templates/error.qtpl:18 +func (p *ErrorPage) WriteScript(qq422016 qtio422016.Writer, ctx context.Context) { +//line templates/error.qtpl:18 qw422016 := qt422016.AcquireWriter(qq422016) -//line error.qtpl:16 - p.StreamScript(qw422016) -//line error.qtpl:16 +//line templates/error.qtpl:18 + p.StreamScript(qw422016, ctx) +//line templates/error.qtpl:18 qt422016.ReleaseWriter(qw422016) -//line error.qtpl:16 +//line templates/error.qtpl:18 } -//line error.qtpl:16 -func (p *ErrorPage) Script() string { -//line error.qtpl:16 +//line templates/error.qtpl:18 +func (p *ErrorPage) Script(ctx context.Context) string { +//line templates/error.qtpl:18 qb422016 := qt422016.AcquireByteBuffer() -//line error.qtpl:16 - p.WriteScript(qb422016) -//line error.qtpl:16 +//line templates/error.qtpl:18 + p.WriteScript(qb422016, ctx) +//line templates/error.qtpl:18 qs422016 := string(qb422016.B) -//line error.qtpl:16 +//line templates/error.qtpl:18 qt422016.ReleaseByteBuffer(qb422016) -//line error.qtpl:16 +//line templates/error.qtpl:18 return qs422016 -//line error.qtpl:16 +//line templates/error.qtpl:18 } diff --git a/templates/gititem.qtpl b/templates/gititem.qtpl index a6a312d..c43bbfd 100644 --- a/templates/gititem.qtpl +++ b/templates/gititem.qtpl @@ -1,3 +1,5 @@ +{% import "context" %} + {% interface GitItemBase { Nav(name, ref string) @@ -13,16 +15,16 @@ type GitItemPage struct { } %} -{% func (p *GitItemPage) Title() %}Git | {%s p.Name %}{% endfunc %} +{% func (p *GitItemPage) Title(ctx context.Context) %}Git | {%s p.Name %}{% endfunc %} -{% func (p *GitItemPage) Navbar() %}{%= Navbar(Git) %}{% endfunc %} +{% func (p *GitItemPage) Navbar(ctx context.Context) %}{%= Navbar(ctx, Git) %}{% endfunc %} -{% func (p *GitItemPage) Content() %} +{% func (p *GitItemPage) Content(ctx context.Context) %} {%= p.Nav(p.Name, p.Ref) %} <div class="container"> {%= p.GitContent(p.Name, p.Ref) %} </div> {% endfunc %} -{% func (p *GitItemPage) Script() %} +{% func (p *GitItemPage) Script(ctx context.Context) %} {% endfunc %} diff --git a/templates/gititem.qtpl.go b/templates/gititem.qtpl.go index 7cfeeb4..5292e44 100644 --- a/templates/gititem.qtpl.go +++ b/templates/gititem.qtpl.go @@ -1,190 +1,193 @@ // Code generated by qtc from "gititem.qtpl". DO NOT EDIT. // See https://github.com/valyala/quicktemplate for details. -//line gititem.qtpl:1 +//line templates/gititem.qtpl:1 package templates -//line gititem.qtpl:1 +//line templates/gititem.qtpl:1 +import "context" + +//line templates/gititem.qtpl:3 import ( qtio422016 "io" qt422016 "github.com/valyala/quicktemplate" ) -//line gititem.qtpl:1 +//line templates/gititem.qtpl:3 var ( _ = qtio422016.Copy _ = qt422016.AcquireByteBuffer ) -//line gititem.qtpl:2 +//line templates/gititem.qtpl:4 type GitItemBase interface { -//line gititem.qtpl:2 +//line templates/gititem.qtpl:4 Nav(name, ref string) string -//line gititem.qtpl:2 +//line templates/gititem.qtpl:4 StreamNav(qw422016 *qt422016.Writer, name, ref string) -//line gititem.qtpl:2 +//line templates/gititem.qtpl:4 WriteNav(qq422016 qtio422016.Writer, name, ref string) -//line gititem.qtpl:2 +//line templates/gititem.qtpl:4 GitContent(name, ref string) string -//line gititem.qtpl:2 +//line templates/gititem.qtpl:4 StreamGitContent(qw422016 *qt422016.Writer, name, ref string) -//line gititem.qtpl:2 +//line templates/gititem.qtpl:4 WriteGitContent(qq422016 qtio422016.Writer, name, ref string) -//line gititem.qtpl:2 +//line templates/gititem.qtpl:4 } -//line gititem.qtpl:9 +//line templates/gititem.qtpl:11 type GitItemPage struct { Name string Ref string GitItemBase } -//line gititem.qtpl:16 -func (p *GitItemPage) StreamTitle(qw422016 *qt422016.Writer) { -//line gititem.qtpl:16 +//line templates/gititem.qtpl:18 +func (p *GitItemPage) StreamTitle(qw422016 *qt422016.Writer, ctx context.Context) { +//line templates/gititem.qtpl:18 qw422016.N().S(`Git | `) -//line gititem.qtpl:16 +//line templates/gititem.qtpl:18 qw422016.E().S(p.Name) -//line gititem.qtpl:16 +//line templates/gititem.qtpl:18 } -//line gititem.qtpl:16 -func (p *GitItemPage) WriteTitle(qq422016 qtio422016.Writer) { -//line gititem.qtpl:16 +//line templates/gititem.qtpl:18 +func (p *GitItemPage) WriteTitle(qq422016 qtio422016.Writer, ctx context.Context) { +//line templates/gititem.qtpl:18 qw422016 := qt422016.AcquireWriter(qq422016) -//line gititem.qtpl:16 - p.StreamTitle(qw422016) -//line gititem.qtpl:16 +//line templates/gititem.qtpl:18 + p.StreamTitle(qw422016, ctx) +//line templates/gititem.qtpl:18 qt422016.ReleaseWriter(qw422016) -//line gititem.qtpl:16 +//line templates/gititem.qtpl:18 } -//line gititem.qtpl:16 -func (p *GitItemPage) Title() string { -//line gititem.qtpl:16 +//line templates/gititem.qtpl:18 +func (p *GitItemPage) Title(ctx context.Context) string { +//line templates/gititem.qtpl:18 qb422016 := qt422016.AcquireByteBuffer() -//line gititem.qtpl:16 - p.WriteTitle(qb422016) -//line gititem.qtpl:16 +//line templates/gititem.qtpl:18 + p.WriteTitle(qb422016, ctx) +//line templates/gititem.qtpl:18 qs422016 := string(qb422016.B) -//line gititem.qtpl:16 +//line templates/gititem.qtpl:18 qt422016.ReleaseByteBuffer(qb422016) -//line gititem.qtpl:16 +//line templates/gititem.qtpl:18 return qs422016 -//line gititem.qtpl:16 +//line templates/gititem.qtpl:18 } -//line gititem.qtpl:18 -func (p *GitItemPage) StreamNavbar(qw422016 *qt422016.Writer) { -//line gititem.qtpl:18 - StreamNavbar(qw422016, Git) -//line gititem.qtpl:18 +//line templates/gititem.qtpl:20 +func (p *GitItemPage) StreamNavbar(qw422016 *qt422016.Writer, ctx context.Context) { +//line templates/gititem.qtpl:20 + StreamNavbar(qw422016, ctx, Git) +//line templates/gititem.qtpl:20 } -//line gititem.qtpl:18 -func (p *GitItemPage) WriteNavbar(qq422016 qtio422016.Writer) { -//line gititem.qtpl:18 +//line templates/gititem.qtpl:20 +func (p *GitItemPage) WriteNavbar(qq422016 qtio422016.Writer, ctx context.Context) { +//line templates/gititem.qtpl:20 qw422016 := qt422016.AcquireWriter(qq422016) -//line gititem.qtpl:18 - p.StreamNavbar(qw422016) -//line gititem.qtpl:18 +//line templates/gititem.qtpl:20 + p.StreamNavbar(qw422016, ctx) +//line templates/gititem.qtpl:20 qt422016.ReleaseWriter(qw422016) -//line gititem.qtpl:18 +//line templates/gititem.qtpl:20 } -//line gititem.qtpl:18 -func (p *GitItemPage) Navbar() string { -//line gititem.qtpl:18 +//line templates/gititem.qtpl:20 +func (p *GitItemPage) Navbar(ctx context.Context) string { +//line templates/gititem.qtpl:20 qb422016 := qt422016.AcquireByteBuffer() -//line gititem.qtpl:18 - p.WriteNavbar(qb422016) -//line gititem.qtpl:18 +//line templates/gititem.qtpl:20 + p.WriteNavbar(qb422016, ctx) +//line templates/gititem.qtpl:20 qs422016 := string(qb422016.B) -//line gititem.qtpl:18 +//line templates/gititem.qtpl:20 qt422016.ReleaseByteBuffer(qb422016) -//line gititem.qtpl:18 +//line templates/gititem.qtpl:20 return qs422016 -//line gititem.qtpl:18 +//line templates/gititem.qtpl:20 } -//line gititem.qtpl:20 -func (p *GitItemPage) StreamContent(qw422016 *qt422016.Writer) { -//line gititem.qtpl:20 +//line templates/gititem.qtpl:22 +func (p *GitItemPage) StreamContent(qw422016 *qt422016.Writer, ctx context.Context) { +//line templates/gititem.qtpl:22 qw422016.N().S(` `) -//line gititem.qtpl:21 +//line templates/gititem.qtpl:23 p.StreamNav(qw422016, p.Name, p.Ref) -//line gititem.qtpl:21 +//line templates/gititem.qtpl:23 qw422016.N().S(` <div class="container"> `) -//line gititem.qtpl:23 +//line templates/gititem.qtpl:25 p.StreamGitContent(qw422016, p.Name, p.Ref) -//line gititem.qtpl:23 +//line templates/gititem.qtpl:25 qw422016.N().S(` </div> `) -//line gititem.qtpl:25 +//line templates/gititem.qtpl:27 } -//line gititem.qtpl:25 -func (p *GitItemPage) WriteContent(qq422016 qtio422016.Writer) { -//line gititem.qtpl:25 +//line templates/gititem.qtpl:27 +func (p *GitItemPage) WriteContent(qq422016 qtio422016.Writer, ctx context.Context) { +//line templates/gititem.qtpl:27 qw422016 := qt422016.AcquireWriter(qq422016) -//line gititem.qtpl:25 - p.StreamContent(qw422016) -//line gititem.qtpl:25 +//line templates/gititem.qtpl:27 + p.StreamContent(qw422016, ctx) +//line templates/gititem.qtpl:27 qt422016.ReleaseWriter(qw422016) -//line gititem.qtpl:25 +//line templates/gititem.qtpl:27 } -//line gititem.qtpl:25 -func (p *GitItemPage) Content() string { -//line gititem.qtpl:25 +//line templates/gititem.qtpl:27 +func (p *GitItemPage) Content(ctx context.Context) string { +//line templates/gititem.qtpl:27 qb422016 := qt422016.AcquireByteBuffer() -//line gititem.qtpl:25 - p.WriteContent(qb422016) -//line gititem.qtpl:25 +//line templates/gititem.qtpl:27 + p.WriteContent(qb422016, ctx) +//line templates/gititem.qtpl:27 qs422016 := string(qb422016.B) -//line gititem.qtpl:25 +//line templates/gititem.qtpl:27 qt422016.ReleaseByteBuffer(qb422016) -//line gititem.qtpl:25 +//line templates/gititem.qtpl:27 return qs422016 -//line gititem.qtpl:25 +//line templates/gititem.qtpl:27 } -//line gititem.qtpl:27 -func (p *GitItemPage) StreamScript(qw422016 *qt422016.Writer) { -//line gititem.qtpl:27 +//line templates/gititem.qtpl:29 +func (p *GitItemPage) StreamScript(qw422016 *qt422016.Writer, ctx context.Context) { +//line templates/gititem.qtpl:29 qw422016.N().S(` `) -//line gititem.qtpl:28 +//line templates/gititem.qtpl:30 } -//line gititem.qtpl:28 -func (p *GitItemPage) WriteScript(qq422016 qtio422016.Writer) { -//line gititem.qtpl:28 +//line templates/gititem.qtpl:30 +func (p *GitItemPage) WriteScript(qq422016 qtio422016.Writer, ctx context.Context) { +//line templates/gititem.qtpl:30 qw422016 := qt422016.AcquireWriter(qq422016) -//line gititem.qtpl:28 - p.StreamScript(qw422016) -//line gititem.qtpl:28 +//line templates/gititem.qtpl:30 + p.StreamScript(qw422016, ctx) +//line templates/gititem.qtpl:30 qt422016.ReleaseWriter(qw422016) -//line gititem.qtpl:28 +//line templates/gititem.qtpl:30 } -//line gititem.qtpl:28 -func (p *GitItemPage) Script() string { -//line gititem.qtpl:28 +//line templates/gititem.qtpl:30 +func (p *GitItemPage) Script(ctx context.Context) string { +//line templates/gititem.qtpl:30 qb422016 := qt422016.AcquireByteBuffer() -//line gititem.qtpl:28 - p.WriteScript(qb422016) -//line gititem.qtpl:28 +//line templates/gititem.qtpl:30 + p.WriteScript(qb422016, ctx) +//line templates/gititem.qtpl:30 qs422016 := string(qb422016.B) -//line gititem.qtpl:28 +//line templates/gititem.qtpl:30 qt422016.ReleaseByteBuffer(qb422016) -//line gititem.qtpl:28 +//line templates/gititem.qtpl:30 return qs422016 -//line gititem.qtpl:28 +//line templates/gititem.qtpl:30 } diff --git a/templates/gititemabout.qtpl.go b/templates/gititemabout.qtpl.go index e1c1db4..12b4be9 100644 --- a/templates/gititemabout.qtpl.go +++ b/templates/gititemabout.qtpl.go @@ -1,97 +1,97 @@ // Code generated by qtc from "gititemabout.qtpl". DO NOT EDIT. // See https://github.com/valyala/quicktemplate for details. -//line gititemabout.qtpl:1 +//line templates/gititemabout.qtpl:1 package templates -//line gititemabout.qtpl:1 +//line templates/gititemabout.qtpl:1 import ( qtio422016 "io" qt422016 "github.com/valyala/quicktemplate" ) -//line gititemabout.qtpl:1 +//line templates/gititemabout.qtpl:1 var ( _ = qtio422016.Copy _ = qt422016.AcquireByteBuffer ) -//line gititemabout.qtpl:2 +//line templates/gititemabout.qtpl:2 type GitItemAboutPage struct { About []byte } -//line gititemabout.qtpl:7 +//line templates/gititemabout.qtpl:7 func (g *GitItemAboutPage) StreamNav(qw422016 *qt422016.Writer, name, ref string) { -//line gititemabout.qtpl:7 +//line templates/gititemabout.qtpl:7 StreamGitItemNav(qw422016, name, ref, Readme) -//line gititemabout.qtpl:7 +//line templates/gititemabout.qtpl:7 } -//line gititemabout.qtpl:7 +//line templates/gititemabout.qtpl:7 func (g *GitItemAboutPage) WriteNav(qq422016 qtio422016.Writer, name, ref string) { -//line gititemabout.qtpl:7 +//line templates/gititemabout.qtpl:7 qw422016 := qt422016.AcquireWriter(qq422016) -//line gititemabout.qtpl:7 +//line templates/gititemabout.qtpl:7 g.StreamNav(qw422016, name, ref) -//line gititemabout.qtpl:7 +//line templates/gititemabout.qtpl:7 qt422016.ReleaseWriter(qw422016) -//line gititemabout.qtpl:7 +//line templates/gititemabout.qtpl:7 } -//line gititemabout.qtpl:7 +//line templates/gititemabout.qtpl:7 func (g *GitItemAboutPage) Nav(name, ref string) string { -//line gititemabout.qtpl:7 +//line templates/gititemabout.qtpl:7 qb422016 := qt422016.AcquireByteBuffer() -//line gititemabout.qtpl:7 +//line templates/gititemabout.qtpl:7 g.WriteNav(qb422016, name, ref) -//line gititemabout.qtpl:7 +//line templates/gititemabout.qtpl:7 qs422016 := string(qb422016.B) -//line gititemabout.qtpl:7 +//line templates/gititemabout.qtpl:7 qt422016.ReleaseByteBuffer(qb422016) -//line gititemabout.qtpl:7 +//line templates/gititemabout.qtpl:7 return qs422016 -//line gititemabout.qtpl:7 +//line templates/gititemabout.qtpl:7 } -//line gititemabout.qtpl:9 +//line templates/gititemabout.qtpl:9 func (g *GitItemAboutPage) StreamGitContent(qw422016 *qt422016.Writer, name, ref string) { -//line gititemabout.qtpl:9 +//line templates/gititemabout.qtpl:9 qw422016.N().S(` <div class="m-2"> `) -//line gititemabout.qtpl:11 +//line templates/gititemabout.qtpl:11 qw422016.N().Z(g.About) -//line gititemabout.qtpl:11 +//line templates/gititemabout.qtpl:11 qw422016.N().S(` </div> `) -//line gititemabout.qtpl:13 +//line templates/gititemabout.qtpl:13 } -//line gititemabout.qtpl:13 +//line templates/gititemabout.qtpl:13 func (g *GitItemAboutPage) WriteGitContent(qq422016 qtio422016.Writer, name, ref string) { -//line gititemabout.qtpl:13 +//line templates/gititemabout.qtpl:13 qw422016 := qt422016.AcquireWriter(qq422016) -//line gititemabout.qtpl:13 +//line templates/gititemabout.qtpl:13 g.StreamGitContent(qw422016, name, ref) -//line gititemabout.qtpl:13 +//line templates/gititemabout.qtpl:13 qt422016.ReleaseWriter(qw422016) -//line gititemabout.qtpl:13 +//line templates/gititemabout.qtpl:13 } -//line gititemabout.qtpl:13 +//line templates/gititemabout.qtpl:13 func (g *GitItemAboutPage) GitContent(name, ref string) string { -//line gititemabout.qtpl:13 +//line templates/gititemabout.qtpl:13 qb422016 := qt422016.AcquireByteBuffer() -//line gititemabout.qtpl:13 +//line templates/gititemabout.qtpl:13 g.WriteGitContent(qb422016, name, ref) -//line gititemabout.qtpl:13 +//line templates/gititemabout.qtpl:13 qs422016 := string(qb422016.B) -//line gititemabout.qtpl:13 +//line templates/gititemabout.qtpl:13 qt422016.ReleaseByteBuffer(qb422016) -//line gititemabout.qtpl:13 +//line templates/gititemabout.qtpl:13 return qs422016 -//line gititemabout.qtpl:13 +//line templates/gititemabout.qtpl:13 } diff --git a/templates/gititemblob.qtpl.go b/templates/gititemblob.qtpl.go index 5d986b4..73742f6 100644 --- a/templates/gititemblob.qtpl.go +++ b/templates/gititemblob.qtpl.go @@ -1,140 +1,140 @@ // Code generated by qtc from "gititemblob.qtpl". DO NOT EDIT. // See https://github.com/valyala/quicktemplate for details. -//line gititemblob.qtpl:1 +//line templates/gititemblob.qtpl:1 package templates -//line gititemblob.qtpl:1 +//line templates/gititemblob.qtpl:1 import "git.gabrielgio.me/cerrado/pkg/u" -//line gititemblob.qtpl:3 +//line templates/gititemblob.qtpl:3 import ( qtio422016 "io" qt422016 "github.com/valyala/quicktemplate" ) -//line gititemblob.qtpl:3 +//line templates/gititemblob.qtpl:3 var ( _ = qtio422016.Copy _ = qt422016.AcquireByteBuffer ) -//line gititemblob.qtpl:4 +//line templates/gititemblob.qtpl:4 type GitItemBlobPage struct { Path []string Content []byte } -//line gititemblob.qtpl:10 +//line templates/gititemblob.qtpl:10 func (g *GitItemBlobPage) StreamNav(qw422016 *qt422016.Writer, name, ref string) { -//line gititemblob.qtpl:10 +//line templates/gititemblob.qtpl:10 StreamGitItemNav(qw422016, name, ref, Tree) -//line gititemblob.qtpl:10 +//line templates/gititemblob.qtpl:10 } -//line gititemblob.qtpl:10 +//line templates/gititemblob.qtpl:10 func (g *GitItemBlobPage) WriteNav(qq422016 qtio422016.Writer, name, ref string) { -//line gititemblob.qtpl:10 +//line templates/gititemblob.qtpl:10 qw422016 := qt422016.AcquireWriter(qq422016) -//line gititemblob.qtpl:10 +//line templates/gititemblob.qtpl:10 g.StreamNav(qw422016, name, ref) -//line gititemblob.qtpl:10 +//line templates/gititemblob.qtpl:10 qt422016.ReleaseWriter(qw422016) -//line gititemblob.qtpl:10 +//line templates/gititemblob.qtpl:10 } -//line gititemblob.qtpl:10 +//line templates/gititemblob.qtpl:10 func (g *GitItemBlobPage) Nav(name, ref string) string { -//line gititemblob.qtpl:10 +//line templates/gititemblob.qtpl:10 qb422016 := qt422016.AcquireByteBuffer() -//line gititemblob.qtpl:10 +//line templates/gititemblob.qtpl:10 g.WriteNav(qb422016, name, ref) -//line gititemblob.qtpl:10 +//line templates/gititemblob.qtpl:10 qs422016 := string(qb422016.B) -//line gititemblob.qtpl:10 +//line templates/gititemblob.qtpl:10 qt422016.ReleaseByteBuffer(qb422016) -//line gititemblob.qtpl:10 +//line templates/gititemblob.qtpl:10 return qs422016 -//line gititemblob.qtpl:10 +//line templates/gititemblob.qtpl:10 } -//line gititemblob.qtpl:12 +//line templates/gititemblob.qtpl:12 func (g *GitItemBlobPage) StreamGitContent(qw422016 *qt422016.Writer, name, ref string) { -//line gititemblob.qtpl:12 +//line templates/gititemblob.qtpl:12 qw422016.N().S(` <div class="pathing"> `) -//line gititemblob.qtpl:15 +//line templates/gititemblob.qtpl:15 if len(g.Path) != 0 { -//line gititemblob.qtpl:15 +//line templates/gititemblob.qtpl:15 qw422016.N().S(`<a href="`) -//line gititemblob.qtpl:16 +//line templates/gititemblob.qtpl:16 qw422016.E().S(url(name, Folder, ref, Root, []string{})) -//line gititemblob.qtpl:16 +//line templates/gititemblob.qtpl:16 qw422016.N().S(`">root/</a>`) -//line gititemblob.qtpl:17 +//line templates/gititemblob.qtpl:17 for i, e := range g.Path[:len(g.Path)-1] { -//line gititemblob.qtpl:17 +//line templates/gititemblob.qtpl:17 qw422016.N().S(`<a href="`) -//line gititemblob.qtpl:18 +//line templates/gititemblob.qtpl:18 qw422016.E().S(url(name, Folder, ref, Root, g.Path[:1+i])) -//line gititemblob.qtpl:18 +//line templates/gititemblob.qtpl:18 qw422016.N().S(`">`) -//line gititemblob.qtpl:18 +//line templates/gititemblob.qtpl:18 qw422016.E().S(e) -//line gititemblob.qtpl:18 +//line templates/gititemblob.qtpl:18 qw422016.N().S(`/</a>`) -//line gititemblob.qtpl:19 +//line templates/gititemblob.qtpl:19 } -//line gititemblob.qtpl:19 +//line templates/gititemblob.qtpl:19 qw422016.N().S(`<a>`) -//line gititemblob.qtpl:20 +//line templates/gititemblob.qtpl:20 qw422016.E().S(u.LastOrZero(g.Path)) -//line gititemblob.qtpl:20 +//line templates/gititemblob.qtpl:20 qw422016.N().S(`</a>`) -//line gititemblob.qtpl:21 +//line templates/gititemblob.qtpl:21 } else { -//line gititemblob.qtpl:21 +//line templates/gititemblob.qtpl:21 qw422016.N().S(`<a>root/</a>`) -//line gititemblob.qtpl:23 +//line templates/gititemblob.qtpl:23 } -//line gititemblob.qtpl:24 +//line templates/gititemblob.qtpl:24 qw422016.N().S(` </div> <div class="code-view"> `) -//line gititemblob.qtpl:27 +//line templates/gititemblob.qtpl:27 qw422016.N().Z(g.Content) -//line gititemblob.qtpl:27 +//line templates/gititemblob.qtpl:27 qw422016.N().S(` </div> `) -//line gititemblob.qtpl:29 +//line templates/gititemblob.qtpl:29 } -//line gititemblob.qtpl:29 +//line templates/gititemblob.qtpl:29 func (g *GitItemBlobPage) WriteGitContent(qq422016 qtio422016.Writer, name, ref string) { -//line gititemblob.qtpl:29 +//line templates/gititemblob.qtpl:29 qw422016 := qt422016.AcquireWriter(qq422016) -//line gititemblob.qtpl:29 +//line templates/gititemblob.qtpl:29 g.StreamGitContent(qw422016, name, ref) -//line gititemblob.qtpl:29 +//line templates/gititemblob.qtpl:29 qt422016.ReleaseWriter(qw422016) -//line gititemblob.qtpl:29 +//line templates/gititemblob.qtpl:29 } -//line gititemblob.qtpl:29 +//line templates/gititemblob.qtpl:29 func (g *GitItemBlobPage) GitContent(name, ref string) string { -//line gititemblob.qtpl:29 +//line templates/gititemblob.qtpl:29 qb422016 := qt422016.AcquireByteBuffer() -//line gititemblob.qtpl:29 +//line templates/gititemblob.qtpl:29 g.WriteGitContent(qb422016, name, ref) -//line gititemblob.qtpl:29 +//line templates/gititemblob.qtpl:29 qs422016 := string(qb422016.B) -//line gititemblob.qtpl:29 +//line templates/gititemblob.qtpl:29 qt422016.ReleaseByteBuffer(qb422016) -//line gititemblob.qtpl:29 +//line templates/gititemblob.qtpl:29 return qs422016 -//line gititemblob.qtpl:29 +//line templates/gititemblob.qtpl:29 } diff --git a/templates/gititemcommit.qtpl b/templates/gititemcommit.qtpl index d223315..7de1bdb 100644 --- a/templates/gititemcommit.qtpl +++ b/templates/gititemcommit.qtpl @@ -1,9 +1,9 @@ -{% import "github.com/go-git/go-git/v5/plumbing/object" %} +{% import "git.gabrielgio.me/cerrado/pkg/git" %} {% code type GitItemCommitPage struct { - Commit *object.Commit - Diff string + Commit *git.CommitReference + Diff []byte } %} @@ -14,6 +14,6 @@ type GitItemCommitPage struct { {%= Commit(name, g.Commit, true) %} </div> <div class="code-view"> -<pre>{%s g.Diff %}</pre> +<pre>{%z= g.Diff %}</pre> </div> {% endfunc %} diff --git a/templates/gititemcommit.qtpl.go b/templates/gititemcommit.qtpl.go index 39348ee..b790220 100644 --- a/templates/gititemcommit.qtpl.go +++ b/templates/gititemcommit.qtpl.go @@ -1,108 +1,108 @@ // Code generated by qtc from "gititemcommit.qtpl". DO NOT EDIT. // See https://github.com/valyala/quicktemplate for details. -//line gititemcommit.qtpl:1 +//line templates/gititemcommit.qtpl:1 package templates -//line gititemcommit.qtpl:1 -import "github.com/go-git/go-git/v5/plumbing/object" +//line templates/gititemcommit.qtpl:1 +import "git.gabrielgio.me/cerrado/pkg/git" -//line gititemcommit.qtpl:3 +//line templates/gititemcommit.qtpl:3 import ( qtio422016 "io" qt422016 "github.com/valyala/quicktemplate" ) -//line gititemcommit.qtpl:3 +//line templates/gititemcommit.qtpl:3 var ( _ = qtio422016.Copy _ = qt422016.AcquireByteBuffer ) -//line gititemcommit.qtpl:4 +//line templates/gititemcommit.qtpl:4 type GitItemCommitPage struct { - Commit *object.Commit - Diff string + Commit *git.CommitReference + Diff []byte } -//line gititemcommit.qtpl:10 +//line templates/gititemcommit.qtpl:10 func (g *GitItemCommitPage) StreamNav(qw422016 *qt422016.Writer, name, ref string) { -//line gititemcommit.qtpl:10 +//line templates/gititemcommit.qtpl:10 StreamGitItemNav(qw422016, name, ref, Log) -//line gititemcommit.qtpl:10 +//line templates/gititemcommit.qtpl:10 } -//line gititemcommit.qtpl:10 +//line templates/gititemcommit.qtpl:10 func (g *GitItemCommitPage) WriteNav(qq422016 qtio422016.Writer, name, ref string) { -//line gititemcommit.qtpl:10 +//line templates/gititemcommit.qtpl:10 qw422016 := qt422016.AcquireWriter(qq422016) -//line gititemcommit.qtpl:10 +//line templates/gititemcommit.qtpl:10 g.StreamNav(qw422016, name, ref) -//line gititemcommit.qtpl:10 +//line templates/gititemcommit.qtpl:10 qt422016.ReleaseWriter(qw422016) -//line gititemcommit.qtpl:10 +//line templates/gititemcommit.qtpl:10 } -//line gititemcommit.qtpl:10 +//line templates/gititemcommit.qtpl:10 func (g *GitItemCommitPage) Nav(name, ref string) string { -//line gititemcommit.qtpl:10 +//line templates/gititemcommit.qtpl:10 qb422016 := qt422016.AcquireByteBuffer() -//line gititemcommit.qtpl:10 +//line templates/gititemcommit.qtpl:10 g.WriteNav(qb422016, name, ref) -//line gititemcommit.qtpl:10 +//line templates/gititemcommit.qtpl:10 qs422016 := string(qb422016.B) -//line gititemcommit.qtpl:10 +//line templates/gititemcommit.qtpl:10 qt422016.ReleaseByteBuffer(qb422016) -//line gititemcommit.qtpl:10 +//line templates/gititemcommit.qtpl:10 return qs422016 -//line gititemcommit.qtpl:10 +//line templates/gititemcommit.qtpl:10 } -//line gititemcommit.qtpl:12 +//line templates/gititemcommit.qtpl:12 func (g *GitItemCommitPage) StreamGitContent(qw422016 *qt422016.Writer, name, ref string) { -//line gititemcommit.qtpl:12 +//line templates/gititemcommit.qtpl:12 qw422016.N().S(` <div class="event-list"> `) -//line gititemcommit.qtpl:14 +//line templates/gititemcommit.qtpl:14 StreamCommit(qw422016, name, g.Commit, true) -//line gititemcommit.qtpl:14 +//line templates/gititemcommit.qtpl:14 qw422016.N().S(` </div> <div class="code-view"> <pre>`) -//line gititemcommit.qtpl:17 - qw422016.E().S(g.Diff) -//line gititemcommit.qtpl:17 +//line templates/gititemcommit.qtpl:17 + qw422016.N().Z(g.Diff) +//line templates/gititemcommit.qtpl:17 qw422016.N().S(`</pre> </div> `) -//line gititemcommit.qtpl:19 +//line templates/gititemcommit.qtpl:19 } -//line gititemcommit.qtpl:19 +//line templates/gititemcommit.qtpl:19 func (g *GitItemCommitPage) WriteGitContent(qq422016 qtio422016.Writer, name, ref string) { -//line gititemcommit.qtpl:19 +//line templates/gititemcommit.qtpl:19 qw422016 := qt422016.AcquireWriter(qq422016) -//line gititemcommit.qtpl:19 +//line templates/gititemcommit.qtpl:19 g.StreamGitContent(qw422016, name, ref) -//line gititemcommit.qtpl:19 +//line templates/gititemcommit.qtpl:19 qt422016.ReleaseWriter(qw422016) -//line gititemcommit.qtpl:19 +//line templates/gititemcommit.qtpl:19 } -//line gititemcommit.qtpl:19 +//line templates/gititemcommit.qtpl:19 func (g *GitItemCommitPage) GitContent(name, ref string) string { -//line gititemcommit.qtpl:19 +//line templates/gititemcommit.qtpl:19 qb422016 := qt422016.AcquireByteBuffer() -//line gititemcommit.qtpl:19 +//line templates/gititemcommit.qtpl:19 g.WriteGitContent(qb422016, name, ref) -//line gititemcommit.qtpl:19 +//line templates/gititemcommit.qtpl:19 qs422016 := string(qb422016.B) -//line gititemcommit.qtpl:19 +//line templates/gititemcommit.qtpl:19 qt422016.ReleaseByteBuffer(qb422016) -//line gititemcommit.qtpl:19 +//line templates/gititemcommit.qtpl:19 return qs422016 -//line gititemcommit.qtpl:19 +//line templates/gititemcommit.qtpl:19 } diff --git a/templates/gititemlog.qtpl b/templates/gititemlog.qtpl index e5bfc1b..391de53 100644 --- a/templates/gititemlog.qtpl +++ b/templates/gititemlog.qtpl @@ -1,8 +1,10 @@ +{% import "git.gabrielgio.me/cerrado/pkg/git" %} {% import "github.com/go-git/go-git/v5/plumbing/object" %} {% code type GitItemLogPage struct { - Commits []*object.Commit + Commits []*git.CommitReference + Next *object.Commit } %} @@ -13,5 +15,9 @@ type GitItemLogPage struct { {% for _, c := range g.Commits %} {%= Commit(name, c, false) %} {% endfor %} + {% if g.Next != nil %} + <a href="/{%s name %}/log/{%s ref %}/?from={%s g.Next.Hash.String() %}" class="btn btn-primary">Next</a> + {% endif %} + </div> {% endfunc %} diff --git a/templates/gititemlog.qtpl.go b/templates/gititemlog.qtpl.go index bb37a08..2c9ce93 100644 --- a/templates/gititemlog.qtpl.go +++ b/templates/gititemlog.qtpl.go @@ -1,110 +1,138 @@ // Code generated by qtc from "gititemlog.qtpl". DO NOT EDIT. // See https://github.com/valyala/quicktemplate for details. -//line gititemlog.qtpl:1 +//line templates/gititemlog.qtpl:1 package templates -//line gititemlog.qtpl:1 +//line templates/gititemlog.qtpl:1 +import "git.gabrielgio.me/cerrado/pkg/git" + +//line templates/gititemlog.qtpl:2 import "github.com/go-git/go-git/v5/plumbing/object" -//line gititemlog.qtpl:3 +//line templates/gititemlog.qtpl:4 import ( qtio422016 "io" qt422016 "github.com/valyala/quicktemplate" ) -//line gititemlog.qtpl:3 +//line templates/gititemlog.qtpl:4 var ( _ = qtio422016.Copy _ = qt422016.AcquireByteBuffer ) -//line gititemlog.qtpl:4 +//line templates/gititemlog.qtpl:5 type GitItemLogPage struct { - Commits []*object.Commit + Commits []*git.CommitReference + Next *object.Commit } -//line gititemlog.qtpl:9 +//line templates/gititemlog.qtpl:11 func (g *GitItemLogPage) StreamNav(qw422016 *qt422016.Writer, name, ref string) { -//line gititemlog.qtpl:9 +//line templates/gititemlog.qtpl:11 StreamGitItemNav(qw422016, name, ref, Log) -//line gititemlog.qtpl:9 +//line templates/gititemlog.qtpl:11 } -//line gititemlog.qtpl:9 +//line templates/gititemlog.qtpl:11 func (g *GitItemLogPage) WriteNav(qq422016 qtio422016.Writer, name, ref string) { -//line gititemlog.qtpl:9 +//line templates/gititemlog.qtpl:11 qw422016 := qt422016.AcquireWriter(qq422016) -//line gititemlog.qtpl:9 +//line templates/gititemlog.qtpl:11 g.StreamNav(qw422016, name, ref) -//line gititemlog.qtpl:9 +//line templates/gititemlog.qtpl:11 qt422016.ReleaseWriter(qw422016) -//line gititemlog.qtpl:9 +//line templates/gititemlog.qtpl:11 } -//line gititemlog.qtpl:9 +//line templates/gititemlog.qtpl:11 func (g *GitItemLogPage) Nav(name, ref string) string { -//line gititemlog.qtpl:9 +//line templates/gititemlog.qtpl:11 qb422016 := qt422016.AcquireByteBuffer() -//line gititemlog.qtpl:9 +//line templates/gititemlog.qtpl:11 g.WriteNav(qb422016, name, ref) -//line gititemlog.qtpl:9 +//line templates/gititemlog.qtpl:11 qs422016 := string(qb422016.B) -//line gititemlog.qtpl:9 +//line templates/gititemlog.qtpl:11 qt422016.ReleaseByteBuffer(qb422016) -//line gititemlog.qtpl:9 +//line templates/gititemlog.qtpl:11 return qs422016 -//line gititemlog.qtpl:9 +//line templates/gititemlog.qtpl:11 } -//line gititemlog.qtpl:11 +//line templates/gititemlog.qtpl:13 func (g *GitItemLogPage) StreamGitContent(qw422016 *qt422016.Writer, name, ref string) { -//line gititemlog.qtpl:11 +//line templates/gititemlog.qtpl:13 qw422016.N().S(` <div class="event-list"> `) -//line gititemlog.qtpl:13 +//line templates/gititemlog.qtpl:15 for _, c := range g.Commits { -//line gititemlog.qtpl:13 +//line templates/gititemlog.qtpl:15 qw422016.N().S(` `) -//line gititemlog.qtpl:14 +//line templates/gititemlog.qtpl:16 StreamCommit(qw422016, name, c, false) -//line gititemlog.qtpl:14 +//line templates/gititemlog.qtpl:16 qw422016.N().S(` `) -//line gititemlog.qtpl:15 +//line templates/gititemlog.qtpl:17 } -//line gititemlog.qtpl:15 +//line templates/gititemlog.qtpl:17 qw422016.N().S(` + `) +//line templates/gititemlog.qtpl:18 + if g.Next != nil { +//line templates/gititemlog.qtpl:18 + qw422016.N().S(` + <a href="/`) +//line templates/gititemlog.qtpl:19 + qw422016.E().S(name) +//line templates/gititemlog.qtpl:19 + qw422016.N().S(`/log/`) +//line templates/gititemlog.qtpl:19 + qw422016.E().S(ref) +//line templates/gititemlog.qtpl:19 + qw422016.N().S(`/?from=`) +//line templates/gititemlog.qtpl:19 + qw422016.E().S(g.Next.Hash.String()) +//line templates/gititemlog.qtpl:19 + qw422016.N().S(`" class="btn btn-primary">Next</a> + `) +//line templates/gititemlog.qtpl:20 + } +//line templates/gititemlog.qtpl:20 + qw422016.N().S(` + </div> `) -//line gititemlog.qtpl:17 +//line templates/gititemlog.qtpl:23 } -//line gititemlog.qtpl:17 +//line templates/gititemlog.qtpl:23 func (g *GitItemLogPage) WriteGitContent(qq422016 qtio422016.Writer, name, ref string) { -//line gititemlog.qtpl:17 +//line templates/gititemlog.qtpl:23 qw422016 := qt422016.AcquireWriter(qq422016) -//line gititemlog.qtpl:17 +//line templates/gititemlog.qtpl:23 g.StreamGitContent(qw422016, name, ref) -//line gititemlog.qtpl:17 +//line templates/gititemlog.qtpl:23 qt422016.ReleaseWriter(qw422016) -//line gititemlog.qtpl:17 +//line templates/gititemlog.qtpl:23 } -//line gititemlog.qtpl:17 +//line templates/gititemlog.qtpl:23 func (g *GitItemLogPage) GitContent(name, ref string) string { -//line gititemlog.qtpl:17 +//line templates/gititemlog.qtpl:23 qb422016 := qt422016.AcquireByteBuffer() -//line gititemlog.qtpl:17 +//line templates/gititemlog.qtpl:23 g.WriteGitContent(qb422016, name, ref) -//line gititemlog.qtpl:17 +//line templates/gititemlog.qtpl:23 qs422016 := string(qb422016.B) -//line gititemlog.qtpl:17 +//line templates/gititemlog.qtpl:23 qt422016.ReleaseByteBuffer(qb422016) -//line gititemlog.qtpl:17 +//line templates/gititemlog.qtpl:23 return qs422016 -//line gititemlog.qtpl:17 +//line templates/gititemlog.qtpl:23 } diff --git a/templates/gititemref.qtpl b/templates/gititemref.qtpl new file mode 100644 index 0000000..9e1c776 --- /dev/null +++ b/templates/gititemref.qtpl @@ -0,0 +1,34 @@ +{% import "git.gabrielgio.me/cerrado/pkg/git" %} +{% import "git.gabrielgio.me/cerrado/pkg/humanize" %} +{% import "github.com/go-git/go-git/v5/plumbing/object" %} + +{% code +type GitItemRefPage struct { + Reference *git.TagReference + Commit *object.Commit +} +%} + +{% func (g *GitItemRefPage) Nav(name, ref string) %}{%= GitItemNav(name, ref, Refs) %}{% endfunc %} + +{% func (g *GitItemRefPage) GitContent(name, ref string) %} +<div class="event-list"> + <div class="row event"> + <div class="row"> + <div class="col-md"> + <a title="{%s g.Commit.Hash.String() %}" href="/{%s name %}/commit/{%s g.Commit.Hash.String() %}/">{%s g.Commit.Hash.String()[0:8] %}</a> — + <a title="{%s g.Commit.Committer.Email %}" href="mailto:{%s g.Commit.Author.Email %}">{%s g.Commit.Author.Name %}</a> + </div> + <div class="col-md text-md-center"> + <a title="tar.gz for {%s g.Reference.ShortName() %}" href="/{%s name %}/archive/{%s g.Reference.ShortName() %}.tar.gz">tar.gz</a> + </div> + <div class="col-md text-md-end"> + <a title="{%s g.Commit.Author.When.UTC().Format("2006-01-02 15:04:05")%} UTC">{%s humanize.Time(g.Commit.Author.When) %}</a> + </div> + </div> + <div class="code-view"> + <pre>{%s g.Reference.Message() %}</pre> + </div> + </div> +</div> +{% endfunc %} diff --git a/templates/gititemref.qtpl.go b/templates/gititemref.qtpl.go new file mode 100644 index 0000000..53ca1ec --- /dev/null +++ b/templates/gititemref.qtpl.go @@ -0,0 +1,171 @@ +// Code generated by qtc from "gititemref.qtpl". DO NOT EDIT. +// See https://github.com/valyala/quicktemplate for details. + +//line templates/gititemref.qtpl:1 +package templates + +//line templates/gititemref.qtpl:1 +import "git.gabrielgio.me/cerrado/pkg/git" + +//line templates/gititemref.qtpl:2 +import "git.gabrielgio.me/cerrado/pkg/humanize" + +//line templates/gititemref.qtpl:3 +import "github.com/go-git/go-git/v5/plumbing/object" + +//line templates/gititemref.qtpl:5 +import ( + qtio422016 "io" + + qt422016 "github.com/valyala/quicktemplate" +) + +//line templates/gititemref.qtpl:5 +var ( + _ = qtio422016.Copy + _ = qt422016.AcquireByteBuffer +) + +//line templates/gititemref.qtpl:6 +type GitItemRefPage struct { + Reference *git.TagReference + Commit *object.Commit +} + +//line templates/gititemref.qtpl:12 +func (g *GitItemRefPage) StreamNav(qw422016 *qt422016.Writer, name, ref string) { +//line templates/gititemref.qtpl:12 + StreamGitItemNav(qw422016, name, ref, Refs) +//line templates/gititemref.qtpl:12 +} + +//line templates/gititemref.qtpl:12 +func (g *GitItemRefPage) WriteNav(qq422016 qtio422016.Writer, name, ref string) { +//line templates/gititemref.qtpl:12 + qw422016 := qt422016.AcquireWriter(qq422016) +//line templates/gititemref.qtpl:12 + g.StreamNav(qw422016, name, ref) +//line templates/gititemref.qtpl:12 + qt422016.ReleaseWriter(qw422016) +//line templates/gititemref.qtpl:12 +} + +//line templates/gititemref.qtpl:12 +func (g *GitItemRefPage) Nav(name, ref string) string { +//line templates/gititemref.qtpl:12 + qb422016 := qt422016.AcquireByteBuffer() +//line templates/gititemref.qtpl:12 + g.WriteNav(qb422016, name, ref) +//line templates/gititemref.qtpl:12 + qs422016 := string(qb422016.B) +//line templates/gititemref.qtpl:12 + qt422016.ReleaseByteBuffer(qb422016) +//line templates/gititemref.qtpl:12 + return qs422016 +//line templates/gititemref.qtpl:12 +} + +//line templates/gititemref.qtpl:14 +func (g *GitItemRefPage) StreamGitContent(qw422016 *qt422016.Writer, name, ref string) { +//line templates/gititemref.qtpl:14 + qw422016.N().S(` +<div class="event-list"> + <div class="row event"> + <div class="row"> + <div class="col-md"> + <a title="`) +//line templates/gititemref.qtpl:19 + qw422016.E().S(g.Commit.Hash.String()) +//line templates/gititemref.qtpl:19 + qw422016.N().S(`" href="/`) +//line templates/gititemref.qtpl:19 + qw422016.E().S(name) +//line templates/gititemref.qtpl:19 + qw422016.N().S(`/commit/`) +//line templates/gititemref.qtpl:19 + qw422016.E().S(g.Commit.Hash.String()) +//line templates/gititemref.qtpl:19 + qw422016.N().S(`/">`) +//line templates/gititemref.qtpl:19 + qw422016.E().S(g.Commit.Hash.String()[0:8]) +//line templates/gititemref.qtpl:19 + qw422016.N().S(`</a> — + <a title="`) +//line templates/gititemref.qtpl:20 + qw422016.E().S(g.Commit.Committer.Email) +//line templates/gititemref.qtpl:20 + qw422016.N().S(`" href="mailto:`) +//line templates/gititemref.qtpl:20 + qw422016.E().S(g.Commit.Author.Email) +//line templates/gititemref.qtpl:20 + qw422016.N().S(`">`) +//line templates/gititemref.qtpl:20 + qw422016.E().S(g.Commit.Author.Name) +//line templates/gititemref.qtpl:20 + qw422016.N().S(`</a> + </div> + <div class="col-md text-md-center"> + <a title="tar.gz for `) +//line templates/gititemref.qtpl:23 + qw422016.E().S(g.Reference.ShortName()) +//line templates/gititemref.qtpl:23 + qw422016.N().S(`" href="/`) +//line templates/gititemref.qtpl:23 + qw422016.E().S(name) +//line templates/gititemref.qtpl:23 + qw422016.N().S(`/archive/`) +//line templates/gititemref.qtpl:23 + qw422016.E().S(g.Reference.ShortName()) +//line templates/gititemref.qtpl:23 + qw422016.N().S(`.tar.gz">tar.gz</a> + </div> + <div class="col-md text-md-end"> + <a title="`) +//line templates/gititemref.qtpl:26 + qw422016.E().S(g.Commit.Author.When.UTC().Format("2006-01-02 15:04:05")) +//line templates/gititemref.qtpl:26 + qw422016.N().S(` UTC">`) +//line templates/gititemref.qtpl:26 + qw422016.E().S(humanize.Time(g.Commit.Author.When)) +//line templates/gititemref.qtpl:26 + qw422016.N().S(`</a> + </div> + </div> + <div class="code-view"> + <pre>`) +//line templates/gititemref.qtpl:30 + qw422016.E().S(g.Reference.Message()) +//line templates/gititemref.qtpl:30 + qw422016.N().S(`</pre> + </div> + </div> +</div> +`) +//line templates/gititemref.qtpl:34 +} + +//line templates/gititemref.qtpl:34 +func (g *GitItemRefPage) WriteGitContent(qq422016 qtio422016.Writer, name, ref string) { +//line templates/gititemref.qtpl:34 + qw422016 := qt422016.AcquireWriter(qq422016) +//line templates/gititemref.qtpl:34 + g.StreamGitContent(qw422016, name, ref) +//line templates/gititemref.qtpl:34 + qt422016.ReleaseWriter(qw422016) +//line templates/gititemref.qtpl:34 +} + +//line templates/gititemref.qtpl:34 +func (g *GitItemRefPage) GitContent(name, ref string) string { +//line templates/gititemref.qtpl:34 + qb422016 := qt422016.AcquireByteBuffer() +//line templates/gititemref.qtpl:34 + g.WriteGitContent(qb422016, name, ref) +//line templates/gititemref.qtpl:34 + qs422016 := string(qb422016.B) +//line templates/gititemref.qtpl:34 + qt422016.ReleaseByteBuffer(qb422016) +//line templates/gititemref.qtpl:34 + return qs422016 +//line templates/gititemref.qtpl:34 +} diff --git a/templates/gititemrefs.qtpl.go b/templates/gititemrefs.qtpl.go index d54301d..eb1b657 100644 --- a/templates/gititemrefs.qtpl.go +++ b/templates/gititemrefs.qtpl.go @@ -1,160 +1,160 @@ // Code generated by qtc from "gititemrefs.qtpl". DO NOT EDIT. // See https://github.com/valyala/quicktemplate for details. -//line gititemrefs.qtpl:1 +//line templates/gititemrefs.qtpl:1 package templates -//line gititemrefs.qtpl:1 +//line templates/gititemrefs.qtpl:1 import "github.com/go-git/go-git/v5/plumbing" -//line gititemrefs.qtpl:2 +//line templates/gititemrefs.qtpl:2 import "git.gabrielgio.me/cerrado/pkg/git" -//line gititemrefs.qtpl:4 +//line templates/gititemrefs.qtpl:4 import ( qtio422016 "io" qt422016 "github.com/valyala/quicktemplate" ) -//line gititemrefs.qtpl:4 +//line templates/gititemrefs.qtpl:4 var ( _ = qtio422016.Copy _ = qt422016.AcquireByteBuffer ) -//line gititemrefs.qtpl:5 +//line templates/gititemrefs.qtpl:5 type GitItemRefsPage struct { Tags []*git.TagReference Branches []*plumbing.Reference } -//line gititemrefs.qtpl:11 +//line templates/gititemrefs.qtpl:11 func (g *GitItemRefsPage) StreamNav(qw422016 *qt422016.Writer, name, ref string) { -//line gititemrefs.qtpl:11 +//line templates/gititemrefs.qtpl:11 StreamGitItemNav(qw422016, name, ref, Refs) -//line gititemrefs.qtpl:11 +//line templates/gititemrefs.qtpl:11 } -//line gititemrefs.qtpl:11 +//line templates/gititemrefs.qtpl:11 func (g *GitItemRefsPage) WriteNav(qq422016 qtio422016.Writer, name, ref string) { -//line gititemrefs.qtpl:11 +//line templates/gititemrefs.qtpl:11 qw422016 := qt422016.AcquireWriter(qq422016) -//line gititemrefs.qtpl:11 +//line templates/gititemrefs.qtpl:11 g.StreamNav(qw422016, name, ref) -//line gititemrefs.qtpl:11 +//line templates/gititemrefs.qtpl:11 qt422016.ReleaseWriter(qw422016) -//line gititemrefs.qtpl:11 +//line templates/gititemrefs.qtpl:11 } -//line gititemrefs.qtpl:11 +//line templates/gititemrefs.qtpl:11 func (g *GitItemRefsPage) Nav(name, ref string) string { -//line gititemrefs.qtpl:11 +//line templates/gititemrefs.qtpl:11 qb422016 := qt422016.AcquireByteBuffer() -//line gititemrefs.qtpl:11 +//line templates/gititemrefs.qtpl:11 g.WriteNav(qb422016, name, ref) -//line gititemrefs.qtpl:11 +//line templates/gititemrefs.qtpl:11 qs422016 := string(qb422016.B) -//line gititemrefs.qtpl:11 +//line templates/gititemrefs.qtpl:11 qt422016.ReleaseByteBuffer(qb422016) -//line gititemrefs.qtpl:11 +//line templates/gititemrefs.qtpl:11 return qs422016 -//line gititemrefs.qtpl:11 +//line templates/gititemrefs.qtpl:11 } -//line gititemrefs.qtpl:13 +//line templates/gititemrefs.qtpl:13 func (g *GitItemRefsPage) StreamGitContent(qw422016 *qt422016.Writer, name, ref string) { -//line gititemrefs.qtpl:13 +//line templates/gititemrefs.qtpl:13 qw422016.N().S(` <div class="row"> <div class="col-md-8"> `) -//line gititemrefs.qtpl:16 +//line templates/gititemrefs.qtpl:16 StreamListTags(qw422016, name, g.Tags) -//line gititemrefs.qtpl:16 +//line templates/gititemrefs.qtpl:16 qw422016.N().S(` </div> <div class="col-md-4"> <div class="event-list"> `) -//line gititemrefs.qtpl:20 +//line templates/gititemrefs.qtpl:20 for _, b := range g.Branches { -//line gititemrefs.qtpl:20 +//line templates/gititemrefs.qtpl:20 qw422016.N().S(` <div class="row event"> <div class="col-4"> `) -//line gititemrefs.qtpl:23 +//line templates/gititemrefs.qtpl:23 qw422016.E().S(b.Name().Short()) -//line gititemrefs.qtpl:23 +//line templates/gititemrefs.qtpl:23 qw422016.N().S(` </div> <div class="col-8"> <div class="float-end"> <a href="/`) -//line gititemrefs.qtpl:27 +//line templates/gititemrefs.qtpl:27 qw422016.E().S(name) -//line gititemrefs.qtpl:27 +//line templates/gititemrefs.qtpl:27 qw422016.N().S(`/archive/`) -//line gititemrefs.qtpl:27 +//line templates/gititemrefs.qtpl:27 qw422016.E().S(b.Name().Short()) -//line gititemrefs.qtpl:27 +//line templates/gititemrefs.qtpl:27 qw422016.N().S(`.tar.gz">tar.gz</a> <a href="/`) -//line gititemrefs.qtpl:28 +//line templates/gititemrefs.qtpl:28 qw422016.E().S(name) -//line gititemrefs.qtpl:28 +//line templates/gititemrefs.qtpl:28 qw422016.N().S(`/tree/`) -//line gititemrefs.qtpl:28 +//line templates/gititemrefs.qtpl:28 qw422016.E().S(b.Name().Short()) -//line gititemrefs.qtpl:28 +//line templates/gititemrefs.qtpl:28 qw422016.N().S(`/">tree</a> <a href="/`) -//line gititemrefs.qtpl:29 +//line templates/gititemrefs.qtpl:29 qw422016.E().S(name) -//line gititemrefs.qtpl:29 +//line templates/gititemrefs.qtpl:29 qw422016.N().S(`/log/`) -//line gititemrefs.qtpl:29 +//line templates/gititemrefs.qtpl:29 qw422016.E().S(b.Name().Short()) -//line gititemrefs.qtpl:29 +//line templates/gititemrefs.qtpl:29 qw422016.N().S(`/">log</a> </div> </div> </div> `) -//line gititemrefs.qtpl:33 +//line templates/gititemrefs.qtpl:33 } -//line gititemrefs.qtpl:33 +//line templates/gititemrefs.qtpl:33 qw422016.N().S(` </div> </div> </div> `) -//line gititemrefs.qtpl:37 +//line templates/gititemrefs.qtpl:37 } -//line gititemrefs.qtpl:37 +//line templates/gititemrefs.qtpl:37 func (g *GitItemRefsPage) WriteGitContent(qq422016 qtio422016.Writer, name, ref string) { -//line gititemrefs.qtpl:37 +//line templates/gititemrefs.qtpl:37 qw422016 := qt422016.AcquireWriter(qq422016) -//line gititemrefs.qtpl:37 +//line templates/gititemrefs.qtpl:37 g.StreamGitContent(qw422016, name, ref) -//line gititemrefs.qtpl:37 +//line templates/gititemrefs.qtpl:37 qt422016.ReleaseWriter(qw422016) -//line gititemrefs.qtpl:37 +//line templates/gititemrefs.qtpl:37 } -//line gititemrefs.qtpl:37 +//line templates/gititemrefs.qtpl:37 func (g *GitItemRefsPage) GitContent(name, ref string) string { -//line gititemrefs.qtpl:37 +//line templates/gititemrefs.qtpl:37 qb422016 := qt422016.AcquireByteBuffer() -//line gititemrefs.qtpl:37 +//line templates/gititemrefs.qtpl:37 g.WriteGitContent(qb422016, name, ref) -//line gititemrefs.qtpl:37 +//line templates/gititemrefs.qtpl:37 qs422016 := string(qb422016.B) -//line gititemrefs.qtpl:37 +//line templates/gititemrefs.qtpl:37 qt422016.ReleaseByteBuffer(qb422016) -//line gititemrefs.qtpl:37 +//line templates/gititemrefs.qtpl:37 return qs422016 -//line gititemrefs.qtpl:37 +//line templates/gititemrefs.qtpl:37 } diff --git a/templates/gititemsummary.qtpl b/templates/gititemsummary.qtpl index f2de5be..f39a613 100644 --- a/templates/gititemsummary.qtpl +++ b/templates/gititemsummary.qtpl @@ -1,12 +1,11 @@ {% import "github.com/go-git/go-git/v5/plumbing" %} -{% import "github.com/go-git/go-git/v5/plumbing/object" %} {% import "git.gabrielgio.me/cerrado/pkg/git" %} {% code type GitItemSummaryPage struct { Tags []*git.TagReference Branches []*plumbing.Reference - Commits []*object.Commit + Commits []*git.CommitReference } %} @@ -35,6 +34,7 @@ type GitItemSummaryPage struct { {% endfor %} </div> </div> + <a class="more" href="/{%s name %}/refs/">[ see refs... ]</a> </div> <div class="row"> <div class="event-list"> @@ -42,5 +42,6 @@ type GitItemSummaryPage struct { {%= Commit(name, c, false) %} {% endfor %} </div> + <a class="more" href="/{%s name %}/log/{%s ref %}/">[ see log... ]</a> </div> {% endfunc %} diff --git a/templates/gititemsummary.qtpl.go b/templates/gititemsummary.qtpl.go index d70823e..d6d20cb 100644 --- a/templates/gititemsummary.qtpl.go +++ b/templates/gititemsummary.qtpl.go @@ -1,183 +1,194 @@ // Code generated by qtc from "gititemsummary.qtpl". DO NOT EDIT. // See https://github.com/valyala/quicktemplate for details. -//line gititemsummary.qtpl:1 +//line templates/gititemsummary.qtpl:1 package templates -//line gititemsummary.qtpl:1 +//line templates/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:3 +//line templates/gititemsummary.qtpl:2 import "git.gabrielgio.me/cerrado/pkg/git" -//line gititemsummary.qtpl:5 +//line templates/gititemsummary.qtpl:4 import ( qtio422016 "io" qt422016 "github.com/valyala/quicktemplate" ) -//line gititemsummary.qtpl:5 +//line templates/gititemsummary.qtpl:4 var ( _ = qtio422016.Copy _ = qt422016.AcquireByteBuffer ) -//line gititemsummary.qtpl:6 +//line templates/gititemsummary.qtpl:5 type GitItemSummaryPage struct { Tags []*git.TagReference Branches []*plumbing.Reference - Commits []*object.Commit + Commits []*git.CommitReference } -//line gititemsummary.qtpl:13 +//line templates/gititemsummary.qtpl:12 func (g *GitItemSummaryPage) StreamNav(qw422016 *qt422016.Writer, name, ref string) { -//line gititemsummary.qtpl:13 +//line templates/gititemsummary.qtpl:12 StreamGitItemNav(qw422016, name, ref, Summary) -//line gititemsummary.qtpl:13 +//line templates/gititemsummary.qtpl:12 } -//line gititemsummary.qtpl:13 +//line templates/gititemsummary.qtpl:12 func (g *GitItemSummaryPage) WriteNav(qq422016 qtio422016.Writer, name, ref string) { -//line gititemsummary.qtpl:13 +//line templates/gititemsummary.qtpl:12 qw422016 := qt422016.AcquireWriter(qq422016) -//line gititemsummary.qtpl:13 +//line templates/gititemsummary.qtpl:12 g.StreamNav(qw422016, name, ref) -//line gititemsummary.qtpl:13 +//line templates/gititemsummary.qtpl:12 qt422016.ReleaseWriter(qw422016) -//line gititemsummary.qtpl:13 +//line templates/gititemsummary.qtpl:12 } -//line gititemsummary.qtpl:13 +//line templates/gititemsummary.qtpl:12 func (g *GitItemSummaryPage) Nav(name, ref string) string { -//line gititemsummary.qtpl:13 +//line templates/gititemsummary.qtpl:12 qb422016 := qt422016.AcquireByteBuffer() -//line gititemsummary.qtpl:13 +//line templates/gititemsummary.qtpl:12 g.WriteNav(qb422016, name, ref) -//line gititemsummary.qtpl:13 +//line templates/gititemsummary.qtpl:12 qs422016 := string(qb422016.B) -//line gititemsummary.qtpl:13 +//line templates/gititemsummary.qtpl:12 qt422016.ReleaseByteBuffer(qb422016) -//line gititemsummary.qtpl:13 +//line templates/gititemsummary.qtpl:12 return qs422016 -//line gititemsummary.qtpl:13 +//line templates/gititemsummary.qtpl:12 } -//line gititemsummary.qtpl:15 +//line templates/gititemsummary.qtpl:14 func (g *GitItemSummaryPage) StreamGitContent(qw422016 *qt422016.Writer, name, ref string) { -//line gititemsummary.qtpl:15 +//line templates/gititemsummary.qtpl:14 qw422016.N().S(` <div class="row"> <div class="col-md-8"> `) -//line gititemsummary.qtpl:18 +//line templates/gititemsummary.qtpl:17 StreamListTags(qw422016, name, g.Tags) -//line gititemsummary.qtpl:18 +//line templates/gititemsummary.qtpl:17 qw422016.N().S(` </div> <div class="col-md-4"> <div class="event-list"> `) -//line gititemsummary.qtpl:22 +//line templates/gititemsummary.qtpl:21 for _, b := range g.Branches { -//line gititemsummary.qtpl:22 +//line templates/gititemsummary.qtpl:21 qw422016.N().S(` <div class="row event"> <div class="col-4"> `) -//line gititemsummary.qtpl:25 +//line templates/gititemsummary.qtpl:24 qw422016.E().S(b.Name().Short()) -//line gititemsummary.qtpl:25 +//line templates/gititemsummary.qtpl:24 qw422016.N().S(` </div> <div class="col-8"> <div class="float-end"> <a href="/`) -//line gititemsummary.qtpl:29 +//line templates/gititemsummary.qtpl:28 qw422016.E().S(name) -//line gititemsummary.qtpl:29 +//line templates/gititemsummary.qtpl:28 qw422016.N().S(`/archive/`) -//line gititemsummary.qtpl:29 +//line templates/gititemsummary.qtpl:28 qw422016.E().S(b.Name().Short()) -//line gititemsummary.qtpl:29 +//line templates/gititemsummary.qtpl:28 qw422016.N().S(`.tar.gz">tar.gz</a> <a href="/`) -//line gititemsummary.qtpl:30 +//line templates/gititemsummary.qtpl:29 qw422016.E().S(name) -//line gititemsummary.qtpl:30 +//line templates/gititemsummary.qtpl:29 qw422016.N().S(`/tree/`) -//line gititemsummary.qtpl:30 +//line templates/gititemsummary.qtpl:29 qw422016.E().S(b.Name().Short()) -//line gititemsummary.qtpl:30 +//line templates/gititemsummary.qtpl:29 qw422016.N().S(`/">tree</a> <a href="/`) -//line gititemsummary.qtpl:31 +//line templates/gititemsummary.qtpl:30 qw422016.E().S(name) -//line gititemsummary.qtpl:31 +//line templates/gititemsummary.qtpl:30 qw422016.N().S(`/log/`) -//line gititemsummary.qtpl:31 +//line templates/gititemsummary.qtpl:30 qw422016.E().S(b.Name().Short()) -//line gititemsummary.qtpl:31 +//line templates/gititemsummary.qtpl:30 qw422016.N().S(`/">log</a> </div> </div> </div> `) -//line gititemsummary.qtpl:35 +//line templates/gititemsummary.qtpl:34 } -//line gititemsummary.qtpl:35 +//line templates/gititemsummary.qtpl:34 qw422016.N().S(` </div> </div> + <a class="more" href="/`) +//line templates/gititemsummary.qtpl:37 + qw422016.E().S(name) +//line templates/gititemsummary.qtpl:37 + qw422016.N().S(`/refs/">[ see refs... ]</a> </div> <div class="row"> <div class="event-list"> `) -//line gititemsummary.qtpl:41 +//line templates/gititemsummary.qtpl:41 for _, c := range g.Commits { -//line gititemsummary.qtpl:41 +//line templates/gititemsummary.qtpl:41 qw422016.N().S(` `) -//line gititemsummary.qtpl:42 +//line templates/gititemsummary.qtpl:42 StreamCommit(qw422016, name, c, false) -//line gititemsummary.qtpl:42 +//line templates/gititemsummary.qtpl:42 qw422016.N().S(` `) -//line gititemsummary.qtpl:43 +//line templates/gititemsummary.qtpl:43 } -//line gititemsummary.qtpl:43 +//line templates/gititemsummary.qtpl:43 qw422016.N().S(` </div> + <a class="more" href="/`) +//line templates/gititemsummary.qtpl:45 + qw422016.E().S(name) +//line templates/gititemsummary.qtpl:45 + qw422016.N().S(`/log/`) +//line templates/gititemsummary.qtpl:45 + qw422016.E().S(ref) +//line templates/gititemsummary.qtpl:45 + qw422016.N().S(`/">[ see log... ]</a> </div> `) -//line gititemsummary.qtpl:46 +//line templates/gititemsummary.qtpl:47 } -//line gititemsummary.qtpl:46 +//line templates/gititemsummary.qtpl:47 func (g *GitItemSummaryPage) WriteGitContent(qq422016 qtio422016.Writer, name, ref string) { -//line gititemsummary.qtpl:46 +//line templates/gititemsummary.qtpl:47 qw422016 := qt422016.AcquireWriter(qq422016) -//line gititemsummary.qtpl:46 +//line templates/gititemsummary.qtpl:47 g.StreamGitContent(qw422016, name, ref) -//line gititemsummary.qtpl:46 +//line templates/gititemsummary.qtpl:47 qt422016.ReleaseWriter(qw422016) -//line gititemsummary.qtpl:46 +//line templates/gititemsummary.qtpl:47 } -//line gititemsummary.qtpl:46 +//line templates/gititemsummary.qtpl:47 func (g *GitItemSummaryPage) GitContent(name, ref string) string { -//line gititemsummary.qtpl:46 +//line templates/gititemsummary.qtpl:47 qb422016 := qt422016.AcquireByteBuffer() -//line gititemsummary.qtpl:46 +//line templates/gititemsummary.qtpl:47 g.WriteGitContent(qb422016, name, ref) -//line gititemsummary.qtpl:46 +//line templates/gititemsummary.qtpl:47 qs422016 := string(qb422016.B) -//line gititemsummary.qtpl:46 +//line templates/gititemsummary.qtpl:47 qt422016.ReleaseByteBuffer(qb422016) -//line gititemsummary.qtpl:46 +//line templates/gititemsummary.qtpl:47 return qs422016 -//line gititemsummary.qtpl:46 +//line templates/gititemsummary.qtpl:47 } diff --git a/templates/gititemtree.qtpl b/templates/gititemtree.qtpl index 5898506..2753e24 100644 --- a/templates/gititemtree.qtpl +++ b/templates/gititemtree.qtpl @@ -1,5 +1,6 @@ {% import "git.gabrielgio.me/cerrado/pkg/u" %} {% import "github.com/go-git/go-git/v5/plumbing/object" %} +{% import "github.com/go-git/go-git/v5/plumbing/filemode" %} {% code type GitItemTreePage struct { Path []string @@ -52,10 +53,14 @@ <div class="size"></div> {% endif %} {% for _, e := range g.Tree.Entries %} - <div class="mode">{%s Ignore(e.Mode.ToOSFileMode()).String() %}</div> {% if e.Mode.IsFile() %} + <div class="mode">{%s Ignore(e.Mode.ToOSFileMode()).String() %}</div> <div class="name blob"><a href="{%s url(name, Blob, ref, e.Name, g.Path) %}">{%s e.Name %}</a></div> + {% elseif e.Mode == filemode.Submodule %} + <div class="mode">m---------</div> + <div class="name tree">{%s e.Name %} (submodule)</div> {% else %} + <div class="mode">d---------</div> <div class="name tree"><a href="{%s url(name, Folder, ref, e.Name, g.Path) %}">{%s e.Name %}</a></div> {% endif %} <div class="commit"></div> diff --git a/templates/gititemtree.qtpl.go b/templates/gititemtree.qtpl.go index f8d1fd2..9116cd7 100644 --- a/templates/gititemtree.qtpl.go +++ b/templates/gititemtree.qtpl.go @@ -1,42 +1,45 @@ // Code generated by qtc from "gititemtree.qtpl". DO NOT EDIT. // See https://github.com/valyala/quicktemplate for details. -//line gititemtree.qtpl:1 +//line templates/gititemtree.qtpl:1 package templates -//line gititemtree.qtpl:1 +//line templates/gititemtree.qtpl:1 import "git.gabrielgio.me/cerrado/pkg/u" -//line gititemtree.qtpl:2 +//line templates/gititemtree.qtpl:2 import "github.com/go-git/go-git/v5/plumbing/object" -//line gititemtree.qtpl:4 +//line templates/gititemtree.qtpl:3 +import "github.com/go-git/go-git/v5/plumbing/filemode" + +//line templates/gititemtree.qtpl:5 import ( qtio422016 "io" qt422016 "github.com/valyala/quicktemplate" ) -//line gititemtree.qtpl:4 +//line templates/gititemtree.qtpl:5 var ( _ = qtio422016.Copy _ = qt422016.AcquireByteBuffer ) -//line gititemtree.qtpl:4 +//line templates/gititemtree.qtpl:5 type GitItemTreePage struct { Path []string Tree *object.Tree } -//line gititemtree.qtpl:10 +//line templates/gititemtree.qtpl:11 const ( Folder = "tree" Blob = "blob" Root = "" ) -//line gititemtree.qtpl:17 +//line templates/gititemtree.qtpl:18 func url(name, mode, ref, filename string, path []string) string { return u.NewPathing(). AddPath(name). @@ -47,188 +50,200 @@ func url(name, mode, ref, filename string, path []string) string { Done() } -//line gititemtree.qtpl:28 +//line templates/gititemtree.qtpl:29 func (g *GitItemTreePage) StreamNav(qw422016 *qt422016.Writer, name, ref string) { -//line gititemtree.qtpl:28 +//line templates/gititemtree.qtpl:29 StreamGitItemNav(qw422016, name, ref, Tree) -//line gititemtree.qtpl:28 +//line templates/gititemtree.qtpl:29 } -//line gititemtree.qtpl:28 +//line templates/gititemtree.qtpl:29 func (g *GitItemTreePage) WriteNav(qq422016 qtio422016.Writer, name, ref string) { -//line gititemtree.qtpl:28 +//line templates/gititemtree.qtpl:29 qw422016 := qt422016.AcquireWriter(qq422016) -//line gititemtree.qtpl:28 +//line templates/gititemtree.qtpl:29 g.StreamNav(qw422016, name, ref) -//line gititemtree.qtpl:28 +//line templates/gititemtree.qtpl:29 qt422016.ReleaseWriter(qw422016) -//line gititemtree.qtpl:28 +//line templates/gititemtree.qtpl:29 } -//line gititemtree.qtpl:28 +//line templates/gititemtree.qtpl:29 func (g *GitItemTreePage) Nav(name, ref string) string { -//line gititemtree.qtpl:28 +//line templates/gititemtree.qtpl:29 qb422016 := qt422016.AcquireByteBuffer() -//line gititemtree.qtpl:28 +//line templates/gititemtree.qtpl:29 g.WriteNav(qb422016, name, ref) -//line gititemtree.qtpl:28 +//line templates/gititemtree.qtpl:29 qs422016 := string(qb422016.B) -//line gititemtree.qtpl:28 +//line templates/gititemtree.qtpl:29 qt422016.ReleaseByteBuffer(qb422016) -//line gititemtree.qtpl:28 +//line templates/gititemtree.qtpl:29 return qs422016 -//line gititemtree.qtpl:28 +//line templates/gititemtree.qtpl:29 } -//line gititemtree.qtpl:30 +//line templates/gititemtree.qtpl:31 func (g *GitItemTreePage) StreamGitContent(qw422016 *qt422016.Writer, name, ref string) { -//line gititemtree.qtpl:30 +//line templates/gititemtree.qtpl:31 qw422016.N().S(` <div class="pathing"> `) -//line gititemtree.qtpl:33 +//line templates/gititemtree.qtpl:34 if len(g.Path) != 0 { -//line gititemtree.qtpl:33 +//line templates/gititemtree.qtpl:34 qw422016.N().S(`<a href="`) -//line gititemtree.qtpl:34 +//line templates/gititemtree.qtpl:35 qw422016.E().S(url(name, Folder, ref, Root, []string{})) -//line gititemtree.qtpl:34 +//line templates/gititemtree.qtpl:35 qw422016.N().S(`">root/</a>`) -//line gititemtree.qtpl:35 +//line templates/gititemtree.qtpl:36 for i, e := range g.Path[:len(g.Path)-1] { -//line gititemtree.qtpl:35 +//line templates/gititemtree.qtpl:36 qw422016.N().S(`<a href="`) -//line gititemtree.qtpl:36 +//line templates/gititemtree.qtpl:37 qw422016.E().S(url(name, Folder, ref, Root, g.Path[:1+i])) -//line gititemtree.qtpl:36 +//line templates/gititemtree.qtpl:37 qw422016.N().S(`">`) -//line gititemtree.qtpl:36 +//line templates/gititemtree.qtpl:37 qw422016.E().S(e) -//line gititemtree.qtpl:36 +//line templates/gititemtree.qtpl:37 qw422016.N().S(`/</a>`) -//line gititemtree.qtpl:37 +//line templates/gititemtree.qtpl:38 } -//line gititemtree.qtpl:37 +//line templates/gititemtree.qtpl:38 qw422016.N().S(`<a>`) -//line gititemtree.qtpl:38 +//line templates/gititemtree.qtpl:39 qw422016.E().S(u.LastOrZero(g.Path)) -//line gititemtree.qtpl:38 +//line templates/gititemtree.qtpl:39 qw422016.N().S(`</a>`) -//line gititemtree.qtpl:39 +//line templates/gititemtree.qtpl:40 } else { -//line gititemtree.qtpl:39 +//line templates/gititemtree.qtpl:40 qw422016.N().S(`<a>root/</a>`) -//line gititemtree.qtpl:41 +//line templates/gititemtree.qtpl:42 } -//line gititemtree.qtpl:42 +//line templates/gititemtree.qtpl:43 qw422016.N().S(` </div> <div class="row"> <div class="col-md-12"> <div class="tree-list"> `) -//line gititemtree.qtpl:47 +//line templates/gititemtree.qtpl:48 if len(g.Path) != 0 { -//line gititemtree.qtpl:47 +//line templates/gititemtree.qtpl:48 qw422016.N().S(` <div class="mode"><a href="`) -//line gititemtree.qtpl:48 +//line templates/gititemtree.qtpl:49 qw422016.E().S(url(name, Folder, ref, g.Path[len(g.Path)-1], g.Path[:len(g.Path)-1])) -//line gititemtree.qtpl:48 +//line templates/gititemtree.qtpl:49 qw422016.N().S(`">..</a></div> <div class="name tree"></div> <div class="commit"></div> <div class="date"></div> <div class="size"></div> `) -//line gititemtree.qtpl:53 +//line templates/gititemtree.qtpl:54 } -//line gititemtree.qtpl:53 +//line templates/gititemtree.qtpl:54 qw422016.N().S(` `) -//line gititemtree.qtpl:54 +//line templates/gititemtree.qtpl:55 for _, e := range g.Tree.Entries { -//line gititemtree.qtpl:54 +//line templates/gititemtree.qtpl:55 qw422016.N().S(` - <div class="mode">`) -//line gititemtree.qtpl:55 - qw422016.E().S(Ignore(e.Mode.ToOSFileMode()).String()) -//line gititemtree.qtpl:55 - qw422016.N().S(`</div> `) -//line gititemtree.qtpl:56 +//line templates/gititemtree.qtpl:56 if e.Mode.IsFile() { -//line gititemtree.qtpl:56 +//line templates/gititemtree.qtpl:56 qw422016.N().S(` + <div class="mode">`) +//line templates/gititemtree.qtpl:57 + qw422016.E().S(Ignore(e.Mode.ToOSFileMode()).String()) +//line templates/gititemtree.qtpl:57 + qw422016.N().S(`</div> <div class="name blob"><a href="`) -//line gititemtree.qtpl:57 +//line templates/gititemtree.qtpl:58 qw422016.E().S(url(name, Blob, ref, e.Name, g.Path)) -//line gititemtree.qtpl:57 +//line templates/gititemtree.qtpl:58 qw422016.N().S(`">`) -//line gititemtree.qtpl:57 +//line templates/gititemtree.qtpl:58 qw422016.E().S(e.Name) -//line gititemtree.qtpl:57 +//line templates/gititemtree.qtpl:58 qw422016.N().S(`</a></div> `) -//line gititemtree.qtpl:58 +//line templates/gititemtree.qtpl:59 + } else if e.Mode == filemode.Submodule { +//line templates/gititemtree.qtpl:59 + qw422016.N().S(` + <div class="mode">m---------</div> + <div class="name tree">`) +//line templates/gititemtree.qtpl:61 + qw422016.E().S(e.Name) +//line templates/gititemtree.qtpl:61 + qw422016.N().S(` (submodule)</div> + `) +//line templates/gititemtree.qtpl:62 } else { -//line gititemtree.qtpl:58 +//line templates/gititemtree.qtpl:62 qw422016.N().S(` + <div class="mode">d---------</div> <div class="name tree"><a href="`) -//line gititemtree.qtpl:59 +//line templates/gititemtree.qtpl:64 qw422016.E().S(url(name, Folder, ref, e.Name, g.Path)) -//line gititemtree.qtpl:59 +//line templates/gititemtree.qtpl:64 qw422016.N().S(`">`) -//line gititemtree.qtpl:59 +//line templates/gititemtree.qtpl:64 qw422016.E().S(e.Name) -//line gititemtree.qtpl:59 +//line templates/gititemtree.qtpl:64 qw422016.N().S(`</a></div> `) -//line gititemtree.qtpl:60 +//line templates/gititemtree.qtpl:65 } -//line gititemtree.qtpl:60 +//line templates/gititemtree.qtpl:65 qw422016.N().S(` <div class="commit"></div> <div class="date"></div> <div class="size">`) -//line gititemtree.qtpl:63 +//line templates/gititemtree.qtpl:68 qw422016.N().DL(Ignore(g.Tree.Size(e.Name))) -//line gititemtree.qtpl:63 +//line templates/gititemtree.qtpl:68 qw422016.N().S(` KiB</div> `) -//line gititemtree.qtpl:64 +//line templates/gititemtree.qtpl:69 } -//line gititemtree.qtpl:64 +//line templates/gititemtree.qtpl:69 qw422016.N().S(` </div> </div> </div> `) -//line gititemtree.qtpl:68 +//line templates/gititemtree.qtpl:73 } -//line gititemtree.qtpl:68 +//line templates/gititemtree.qtpl:73 func (g *GitItemTreePage) WriteGitContent(qq422016 qtio422016.Writer, name, ref string) { -//line gititemtree.qtpl:68 +//line templates/gititemtree.qtpl:73 qw422016 := qt422016.AcquireWriter(qq422016) -//line gititemtree.qtpl:68 +//line templates/gititemtree.qtpl:73 g.StreamGitContent(qw422016, name, ref) -//line gititemtree.qtpl:68 +//line templates/gititemtree.qtpl:73 qt422016.ReleaseWriter(qw422016) -//line gititemtree.qtpl:68 +//line templates/gititemtree.qtpl:73 } -//line gititemtree.qtpl:68 +//line templates/gititemtree.qtpl:73 func (g *GitItemTreePage) GitContent(name, ref string) string { -//line gititemtree.qtpl:68 +//line templates/gititemtree.qtpl:73 qb422016 := qt422016.AcquireByteBuffer() -//line gititemtree.qtpl:68 +//line templates/gititemtree.qtpl:73 g.WriteGitContent(qb422016, name, ref) -//line gititemtree.qtpl:68 +//line templates/gititemtree.qtpl:73 qs422016 := string(qb422016.B) -//line gititemtree.qtpl:68 +//line templates/gititemtree.qtpl:73 qt422016.ReleaseByteBuffer(qb422016) -//line gititemtree.qtpl:68 +//line templates/gititemtree.qtpl:73 return qs422016 -//line gititemtree.qtpl:68 +//line templates/gititemtree.qtpl:73 } diff --git a/templates/gitlist.qtpl b/templates/gitlist.qtpl index ff2eca9..9756eb7 100644 --- a/templates/gitlist.qtpl +++ b/templates/gitlist.qtpl @@ -1,4 +1,7 @@ +{% import "git.gabrielgio.me/cerrado/pkg/humanize" %} {% import "git.gabrielgio.me/cerrado/pkg/service" %} +{% import "context" %} +{% import "strings" %} {% code type GitListPage struct { @@ -7,21 +10,41 @@ type GitListPage struct { } %} -{% func (p *GitListPage) Title() %}Git | List{% endfunc %} -{% func (p *GitListPage) Navbar() %}{%= Navbar(Git) %}{% endfunc %} +{% code func firstLine(text string) string { + lines := strings.Split(text, "\n") + if len(lines) > 0 { + return lines[0] + } + return "" +} +%} + +{% func (p *GitListPage) Title(ctx context.Context) %}Git | List{% endfunc %} + +{% func (p *GitListPage) Navbar(ctx context.Context) %}{%= Navbar(ctx, Git) %}{% endfunc %} -{% func (p *GitListPage) Content() %} +{% func (p *GitListPage) Content(ctx context.Context) %} <div class="row"> <div class="col-md-6 order-last order-md-first"> <div class="event-list"> {% for _, r := range p.Respositories %} <div class="event"> - <h4> - <a href="/{%s r.Name %}/">{%s r.Name %}</a> - </h4> + <div class="row"> + <div class="col-md"> + <a href="/{%s r.Name %}/">{%s r.Name %}</a> + </div> + <div class="col-md text-md-end"> + <small>{% if !r.Public %}private{% endif %}</small> + </div> + </div> </hr> <p>{%s r.Description %}</p> + <div class="event-commit row"> + <a class="col-xl-2" title="{%s r.LastCommit.Commit().Hash.String() %}" href="/{%s r.Name %}/commit/{%s r.LastCommit.Commit().Hash.String() %}/">{%s r.LastCommit.Commit().Hash.String()[0:8] %}</a> + <a class="col-xl-7"> {%s firstLine(r.LastCommit.Commit().Message) %}</a> + <a class="col-xl-3" title="{%s r.LastCommit.Commit().Author.When.UTC().Format("2006-01-02 15:04:05")%} UTC">{%s humanize.Time(r.LastCommit.Commit().Author.When) %}</a> + </div> <p> <a href="/{%s r.Name %}/log/{%s r.Ref %}/">log</a> <a href="/{%s r.Name %}/tree/{%s r.Ref %}/">tree</a> @@ -37,5 +60,5 @@ type GitListPage struct { </div> {% endfunc %} -{% func (p *GitListPage) Script() %} +{% func (p *GitListPage) Script(ctx context.Context) %} {% endfunc %} diff --git a/templates/gitlist.qtpl.go b/templates/gitlist.qtpl.go index f38c404..97b570b 100644 --- a/templates/gitlist.qtpl.go +++ b/templates/gitlist.qtpl.go @@ -1,228 +1,292 @@ // Code generated by qtc from "gitlist.qtpl". DO NOT EDIT. // See https://github.com/valyala/quicktemplate for details. -//line gitlist.qtpl:1 +//line templates/gitlist.qtpl:1 package templates -//line gitlist.qtpl:1 +//line templates/gitlist.qtpl:1 +import "git.gabrielgio.me/cerrado/pkg/humanize" + +//line templates/gitlist.qtpl:2 import "git.gabrielgio.me/cerrado/pkg/service" -//line gitlist.qtpl:3 +//line templates/gitlist.qtpl:3 +import "context" + +//line templates/gitlist.qtpl:4 +import "strings" + +//line templates/gitlist.qtpl:6 import ( qtio422016 "io" qt422016 "github.com/valyala/quicktemplate" ) -//line gitlist.qtpl:3 +//line templates/gitlist.qtpl:6 var ( _ = qtio422016.Copy _ = qt422016.AcquireByteBuffer ) -//line gitlist.qtpl:4 +//line templates/gitlist.qtpl:7 type GitListPage struct { Respositories []*service.Repository About []byte } -//line gitlist.qtpl:10 -func (p *GitListPage) StreamTitle(qw422016 *qt422016.Writer) { -//line gitlist.qtpl:10 +//line templates/gitlist.qtpl:14 +func firstLine(text string) string { + lines := strings.Split(text, "\n") + if len(lines) > 0 { + return lines[0] + } + return "" +} + +//line templates/gitlist.qtpl:23 +func (p *GitListPage) StreamTitle(qw422016 *qt422016.Writer, ctx context.Context) { +//line templates/gitlist.qtpl:23 qw422016.N().S(`Git | List`) -//line gitlist.qtpl:10 +//line templates/gitlist.qtpl:23 } -//line gitlist.qtpl:10 -func (p *GitListPage) WriteTitle(qq422016 qtio422016.Writer) { -//line gitlist.qtpl:10 +//line templates/gitlist.qtpl:23 +func (p *GitListPage) WriteTitle(qq422016 qtio422016.Writer, ctx context.Context) { +//line templates/gitlist.qtpl:23 qw422016 := qt422016.AcquireWriter(qq422016) -//line gitlist.qtpl:10 - p.StreamTitle(qw422016) -//line gitlist.qtpl:10 +//line templates/gitlist.qtpl:23 + p.StreamTitle(qw422016, ctx) +//line templates/gitlist.qtpl:23 qt422016.ReleaseWriter(qw422016) -//line gitlist.qtpl:10 +//line templates/gitlist.qtpl:23 } -//line gitlist.qtpl:10 -func (p *GitListPage) Title() string { -//line gitlist.qtpl:10 +//line templates/gitlist.qtpl:23 +func (p *GitListPage) Title(ctx context.Context) string { +//line templates/gitlist.qtpl:23 qb422016 := qt422016.AcquireByteBuffer() -//line gitlist.qtpl:10 - p.WriteTitle(qb422016) -//line gitlist.qtpl:10 +//line templates/gitlist.qtpl:23 + p.WriteTitle(qb422016, ctx) +//line templates/gitlist.qtpl:23 qs422016 := string(qb422016.B) -//line gitlist.qtpl:10 +//line templates/gitlist.qtpl:23 qt422016.ReleaseByteBuffer(qb422016) -//line gitlist.qtpl:10 +//line templates/gitlist.qtpl:23 return qs422016 -//line gitlist.qtpl:10 +//line templates/gitlist.qtpl:23 } -//line gitlist.qtpl:12 -func (p *GitListPage) StreamNavbar(qw422016 *qt422016.Writer) { -//line gitlist.qtpl:12 - StreamNavbar(qw422016, Git) -//line gitlist.qtpl:12 +//line templates/gitlist.qtpl:25 +func (p *GitListPage) StreamNavbar(qw422016 *qt422016.Writer, ctx context.Context) { +//line templates/gitlist.qtpl:25 + StreamNavbar(qw422016, ctx, Git) +//line templates/gitlist.qtpl:25 } -//line gitlist.qtpl:12 -func (p *GitListPage) WriteNavbar(qq422016 qtio422016.Writer) { -//line gitlist.qtpl:12 +//line templates/gitlist.qtpl:25 +func (p *GitListPage) WriteNavbar(qq422016 qtio422016.Writer, ctx context.Context) { +//line templates/gitlist.qtpl:25 qw422016 := qt422016.AcquireWriter(qq422016) -//line gitlist.qtpl:12 - p.StreamNavbar(qw422016) -//line gitlist.qtpl:12 +//line templates/gitlist.qtpl:25 + p.StreamNavbar(qw422016, ctx) +//line templates/gitlist.qtpl:25 qt422016.ReleaseWriter(qw422016) -//line gitlist.qtpl:12 +//line templates/gitlist.qtpl:25 } -//line gitlist.qtpl:12 -func (p *GitListPage) Navbar() string { -//line gitlist.qtpl:12 +//line templates/gitlist.qtpl:25 +func (p *GitListPage) Navbar(ctx context.Context) string { +//line templates/gitlist.qtpl:25 qb422016 := qt422016.AcquireByteBuffer() -//line gitlist.qtpl:12 - p.WriteNavbar(qb422016) -//line gitlist.qtpl:12 +//line templates/gitlist.qtpl:25 + p.WriteNavbar(qb422016, ctx) +//line templates/gitlist.qtpl:25 qs422016 := string(qb422016.B) -//line gitlist.qtpl:12 +//line templates/gitlist.qtpl:25 qt422016.ReleaseByteBuffer(qb422016) -//line gitlist.qtpl:12 +//line templates/gitlist.qtpl:25 return qs422016 -//line gitlist.qtpl:12 +//line templates/gitlist.qtpl:25 } -//line gitlist.qtpl:14 -func (p *GitListPage) StreamContent(qw422016 *qt422016.Writer) { -//line gitlist.qtpl:14 +//line templates/gitlist.qtpl:27 +func (p *GitListPage) StreamContent(qw422016 *qt422016.Writer, ctx context.Context) { +//line templates/gitlist.qtpl:27 qw422016.N().S(` <div class="row"> <div class="col-md-6 order-last order-md-first"> <div class="event-list"> `) -//line gitlist.qtpl:18 +//line templates/gitlist.qtpl:31 for _, r := range p.Respositories { -//line gitlist.qtpl:18 +//line templates/gitlist.qtpl:31 qw422016.N().S(` <div class="event"> - <h4> - <a href="/`) -//line gitlist.qtpl:21 + <div class="row"> + <div class="col-md"> + <a href="/`) +//line templates/gitlist.qtpl:35 qw422016.E().S(r.Name) -//line gitlist.qtpl:21 +//line templates/gitlist.qtpl:35 qw422016.N().S(`/">`) -//line gitlist.qtpl:21 +//line templates/gitlist.qtpl:35 qw422016.E().S(r.Name) -//line gitlist.qtpl:21 +//line templates/gitlist.qtpl:35 qw422016.N().S(`</a> - </h4> + </div> + <div class="col-md text-md-end"> + <small>`) +//line templates/gitlist.qtpl:38 + if !r.Public { +//line templates/gitlist.qtpl:38 + qw422016.N().S(`private`) +//line templates/gitlist.qtpl:38 + } +//line templates/gitlist.qtpl:38 + qw422016.N().S(`</small> + </div> + </div> </hr> <p>`) -//line gitlist.qtpl:24 +//line templates/gitlist.qtpl:42 qw422016.E().S(r.Description) -//line gitlist.qtpl:24 +//line templates/gitlist.qtpl:42 qw422016.N().S(`</p> + <div class="event-commit row"> + <a class="col-xl-2" title="`) +//line templates/gitlist.qtpl:44 + qw422016.E().S(r.LastCommit.Commit().Hash.String()) +//line templates/gitlist.qtpl:44 + qw422016.N().S(`" href="/`) +//line templates/gitlist.qtpl:44 + qw422016.E().S(r.Name) +//line templates/gitlist.qtpl:44 + qw422016.N().S(`/commit/`) +//line templates/gitlist.qtpl:44 + qw422016.E().S(r.LastCommit.Commit().Hash.String()) +//line templates/gitlist.qtpl:44 + qw422016.N().S(`/">`) +//line templates/gitlist.qtpl:44 + qw422016.E().S(r.LastCommit.Commit().Hash.String()[0:8]) +//line templates/gitlist.qtpl:44 + qw422016.N().S(`</a> + <a class="col-xl-7"> `) +//line templates/gitlist.qtpl:45 + qw422016.E().S(firstLine(r.LastCommit.Commit().Message)) +//line templates/gitlist.qtpl:45 + qw422016.N().S(`</a> + <a class="col-xl-3" title="`) +//line templates/gitlist.qtpl:46 + qw422016.E().S(r.LastCommit.Commit().Author.When.UTC().Format("2006-01-02 15:04:05")) +//line templates/gitlist.qtpl:46 + qw422016.N().S(` UTC">`) +//line templates/gitlist.qtpl:46 + qw422016.E().S(humanize.Time(r.LastCommit.Commit().Author.When)) +//line templates/gitlist.qtpl:46 + qw422016.N().S(`</a> + </div> <p> <a href="/`) -//line gitlist.qtpl:26 +//line templates/gitlist.qtpl:49 qw422016.E().S(r.Name) -//line gitlist.qtpl:26 +//line templates/gitlist.qtpl:49 qw422016.N().S(`/log/`) -//line gitlist.qtpl:26 +//line templates/gitlist.qtpl:49 qw422016.E().S(r.Ref) -//line gitlist.qtpl:26 +//line templates/gitlist.qtpl:49 qw422016.N().S(`/">log</a> <a href="/`) -//line gitlist.qtpl:27 +//line templates/gitlist.qtpl:50 qw422016.E().S(r.Name) -//line gitlist.qtpl:27 +//line templates/gitlist.qtpl:50 qw422016.N().S(`/tree/`) -//line gitlist.qtpl:27 +//line templates/gitlist.qtpl:50 qw422016.E().S(r.Ref) -//line gitlist.qtpl:27 +//line templates/gitlist.qtpl:50 qw422016.N().S(`/">tree</a> <a href="/`) -//line gitlist.qtpl:28 +//line templates/gitlist.qtpl:51 qw422016.E().S(r.Name) -//line gitlist.qtpl:28 +//line templates/gitlist.qtpl:51 qw422016.N().S(`/refs/">refs</a> </p> </div> `) -//line gitlist.qtpl:31 +//line templates/gitlist.qtpl:54 } -//line gitlist.qtpl:31 +//line templates/gitlist.qtpl:54 qw422016.N().S(` </div> </div> <div id="about" class="col-md-4 order-first order-md-last"> `) -//line gitlist.qtpl:35 +//line templates/gitlist.qtpl:58 qw422016.N().Z(p.About) -//line gitlist.qtpl:35 +//line templates/gitlist.qtpl:58 qw422016.N().S(` </div> </div> `) -//line gitlist.qtpl:38 +//line templates/gitlist.qtpl:61 } -//line gitlist.qtpl:38 -func (p *GitListPage) WriteContent(qq422016 qtio422016.Writer) { -//line gitlist.qtpl:38 +//line templates/gitlist.qtpl:61 +func (p *GitListPage) WriteContent(qq422016 qtio422016.Writer, ctx context.Context) { +//line templates/gitlist.qtpl:61 qw422016 := qt422016.AcquireWriter(qq422016) -//line gitlist.qtpl:38 - p.StreamContent(qw422016) -//line gitlist.qtpl:38 +//line templates/gitlist.qtpl:61 + p.StreamContent(qw422016, ctx) +//line templates/gitlist.qtpl:61 qt422016.ReleaseWriter(qw422016) -//line gitlist.qtpl:38 +//line templates/gitlist.qtpl:61 } -//line gitlist.qtpl:38 -func (p *GitListPage) Content() string { -//line gitlist.qtpl:38 +//line templates/gitlist.qtpl:61 +func (p *GitListPage) Content(ctx context.Context) string { +//line templates/gitlist.qtpl:61 qb422016 := qt422016.AcquireByteBuffer() -//line gitlist.qtpl:38 - p.WriteContent(qb422016) -//line gitlist.qtpl:38 +//line templates/gitlist.qtpl:61 + p.WriteContent(qb422016, ctx) +//line templates/gitlist.qtpl:61 qs422016 := string(qb422016.B) -//line gitlist.qtpl:38 +//line templates/gitlist.qtpl:61 qt422016.ReleaseByteBuffer(qb422016) -//line gitlist.qtpl:38 +//line templates/gitlist.qtpl:61 return qs422016 -//line gitlist.qtpl:38 +//line templates/gitlist.qtpl:61 } -//line gitlist.qtpl:40 -func (p *GitListPage) StreamScript(qw422016 *qt422016.Writer) { -//line gitlist.qtpl:40 +//line templates/gitlist.qtpl:63 +func (p *GitListPage) StreamScript(qw422016 *qt422016.Writer, ctx context.Context) { +//line templates/gitlist.qtpl:63 qw422016.N().S(` `) -//line gitlist.qtpl:41 +//line templates/gitlist.qtpl:64 } -//line gitlist.qtpl:41 -func (p *GitListPage) WriteScript(qq422016 qtio422016.Writer) { -//line gitlist.qtpl:41 +//line templates/gitlist.qtpl:64 +func (p *GitListPage) WriteScript(qq422016 qtio422016.Writer, ctx context.Context) { +//line templates/gitlist.qtpl:64 qw422016 := qt422016.AcquireWriter(qq422016) -//line gitlist.qtpl:41 - p.StreamScript(qw422016) -//line gitlist.qtpl:41 +//line templates/gitlist.qtpl:64 + p.StreamScript(qw422016, ctx) +//line templates/gitlist.qtpl:64 qt422016.ReleaseWriter(qw422016) -//line gitlist.qtpl:41 +//line templates/gitlist.qtpl:64 } -//line gitlist.qtpl:41 -func (p *GitListPage) Script() string { -//line gitlist.qtpl:41 +//line templates/gitlist.qtpl:64 +func (p *GitListPage) Script(ctx context.Context) string { +//line templates/gitlist.qtpl:64 qb422016 := qt422016.AcquireByteBuffer() -//line gitlist.qtpl:41 - p.WriteScript(qb422016) -//line gitlist.qtpl:41 +//line templates/gitlist.qtpl:64 + p.WriteScript(qb422016, ctx) +//line templates/gitlist.qtpl:64 qs422016 := string(qb422016.B) -//line gitlist.qtpl:41 +//line templates/gitlist.qtpl:64 qt422016.ReleaseByteBuffer(qb422016) -//line gitlist.qtpl:41 +//line templates/gitlist.qtpl:64 return qs422016 -//line gitlist.qtpl:41 +//line templates/gitlist.qtpl:64 } diff --git a/templates/login.qtpl b/templates/login.qtpl new file mode 100644 index 0000000..efaf329 --- /dev/null +++ b/templates/login.qtpl @@ -0,0 +1,46 @@ +{% import "context" %} + +{% code +type LoginPage struct { + Referer string + ErrorMessage string +} +%} + +{% func (p *LoginPage) Title(ctx context.Context) %}Hello{% endfunc %} + +{% func (p *LoginPage) Navbar(ctx context.Context) %}{%= Navbar(ctx, Login) %}{% endfunc %} + +{% func (p *LoginPage) Content(ctx context.Context) %} +<div class="row"> + <div class="col-md-6 offset-md-3"> + {% if p.Referer == "" %} + <form action="/login/" method="POST"> + {% else %} + <form action="/login/?referer={%s p.Referer %}" method="POST"> + {% endif %} + <div class="form-group m-3"> + <label for="username" class="form-label">Username</label> + <input type="text" class="form-control" name="username" id="username"> + </div> + <div class="form-group m-3"> + <label for="password" class="form-label">Password</label> + <input type="password" class="form-control" name="password" id="password"> + </div> + <div class="form-group m-3"> + <button type="submit" class="btn btn-primary">Login</button> + </div> + </form> + </div> + {% if p.ErrorMessage != "" %} + <div class="col-md-6 offset-md-3"> + <div class="alert alert-warning text-center" > + {%s p.ErrorMessage %} + </div> + </div> + {% endif %} +</div> +{% endfunc %} + +{% func (p *LoginPage) Script(ctx context.Context) %} +{% endfunc %} diff --git a/templates/login.qtpl.go b/templates/login.qtpl.go new file mode 100644 index 0000000..1a1b6d7 --- /dev/null +++ b/templates/login.qtpl.go @@ -0,0 +1,217 @@ +// Code generated by qtc from "login.qtpl". DO NOT EDIT. +// See https://github.com/valyala/quicktemplate for details. + +//line templates/login.qtpl:1 +package templates + +//line templates/login.qtpl:1 +import "context" + +//line templates/login.qtpl:3 +import ( + qtio422016 "io" + + qt422016 "github.com/valyala/quicktemplate" +) + +//line templates/login.qtpl:3 +var ( + _ = qtio422016.Copy + _ = qt422016.AcquireByteBuffer +) + +//line templates/login.qtpl:4 +type LoginPage struct { + Referer string + ErrorMessage string +} + +//line templates/login.qtpl:10 +func (p *LoginPage) StreamTitle(qw422016 *qt422016.Writer, ctx context.Context) { +//line templates/login.qtpl:10 + qw422016.N().S(`Hello`) +//line templates/login.qtpl:10 +} + +//line templates/login.qtpl:10 +func (p *LoginPage) WriteTitle(qq422016 qtio422016.Writer, ctx context.Context) { +//line templates/login.qtpl:10 + qw422016 := qt422016.AcquireWriter(qq422016) +//line templates/login.qtpl:10 + p.StreamTitle(qw422016, ctx) +//line templates/login.qtpl:10 + qt422016.ReleaseWriter(qw422016) +//line templates/login.qtpl:10 +} + +//line templates/login.qtpl:10 +func (p *LoginPage) Title(ctx context.Context) string { +//line templates/login.qtpl:10 + qb422016 := qt422016.AcquireByteBuffer() +//line templates/login.qtpl:10 + p.WriteTitle(qb422016, ctx) +//line templates/login.qtpl:10 + qs422016 := string(qb422016.B) +//line templates/login.qtpl:10 + qt422016.ReleaseByteBuffer(qb422016) +//line templates/login.qtpl:10 + return qs422016 +//line templates/login.qtpl:10 +} + +//line templates/login.qtpl:12 +func (p *LoginPage) StreamNavbar(qw422016 *qt422016.Writer, ctx context.Context) { +//line templates/login.qtpl:12 + StreamNavbar(qw422016, ctx, Login) +//line templates/login.qtpl:12 +} + +//line templates/login.qtpl:12 +func (p *LoginPage) WriteNavbar(qq422016 qtio422016.Writer, ctx context.Context) { +//line templates/login.qtpl:12 + qw422016 := qt422016.AcquireWriter(qq422016) +//line templates/login.qtpl:12 + p.StreamNavbar(qw422016, ctx) +//line templates/login.qtpl:12 + qt422016.ReleaseWriter(qw422016) +//line templates/login.qtpl:12 +} + +//line templates/login.qtpl:12 +func (p *LoginPage) Navbar(ctx context.Context) string { +//line templates/login.qtpl:12 + qb422016 := qt422016.AcquireByteBuffer() +//line templates/login.qtpl:12 + p.WriteNavbar(qb422016, ctx) +//line templates/login.qtpl:12 + qs422016 := string(qb422016.B) +//line templates/login.qtpl:12 + qt422016.ReleaseByteBuffer(qb422016) +//line templates/login.qtpl:12 + return qs422016 +//line templates/login.qtpl:12 +} + +//line templates/login.qtpl:14 +func (p *LoginPage) StreamContent(qw422016 *qt422016.Writer, ctx context.Context) { +//line templates/login.qtpl:14 + qw422016.N().S(` +<div class="row"> + <div class="col-md-6 offset-md-3"> + `) +//line templates/login.qtpl:17 + if p.Referer == "" { +//line templates/login.qtpl:17 + qw422016.N().S(` + <form action="/login/" method="POST"> + `) +//line templates/login.qtpl:19 + } else { +//line templates/login.qtpl:19 + qw422016.N().S(` + <form action="/login/?referer=`) +//line templates/login.qtpl:20 + qw422016.E().S(p.Referer) +//line templates/login.qtpl:20 + qw422016.N().S(`" method="POST"> + `) +//line templates/login.qtpl:21 + } +//line templates/login.qtpl:21 + qw422016.N().S(` + <div class="form-group m-3"> + <label for="username" class="form-label">Username</label> + <input type="text" class="form-control" name="username" id="username"> + </div> + <div class="form-group m-3"> + <label for="password" class="form-label">Password</label> + <input type="password" class="form-control" name="password" id="password"> + </div> + <div class="form-group m-3"> + <button type="submit" class="btn btn-primary">Login</button> + </div> + </form> + </div> + `) +//line templates/login.qtpl:35 + if p.ErrorMessage != "" { +//line templates/login.qtpl:35 + qw422016.N().S(` + <div class="col-md-6 offset-md-3"> + <div class="alert alert-warning text-center" > + `) +//line templates/login.qtpl:38 + qw422016.E().S(p.ErrorMessage) +//line templates/login.qtpl:38 + qw422016.N().S(` + </div> + </div> + `) +//line templates/login.qtpl:41 + } +//line templates/login.qtpl:41 + qw422016.N().S(` +</div> +`) +//line templates/login.qtpl:43 +} + +//line templates/login.qtpl:43 +func (p *LoginPage) WriteContent(qq422016 qtio422016.Writer, ctx context.Context) { +//line templates/login.qtpl:43 + qw422016 := qt422016.AcquireWriter(qq422016) +//line templates/login.qtpl:43 + p.StreamContent(qw422016, ctx) +//line templates/login.qtpl:43 + qt422016.ReleaseWriter(qw422016) +//line templates/login.qtpl:43 +} + +//line templates/login.qtpl:43 +func (p *LoginPage) Content(ctx context.Context) string { +//line templates/login.qtpl:43 + qb422016 := qt422016.AcquireByteBuffer() +//line templates/login.qtpl:43 + p.WriteContent(qb422016, ctx) +//line templates/login.qtpl:43 + qs422016 := string(qb422016.B) +//line templates/login.qtpl:43 + qt422016.ReleaseByteBuffer(qb422016) +//line templates/login.qtpl:43 + return qs422016 +//line templates/login.qtpl:43 +} + +//line templates/login.qtpl:45 +func (p *LoginPage) StreamScript(qw422016 *qt422016.Writer, ctx context.Context) { +//line templates/login.qtpl:45 + qw422016.N().S(` +`) +//line templates/login.qtpl:46 +} + +//line templates/login.qtpl:46 +func (p *LoginPage) WriteScript(qq422016 qtio422016.Writer, ctx context.Context) { +//line templates/login.qtpl:46 + qw422016 := qt422016.AcquireWriter(qq422016) +//line templates/login.qtpl:46 + p.StreamScript(qw422016, ctx) +//line templates/login.qtpl:46 + qt422016.ReleaseWriter(qw422016) +//line templates/login.qtpl:46 +} + +//line templates/login.qtpl:46 +func (p *LoginPage) Script(ctx context.Context) string { +//line templates/login.qtpl:46 + qb422016 := qt422016.AcquireByteBuffer() +//line templates/login.qtpl:46 + p.WriteScript(qb422016, ctx) +//line templates/login.qtpl:46 + qs422016 := string(qb422016.B) +//line templates/login.qtpl:46 + qt422016.ReleaseByteBuffer(qb422016) +//line templates/login.qtpl:46 + return qs422016 +//line templates/login.qtpl:46 +} diff --git a/templates/navbar.qtpl b/templates/navbar.qtpl index 68b1fd8..7a07319 100644 --- a/templates/navbar.qtpl +++ b/templates/navbar.qtpl @@ -1,3 +1,5 @@ +{% import "context" %} + {% code type Selection int const ( @@ -5,6 +7,7 @@ const ( List About Config + Login ) %} @@ -21,10 +24,19 @@ const ( {% func insertIfEqual(s, d any) %}{% if s == d %} selected{% endif %}{% endfunc %} -{% func Navbar (s Selection) %} +{% func Navbar (ctx context.Context, s Selection) %} <nav class="container navbar navbar-expand"> <div class="navbar-nav"> <a class="nav-link{%= insertIfEqual(s, Git) %}" href="/">git</a> + </div> + <div class="navbar-nav ms-auto"> + {% if !IsAuthenticationDisabled(ctx) %} + {% if IsLoggedIn(ctx) %} + <a class="nav-link{%= insertIfEqual(s, Login) %}" href="/logout/">logout</a> + {% else %} + <a class="nav-link{%= insertIfEqual(s, Login) %}" href="/login/">login</a> + {% endif %} + {% endif %} {% comment %} Add this back once needed <a class="nav-link{%= insertIfEqual(s, List) %}" href="/list/">list</a> @@ -33,14 +45,13 @@ Add this back once needed Add this back if needed <a class="nav-link{%= insertIfEqual(s, About) %}" href="/about/">about</a> {% endcomment %} - <a class="nav-link{%= insertIfEqual(s, Config) %}" href="/config">config</a> </div> </nav> {% endfunc %} {% func GitItemNav (name, ref string, s GitSelection) %} <div class="row"> - <h3 id="name">{%s name %} {% if ref != "" && (s == Log || s == Tree) %}@ {%s ref %}{% endif %}</h3> + <h3 id="name">{%s name %} {% if ref != "" %}@ {%s ref %}{% endif %}</h3> </div> <div class="row"> <ul class="nav"> @@ -51,7 +62,7 @@ Add this back if needed <a class="nav-link{%= insertIfEqual(s, Summary) %}" aria-current="page" href="/{%s name %}/">summary</a> </li> <li class="nav-item"> - <a class="nav-link{%= insertIfEqual(s, Refs) %}" aria-current="page" href="/{%s name %}/refs">refs</a> + <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, Log) %}" aria-current="page" href="/{%s name %}/log/{%s ref %}/">log</a> diff --git a/templates/navbar.qtpl.go b/templates/navbar.qtpl.go index 806df94..0a41d56 100644 --- a/templates/navbar.qtpl.go +++ b/templates/navbar.qtpl.go @@ -1,23 +1,26 @@ // Code generated by qtc from "navbar.qtpl". DO NOT EDIT. // See https://github.com/valyala/quicktemplate for details. -//line navbar.qtpl:1 +//line templates/navbar.qtpl:1 package templates -//line navbar.qtpl:1 +//line templates/navbar.qtpl:1 +import "context" + +//line templates/navbar.qtpl:3 import ( qtio422016 "io" qt422016 "github.com/valyala/quicktemplate" ) -//line navbar.qtpl:1 +//line templates/navbar.qtpl:3 var ( _ = qtio422016.Copy _ = qt422016.AcquireByteBuffer ) -//line navbar.qtpl:2 +//line templates/navbar.qtpl:4 type Selection int const ( @@ -25,9 +28,10 @@ const ( List About Config + Login ) -//line navbar.qtpl:12 +//line templates/navbar.qtpl:15 type GitSelection int const ( @@ -38,211 +42,243 @@ const ( Tree ) -//line navbar.qtpl:22 +//line templates/navbar.qtpl:25 func streaminsertIfEqual(qw422016 *qt422016.Writer, s, d any) { -//line navbar.qtpl:22 +//line templates/navbar.qtpl:25 if s == d { -//line navbar.qtpl:22 +//line templates/navbar.qtpl:25 qw422016.N().S(` selected`) -//line navbar.qtpl:22 +//line templates/navbar.qtpl:25 } -//line navbar.qtpl:22 +//line templates/navbar.qtpl:25 } -//line navbar.qtpl:22 +//line templates/navbar.qtpl:25 func writeinsertIfEqual(qq422016 qtio422016.Writer, s, d any) { -//line navbar.qtpl:22 +//line templates/navbar.qtpl:25 qw422016 := qt422016.AcquireWriter(qq422016) -//line navbar.qtpl:22 +//line templates/navbar.qtpl:25 streaminsertIfEqual(qw422016, s, d) -//line navbar.qtpl:22 +//line templates/navbar.qtpl:25 qt422016.ReleaseWriter(qw422016) -//line navbar.qtpl:22 +//line templates/navbar.qtpl:25 } -//line navbar.qtpl:22 +//line templates/navbar.qtpl:25 func insertIfEqual(s, d any) string { -//line navbar.qtpl:22 +//line templates/navbar.qtpl:25 qb422016 := qt422016.AcquireByteBuffer() -//line navbar.qtpl:22 +//line templates/navbar.qtpl:25 writeinsertIfEqual(qb422016, s, d) -//line navbar.qtpl:22 +//line templates/navbar.qtpl:25 qs422016 := string(qb422016.B) -//line navbar.qtpl:22 +//line templates/navbar.qtpl:25 qt422016.ReleaseByteBuffer(qb422016) -//line navbar.qtpl:22 +//line templates/navbar.qtpl:25 return qs422016 -//line navbar.qtpl:22 +//line templates/navbar.qtpl:25 } -//line navbar.qtpl:24 -func StreamNavbar(qw422016 *qt422016.Writer, s Selection) { -//line navbar.qtpl:24 +//line templates/navbar.qtpl:27 +func StreamNavbar(qw422016 *qt422016.Writer, ctx context.Context, s Selection) { +//line templates/navbar.qtpl:27 qw422016.N().S(` <nav class="container navbar navbar-expand"> <div class="navbar-nav"> <a class="nav-link`) -//line navbar.qtpl:27 +//line templates/navbar.qtpl:30 streaminsertIfEqual(qw422016, s, Git) -//line navbar.qtpl:27 +//line templates/navbar.qtpl:30 qw422016.N().S(`" href="/">git</a> + </div> + <div class="navbar-nav ms-auto"> + `) +//line templates/navbar.qtpl:33 + if !IsAuthenticationDisabled(ctx) { +//line templates/navbar.qtpl:33 + qw422016.N().S(` + `) +//line templates/navbar.qtpl:34 + if IsLoggedIn(ctx) { +//line templates/navbar.qtpl:34 + qw422016.N().S(` + <a class="nav-link`) +//line templates/navbar.qtpl:35 + streaminsertIfEqual(qw422016, s, Login) +//line templates/navbar.qtpl:35 + qw422016.N().S(`" href="/logout/">logout</a> + `) +//line templates/navbar.qtpl:36 + } else { +//line templates/navbar.qtpl:36 + qw422016.N().S(` + <a class="nav-link`) +//line templates/navbar.qtpl:37 + streaminsertIfEqual(qw422016, s, Login) +//line templates/navbar.qtpl:37 + qw422016.N().S(`" href="/login/">login</a> + `) +//line templates/navbar.qtpl:38 + } +//line templates/navbar.qtpl:38 + qw422016.N().S(` + `) +//line templates/navbar.qtpl:39 + } +//line templates/navbar.qtpl:39 + qw422016.N().S(` `) -//line navbar.qtpl:31 +//line templates/navbar.qtpl:43 qw422016.N().S(` `) -//line navbar.qtpl:35 +//line templates/navbar.qtpl:47 qw422016.N().S(` - <a class="nav-link`) -//line navbar.qtpl:36 - streaminsertIfEqual(qw422016, s, Config) -//line navbar.qtpl:36 - qw422016.N().S(`" href="/config">config</a> </div> </nav> `) -//line navbar.qtpl:39 +//line templates/navbar.qtpl:50 } -//line navbar.qtpl:39 -func WriteNavbar(qq422016 qtio422016.Writer, s Selection) { -//line navbar.qtpl:39 +//line templates/navbar.qtpl:50 +func WriteNavbar(qq422016 qtio422016.Writer, ctx context.Context, s Selection) { +//line templates/navbar.qtpl:50 qw422016 := qt422016.AcquireWriter(qq422016) -//line navbar.qtpl:39 - StreamNavbar(qw422016, s) -//line navbar.qtpl:39 +//line templates/navbar.qtpl:50 + StreamNavbar(qw422016, ctx, s) +//line templates/navbar.qtpl:50 qt422016.ReleaseWriter(qw422016) -//line navbar.qtpl:39 +//line templates/navbar.qtpl:50 } -//line navbar.qtpl:39 -func Navbar(s Selection) string { -//line navbar.qtpl:39 +//line templates/navbar.qtpl:50 +func Navbar(ctx context.Context, s Selection) string { +//line templates/navbar.qtpl:50 qb422016 := qt422016.AcquireByteBuffer() -//line navbar.qtpl:39 - WriteNavbar(qb422016, s) -//line navbar.qtpl:39 +//line templates/navbar.qtpl:50 + WriteNavbar(qb422016, ctx, s) +//line templates/navbar.qtpl:50 qs422016 := string(qb422016.B) -//line navbar.qtpl:39 +//line templates/navbar.qtpl:50 qt422016.ReleaseByteBuffer(qb422016) -//line navbar.qtpl:39 +//line templates/navbar.qtpl:50 return qs422016 -//line navbar.qtpl:39 +//line templates/navbar.qtpl:50 } -//line navbar.qtpl:41 +//line templates/navbar.qtpl:52 func StreamGitItemNav(qw422016 *qt422016.Writer, name, ref string, s GitSelection) { -//line navbar.qtpl:41 +//line templates/navbar.qtpl:52 qw422016.N().S(` <div class="row"> <h3 id="name">`) -//line navbar.qtpl:43 +//line templates/navbar.qtpl:54 qw422016.E().S(name) -//line navbar.qtpl:43 +//line templates/navbar.qtpl:54 qw422016.N().S(` `) -//line navbar.qtpl:43 - if ref != "" && (s == Log || s == Tree) { -//line navbar.qtpl:43 +//line templates/navbar.qtpl:54 + if ref != "" { +//line templates/navbar.qtpl:54 qw422016.N().S(`@ `) -//line navbar.qtpl:43 +//line templates/navbar.qtpl:54 qw422016.E().S(ref) -//line navbar.qtpl:43 +//line templates/navbar.qtpl:54 } -//line navbar.qtpl:43 +//line templates/navbar.qtpl:54 qw422016.N().S(`</h3> </div> <div class="row"> <ul class="nav"> <li class="nav-item"> <a class="nav-link`) -//line navbar.qtpl:48 +//line templates/navbar.qtpl:59 streaminsertIfEqual(qw422016, s, Readme) -//line navbar.qtpl:48 +//line templates/navbar.qtpl:59 qw422016.N().S(`" aria-current="page" href="/`) -//line navbar.qtpl:48 +//line templates/navbar.qtpl:59 qw422016.E().S(name) -//line navbar.qtpl:48 +//line templates/navbar.qtpl:59 qw422016.N().S(`/about/">about</a> </li> <li class="nav-item"> <a class="nav-link`) -//line navbar.qtpl:51 +//line templates/navbar.qtpl:62 streaminsertIfEqual(qw422016, s, Summary) -//line navbar.qtpl:51 +//line templates/navbar.qtpl:62 qw422016.N().S(`" aria-current="page" href="/`) -//line navbar.qtpl:51 +//line templates/navbar.qtpl:62 qw422016.E().S(name) -//line navbar.qtpl:51 +//line templates/navbar.qtpl:62 qw422016.N().S(`/">summary</a> </li> <li class="nav-item"> <a class="nav-link`) -//line navbar.qtpl:54 +//line templates/navbar.qtpl:65 streaminsertIfEqual(qw422016, s, Refs) -//line navbar.qtpl:54 +//line templates/navbar.qtpl:65 qw422016.N().S(`" aria-current="page" href="/`) -//line navbar.qtpl:54 +//line templates/navbar.qtpl:65 qw422016.E().S(name) -//line navbar.qtpl:54 - qw422016.N().S(`/refs">refs</a> +//line templates/navbar.qtpl:65 + qw422016.N().S(`/refs/">refs</a> </li> <li class="nav-item"> <a class="nav-link`) -//line navbar.qtpl:57 +//line templates/navbar.qtpl:68 streaminsertIfEqual(qw422016, s, Log) -//line navbar.qtpl:57 +//line templates/navbar.qtpl:68 qw422016.N().S(`" aria-current="page" href="/`) -//line navbar.qtpl:57 +//line templates/navbar.qtpl:68 qw422016.E().S(name) -//line navbar.qtpl:57 +//line templates/navbar.qtpl:68 qw422016.N().S(`/log/`) -//line navbar.qtpl:57 +//line templates/navbar.qtpl:68 qw422016.E().S(ref) -//line navbar.qtpl:57 +//line templates/navbar.qtpl:68 qw422016.N().S(`/">log</a> </li> <li class="nav-item"> <a class="nav-link`) -//line navbar.qtpl:60 +//line templates/navbar.qtpl:71 streaminsertIfEqual(qw422016, s, Tree) -//line navbar.qtpl:60 +//line templates/navbar.qtpl:71 qw422016.N().S(`" aria-current="page" href="/`) -//line navbar.qtpl:60 +//line templates/navbar.qtpl:71 qw422016.E().S(name) -//line navbar.qtpl:60 +//line templates/navbar.qtpl:71 qw422016.N().S(`/tree/`) -//line navbar.qtpl:60 +//line templates/navbar.qtpl:71 qw422016.E().S(ref) -//line navbar.qtpl:60 +//line templates/navbar.qtpl:71 qw422016.N().S(`/">tree</a> </li> </ul> </div> `) -//line navbar.qtpl:64 +//line templates/navbar.qtpl:75 } -//line navbar.qtpl:64 +//line templates/navbar.qtpl:75 func WriteGitItemNav(qq422016 qtio422016.Writer, name, ref string, s GitSelection) { -//line navbar.qtpl:64 +//line templates/navbar.qtpl:75 qw422016 := qt422016.AcquireWriter(qq422016) -//line navbar.qtpl:64 +//line templates/navbar.qtpl:75 StreamGitItemNav(qw422016, name, ref, s) -//line navbar.qtpl:64 +//line templates/navbar.qtpl:75 qt422016.ReleaseWriter(qw422016) -//line navbar.qtpl:64 +//line templates/navbar.qtpl:75 } -//line navbar.qtpl:64 +//line templates/navbar.qtpl:75 func GitItemNav(name, ref string, s GitSelection) string { -//line navbar.qtpl:64 +//line templates/navbar.qtpl:75 qb422016 := qt422016.AcquireByteBuffer() -//line navbar.qtpl:64 +//line templates/navbar.qtpl:75 WriteGitItemNav(qb422016, name, ref, s) -//line navbar.qtpl:64 +//line templates/navbar.qtpl:75 qs422016 := string(qb422016.B) -//line navbar.qtpl:64 +//line templates/navbar.qtpl:75 qt422016.ReleaseByteBuffer(qb422016) -//line navbar.qtpl:64 +//line templates/navbar.qtpl:75 return qs422016 -//line navbar.qtpl:64 +//line templates/navbar.qtpl:75 } diff --git a/templates/tags.qtpl b/templates/tags.qtpl index 5cd617f..5b7c39b 100644 --- a/templates/tags.qtpl +++ b/templates/tags.qtpl @@ -7,7 +7,7 @@ <div class="event me-md-2"> <div class="row "> <div class="col-4"> - <a title="{%s t.HashString() %}" href="/{%s name %}/commit/{%s t.HashString() %}">{%s t.ShortName() %}</a> + <a title="{%s t.HashString() %}" href="/{%s name %}/ref/{%s t.ShortName() %}">{%s t.ShortName() %}</a> </div> <div class="col-8"> <div class="float-end"> diff --git a/templates/tags.qtpl.go b/templates/tags.qtpl.go index 7d8eca8..5aedd78 100644 --- a/templates/tags.qtpl.go +++ b/templates/tags.qtpl.go @@ -1,154 +1,154 @@ // Code generated by qtc from "tags.qtpl". DO NOT EDIT. // See https://github.com/valyala/quicktemplate for details. -//line tags.qtpl:1 +//line templates/tags.qtpl:1 package templates -//line tags.qtpl:1 +//line templates/tags.qtpl:1 import "git.gabrielgio.me/cerrado/pkg/git" -//line tags.qtpl:3 +//line templates/tags.qtpl:3 import ( qtio422016 "io" qt422016 "github.com/valyala/quicktemplate" ) -//line tags.qtpl:3 +//line templates/tags.qtpl:3 var ( _ = qtio422016.Copy _ = qt422016.AcquireByteBuffer ) -//line tags.qtpl:3 +//line templates/tags.qtpl:3 func StreamListTags(qw422016 *qt422016.Writer, name string, tags []*git.TagReference) { -//line tags.qtpl:3 +//line templates/tags.qtpl:3 qw422016.N().S(` `) -//line tags.qtpl:4 +//line templates/tags.qtpl:4 if len(tags) > 0 { -//line tags.qtpl:4 +//line templates/tags.qtpl:4 qw422016.N().S(` <div class="event-list"> `) -//line tags.qtpl:6 +//line templates/tags.qtpl:6 for _, t := range tags { -//line tags.qtpl:6 +//line templates/tags.qtpl:6 qw422016.N().S(` <div class="event me-md-2"> <div class="row "> <div class="col-4"> <a title="`) -//line tags.qtpl:10 +//line templates/tags.qtpl:10 qw422016.E().S(t.HashString()) -//line tags.qtpl:10 +//line templates/tags.qtpl:10 qw422016.N().S(`" href="/`) -//line tags.qtpl:10 +//line templates/tags.qtpl:10 qw422016.E().S(name) -//line tags.qtpl:10 - qw422016.N().S(`/commit/`) -//line tags.qtpl:10 - qw422016.E().S(t.HashString()) -//line tags.qtpl:10 +//line templates/tags.qtpl:10 + qw422016.N().S(`/ref/`) +//line templates/tags.qtpl:10 + qw422016.E().S(t.ShortName()) +//line templates/tags.qtpl:10 qw422016.N().S(`">`) -//line tags.qtpl:10 +//line templates/tags.qtpl:10 qw422016.E().S(t.ShortName()) -//line tags.qtpl:10 +//line templates/tags.qtpl:10 qw422016.N().S(`</a> </div> <div class="col-8"> <div class="float-end"> <a href="/`) -//line tags.qtpl:14 +//line templates/tags.qtpl:14 qw422016.E().S(name) -//line tags.qtpl:14 +//line templates/tags.qtpl:14 qw422016.N().S(`/archive/`) -//line tags.qtpl:14 +//line templates/tags.qtpl:14 qw422016.E().S(t.ShortName()) -//line tags.qtpl:14 +//line templates/tags.qtpl:14 qw422016.N().S(`.tar.gz">tar.gz</a> <a href="/`) -//line tags.qtpl:15 +//line templates/tags.qtpl:15 qw422016.E().S(name) -//line tags.qtpl:15 +//line templates/tags.qtpl:15 qw422016.N().S(`/tree/`) -//line tags.qtpl:15 +//line templates/tags.qtpl:15 qw422016.E().S(t.ShortName()) -//line tags.qtpl:15 +//line templates/tags.qtpl:15 qw422016.N().S(`/">tree</a> <a href="/`) -//line tags.qtpl:16 +//line templates/tags.qtpl:16 qw422016.E().S(name) -//line tags.qtpl:16 +//line templates/tags.qtpl:16 qw422016.N().S(`/log/`) -//line tags.qtpl:16 +//line templates/tags.qtpl:16 qw422016.E().S(t.ShortName()) -//line tags.qtpl:16 +//line templates/tags.qtpl:16 qw422016.N().S(`/">log</a> </div> </div> </div> `) -//line tags.qtpl:20 +//line templates/tags.qtpl:20 if t.Message() != "" { -//line tags.qtpl:20 +//line templates/tags.qtpl:20 qw422016.N().S(` <div class="code-view"> <pre>`) -//line tags.qtpl:22 +//line templates/tags.qtpl:22 qw422016.E().S(t.Message()) -//line tags.qtpl:22 +//line templates/tags.qtpl:22 qw422016.N().S(`</pre> </div> `) -//line tags.qtpl:24 +//line templates/tags.qtpl:24 } -//line tags.qtpl:24 +//line templates/tags.qtpl:24 qw422016.N().S(` </div> `) -//line tags.qtpl:26 +//line templates/tags.qtpl:26 } -//line tags.qtpl:26 +//line templates/tags.qtpl:26 qw422016.N().S(` </div> `) -//line tags.qtpl:28 +//line templates/tags.qtpl:28 } else { -//line tags.qtpl:28 +//line templates/tags.qtpl:28 qw422016.N().S(` <p> No tags </p> `) -//line tags.qtpl:30 +//line templates/tags.qtpl:30 } -//line tags.qtpl:30 +//line templates/tags.qtpl:30 qw422016.N().S(` `) -//line tags.qtpl:31 +//line templates/tags.qtpl:31 } -//line tags.qtpl:31 +//line templates/tags.qtpl:31 func WriteListTags(qq422016 qtio422016.Writer, name string, tags []*git.TagReference) { -//line tags.qtpl:31 +//line templates/tags.qtpl:31 qw422016 := qt422016.AcquireWriter(qq422016) -//line tags.qtpl:31 +//line templates/tags.qtpl:31 StreamListTags(qw422016, name, tags) -//line tags.qtpl:31 +//line templates/tags.qtpl:31 qt422016.ReleaseWriter(qw422016) -//line tags.qtpl:31 +//line templates/tags.qtpl:31 } -//line tags.qtpl:31 +//line templates/tags.qtpl:31 func ListTags(name string, tags []*git.TagReference) string { -//line tags.qtpl:31 +//line templates/tags.qtpl:31 qb422016 := qt422016.AcquireByteBuffer() -//line tags.qtpl:31 +//line templates/tags.qtpl:31 WriteListTags(qb422016, name, tags) -//line tags.qtpl:31 +//line templates/tags.qtpl:31 qs422016 := string(qb422016.B) -//line tags.qtpl:31 +//line templates/tags.qtpl:31 qt422016.ReleaseByteBuffer(qb422016) -//line tags.qtpl:31 +//line templates/tags.qtpl:31 return qs422016 -//line tags.qtpl:31 +//line templates/tags.qtpl:31 } |