diff options
Diffstat (limited to 'templates')
-rw-r--r-- | templates/gititemblob.qtpl | 4 | ||||
-rw-r--r-- | templates/gititemblob.qtpl.go | 4 | ||||
-rw-r--r-- | templates/gititemsummary.qtpl | 15 | ||||
-rw-r--r-- | templates/gititemsummary.qtpl.go | 150 | ||||
-rw-r--r-- | templates/gititemtree.qtpl | 12 | ||||
-rw-r--r-- | templates/gititemtree.qtpl.go | 12 |
6 files changed, 115 insertions, 82 deletions
diff --git a/templates/gititemblob.qtpl b/templates/gititemblob.qtpl index ca3a1fa..c5f412b 100644 --- a/templates/gititemblob.qtpl +++ b/templates/gititemblob.qtpl @@ -13,9 +13,9 @@ type GitItemBlobPage struct { <div class="pathing"> {% stripspace %} {% if len(g.Path) != 0 %} - <a href="{%s url(name, Folder, ref, Root, []string{}) %}">root/</a> + <a href="{%s generateURL(name, Folder, ref, Root, []string{}) %}">root/</a> {% for i, e := range g.Path[:len(g.Path)-1] %} - <a href="{%s url(name, Folder, ref, Root, g.Path[:1+i]) %}">{%s e %}/</a> + <a href="{%s generateURL(name, Folder, ref, Root, g.Path[:1+i]) %}">{%s e %}/</a> {% endfor %} <a>{%s u.LastOrZero(g.Path) %}</a> {% else %} diff --git a/templates/gititemblob.qtpl.go b/templates/gititemblob.qtpl.go index 73742f6..4843882 100644 --- a/templates/gititemblob.qtpl.go +++ b/templates/gititemblob.qtpl.go @@ -70,7 +70,7 @@ func (g *GitItemBlobPage) StreamGitContent(qw422016 *qt422016.Writer, name, ref //line templates/gititemblob.qtpl:15 qw422016.N().S(`<a href="`) //line templates/gititemblob.qtpl:16 - qw422016.E().S(url(name, Folder, ref, Root, []string{})) + qw422016.E().S(generateURL(name, Folder, ref, Root, []string{})) //line templates/gititemblob.qtpl:16 qw422016.N().S(`">root/</a>`) //line templates/gititemblob.qtpl:17 @@ -78,7 +78,7 @@ func (g *GitItemBlobPage) StreamGitContent(qw422016 *qt422016.Writer, name, ref //line templates/gititemblob.qtpl:17 qw422016.N().S(`<a href="`) //line templates/gititemblob.qtpl:18 - qw422016.E().S(url(name, Folder, ref, Root, g.Path[:1+i])) + qw422016.E().S(generateURL(name, Folder, ref, Root, g.Path[:1+i])) //line templates/gititemblob.qtpl:18 qw422016.N().S(`">`) //line templates/gititemblob.qtpl:18 diff --git a/templates/gititemsummary.qtpl b/templates/gititemsummary.qtpl index f39a613..7f56837 100644 --- a/templates/gititemsummary.qtpl +++ b/templates/gititemsummary.qtpl @@ -1,3 +1,4 @@ +{% import "net/url" %} {% import "github.com/go-git/go-git/v5/plumbing" %} {% import "git.gabrielgio.me/cerrado/pkg/git" %} @@ -6,12 +7,26 @@ type GitItemSummaryPage struct { Tags []*git.TagReference Branches []*plumbing.Reference Commits []*git.CommitReference + Hostname string } %} +{% code + +func mergeURL(hostname, name string) string { + s, _ := url.JoinPath(hostname, name) + return s +} + +%} + {% func (g *GitItemSummaryPage) Nav(name, ref string) %}{%= GitItemNav(name, ref, Summary) %}{% endfunc %} {% func (g *GitItemSummaryPage) GitContent(name, ref string) %} +<div class="row event"> + <div class="col-auto">clone: </div> + <div class="col-md">{%s mergeURL(g.Hostname, name) %}</div> +</div> <div class="row"> <div class="col-md-8"> {%= ListTags(name, g.Tags) %} diff --git a/templates/gititemsummary.qtpl.go b/templates/gititemsummary.qtpl.go index d6d20cb..d132cba 100644 --- a/templates/gititemsummary.qtpl.go +++ b/templates/gititemsummary.qtpl.go @@ -5,190 +5,208 @@ package templates //line templates/gititemsummary.qtpl:1 -import "github.com/go-git/go-git/v5/plumbing" +import "net/url" //line templates/gititemsummary.qtpl:2 +import "github.com/go-git/go-git/v5/plumbing" + +//line templates/gititemsummary.qtpl:3 import "git.gabrielgio.me/cerrado/pkg/git" -//line templates/gititemsummary.qtpl:4 +//line templates/gititemsummary.qtpl:5 import ( qtio422016 "io" qt422016 "github.com/valyala/quicktemplate" ) -//line templates/gititemsummary.qtpl:4 +//line templates/gititemsummary.qtpl:5 var ( _ = qtio422016.Copy _ = qt422016.AcquireByteBuffer ) -//line templates/gititemsummary.qtpl:5 +//line templates/gititemsummary.qtpl:6 type GitItemSummaryPage struct { Tags []*git.TagReference Branches []*plumbing.Reference Commits []*git.CommitReference + Hostname string +} + +//line templates/gititemsummary.qtpl:16 +func mergeURL(hostname, name string) string { + s, _ := url.JoinPath(hostname, name) + return s } -//line templates/gititemsummary.qtpl:12 +//line templates/gititemsummary.qtpl:23 func (g *GitItemSummaryPage) StreamNav(qw422016 *qt422016.Writer, name, ref string) { -//line templates/gititemsummary.qtpl:12 +//line templates/gititemsummary.qtpl:23 StreamGitItemNav(qw422016, name, ref, Summary) -//line templates/gititemsummary.qtpl:12 +//line templates/gititemsummary.qtpl:23 } -//line templates/gititemsummary.qtpl:12 +//line templates/gititemsummary.qtpl:23 func (g *GitItemSummaryPage) WriteNav(qq422016 qtio422016.Writer, name, ref string) { -//line templates/gititemsummary.qtpl:12 +//line templates/gititemsummary.qtpl:23 qw422016 := qt422016.AcquireWriter(qq422016) -//line templates/gititemsummary.qtpl:12 +//line templates/gititemsummary.qtpl:23 g.StreamNav(qw422016, name, ref) -//line templates/gititemsummary.qtpl:12 +//line templates/gititemsummary.qtpl:23 qt422016.ReleaseWriter(qw422016) -//line templates/gititemsummary.qtpl:12 +//line templates/gititemsummary.qtpl:23 } -//line templates/gititemsummary.qtpl:12 +//line templates/gititemsummary.qtpl:23 func (g *GitItemSummaryPage) Nav(name, ref string) string { -//line templates/gititemsummary.qtpl:12 +//line templates/gititemsummary.qtpl:23 qb422016 := qt422016.AcquireByteBuffer() -//line templates/gititemsummary.qtpl:12 +//line templates/gititemsummary.qtpl:23 g.WriteNav(qb422016, name, ref) -//line templates/gititemsummary.qtpl:12 +//line templates/gititemsummary.qtpl:23 qs422016 := string(qb422016.B) -//line templates/gititemsummary.qtpl:12 +//line templates/gititemsummary.qtpl:23 qt422016.ReleaseByteBuffer(qb422016) -//line templates/gititemsummary.qtpl:12 +//line templates/gititemsummary.qtpl:23 return qs422016 -//line templates/gititemsummary.qtpl:12 +//line templates/gititemsummary.qtpl:23 } -//line templates/gititemsummary.qtpl:14 +//line templates/gititemsummary.qtpl:25 func (g *GitItemSummaryPage) StreamGitContent(qw422016 *qt422016.Writer, name, ref string) { -//line templates/gititemsummary.qtpl:14 +//line templates/gititemsummary.qtpl:25 qw422016.N().S(` +<div class="row event"> + <div class="col-auto">clone: </div> + <div class="col-md">`) +//line templates/gititemsummary.qtpl:28 + qw422016.E().S(mergeURL(g.Hostname, name)) +//line templates/gititemsummary.qtpl:28 + qw422016.N().S(`</div> +</div> <div class="row"> <div class="col-md-8"> `) -//line templates/gititemsummary.qtpl:17 +//line templates/gititemsummary.qtpl:32 StreamListTags(qw422016, name, g.Tags) -//line templates/gititemsummary.qtpl:17 +//line templates/gititemsummary.qtpl:32 qw422016.N().S(` </div> <div class="col-md-4"> <div class="event-list"> `) -//line templates/gititemsummary.qtpl:21 +//line templates/gititemsummary.qtpl:36 for _, b := range g.Branches { -//line templates/gititemsummary.qtpl:21 +//line templates/gititemsummary.qtpl:36 qw422016.N().S(` <div class="row event"> <div class="col-4"> `) -//line templates/gititemsummary.qtpl:24 +//line templates/gititemsummary.qtpl:39 qw422016.E().S(b.Name().Short()) -//line templates/gititemsummary.qtpl:24 +//line templates/gititemsummary.qtpl:39 qw422016.N().S(` </div> <div class="col-8"> <div class="float-end"> <a href="/`) -//line templates/gititemsummary.qtpl:28 +//line templates/gititemsummary.qtpl:43 qw422016.E().S(name) -//line templates/gititemsummary.qtpl:28 +//line templates/gititemsummary.qtpl:43 qw422016.N().S(`/archive/`) -//line templates/gititemsummary.qtpl:28 +//line templates/gititemsummary.qtpl:43 qw422016.E().S(b.Name().Short()) -//line templates/gititemsummary.qtpl:28 +//line templates/gititemsummary.qtpl:43 qw422016.N().S(`.tar.gz">tar.gz</a> <a href="/`) -//line templates/gititemsummary.qtpl:29 +//line templates/gititemsummary.qtpl:44 qw422016.E().S(name) -//line templates/gititemsummary.qtpl:29 +//line templates/gititemsummary.qtpl:44 qw422016.N().S(`/tree/`) -//line templates/gititemsummary.qtpl:29 +//line templates/gititemsummary.qtpl:44 qw422016.E().S(b.Name().Short()) -//line templates/gititemsummary.qtpl:29 +//line templates/gititemsummary.qtpl:44 qw422016.N().S(`/">tree</a> <a href="/`) -//line templates/gititemsummary.qtpl:30 +//line templates/gititemsummary.qtpl:45 qw422016.E().S(name) -//line templates/gititemsummary.qtpl:30 +//line templates/gititemsummary.qtpl:45 qw422016.N().S(`/log/`) -//line templates/gititemsummary.qtpl:30 +//line templates/gititemsummary.qtpl:45 qw422016.E().S(b.Name().Short()) -//line templates/gititemsummary.qtpl:30 +//line templates/gititemsummary.qtpl:45 qw422016.N().S(`/">log</a> </div> </div> </div> `) -//line templates/gititemsummary.qtpl:34 +//line templates/gititemsummary.qtpl:49 } -//line templates/gititemsummary.qtpl:34 +//line templates/gititemsummary.qtpl:49 qw422016.N().S(` </div> </div> <a class="more" href="/`) -//line templates/gititemsummary.qtpl:37 +//line templates/gititemsummary.qtpl:52 qw422016.E().S(name) -//line templates/gititemsummary.qtpl:37 +//line templates/gititemsummary.qtpl:52 qw422016.N().S(`/refs/">[ see refs... ]</a> </div> <div class="row"> <div class="event-list"> `) -//line templates/gititemsummary.qtpl:41 +//line templates/gititemsummary.qtpl:56 for _, c := range g.Commits { -//line templates/gititemsummary.qtpl:41 +//line templates/gititemsummary.qtpl:56 qw422016.N().S(` `) -//line templates/gititemsummary.qtpl:42 +//line templates/gititemsummary.qtpl:57 StreamCommit(qw422016, name, c, false) -//line templates/gititemsummary.qtpl:42 +//line templates/gititemsummary.qtpl:57 qw422016.N().S(` `) -//line templates/gititemsummary.qtpl:43 +//line templates/gititemsummary.qtpl:58 } -//line templates/gititemsummary.qtpl:43 +//line templates/gititemsummary.qtpl:58 qw422016.N().S(` </div> <a class="more" href="/`) -//line templates/gititemsummary.qtpl:45 +//line templates/gititemsummary.qtpl:60 qw422016.E().S(name) -//line templates/gititemsummary.qtpl:45 +//line templates/gititemsummary.qtpl:60 qw422016.N().S(`/log/`) -//line templates/gititemsummary.qtpl:45 +//line templates/gititemsummary.qtpl:60 qw422016.E().S(ref) -//line templates/gititemsummary.qtpl:45 +//line templates/gititemsummary.qtpl:60 qw422016.N().S(`/">[ see log... ]</a> </div> `) -//line templates/gititemsummary.qtpl:47 +//line templates/gititemsummary.qtpl:62 } -//line templates/gititemsummary.qtpl:47 +//line templates/gititemsummary.qtpl:62 func (g *GitItemSummaryPage) WriteGitContent(qq422016 qtio422016.Writer, name, ref string) { -//line templates/gititemsummary.qtpl:47 +//line templates/gititemsummary.qtpl:62 qw422016 := qt422016.AcquireWriter(qq422016) -//line templates/gititemsummary.qtpl:47 +//line templates/gititemsummary.qtpl:62 g.StreamGitContent(qw422016, name, ref) -//line templates/gititemsummary.qtpl:47 +//line templates/gititemsummary.qtpl:62 qt422016.ReleaseWriter(qw422016) -//line templates/gititemsummary.qtpl:47 +//line templates/gititemsummary.qtpl:62 } -//line templates/gititemsummary.qtpl:47 +//line templates/gititemsummary.qtpl:62 func (g *GitItemSummaryPage) GitContent(name, ref string) string { -//line templates/gititemsummary.qtpl:47 +//line templates/gititemsummary.qtpl:62 qb422016 := qt422016.AcquireByteBuffer() -//line templates/gititemsummary.qtpl:47 +//line templates/gititemsummary.qtpl:62 g.WriteGitContent(qb422016, name, ref) -//line templates/gititemsummary.qtpl:47 +//line templates/gititemsummary.qtpl:62 qs422016 := string(qb422016.B) -//line templates/gititemsummary.qtpl:47 +//line templates/gititemsummary.qtpl:62 qt422016.ReleaseByteBuffer(qb422016) -//line templates/gititemsummary.qtpl:47 +//line templates/gititemsummary.qtpl:62 return qs422016 -//line templates/gititemsummary.qtpl:47 +//line templates/gititemsummary.qtpl:62 } diff --git a/templates/gititemtree.qtpl b/templates/gititemtree.qtpl index 2753e24..677d8ec 100644 --- a/templates/gititemtree.qtpl +++ b/templates/gititemtree.qtpl @@ -15,7 +15,7 @@ ) %} -{% code func url(name, mode, ref, filename string, path []string) string { +{% code func generateURL(name, mode, ref, filename string, path []string) string { return u.NewPathing(). AddPath(name). AddPath(mode). @@ -32,9 +32,9 @@ <div class="pathing"> {% stripspace %} {% if len(g.Path) != 0 %} - <a href="{%s url(name, Folder, ref, Root, []string{}) %}">root/</a> + <a href="{%s generateURL(name, Folder, ref, Root, []string{}) %}">root/</a> {% for i, e := range g.Path[:len(g.Path)-1] %} - <a href="{%s url(name, Folder, ref, Root, g.Path[:1+i]) %}">{%s e %}/</a> + <a href="{%s generateURL(name, Folder, ref, Root, g.Path[:1+i]) %}">{%s e %}/</a> {% endfor %} <a>{%s u.LastOrZero(g.Path) %}</a> {% else %} @@ -46,7 +46,7 @@ <div class="col-md-12"> <div class="tree-list"> {% if len(g.Path) != 0 %} - <div class="mode"><a href="{%s url(name, Folder, ref, g.Path[len(g.Path)-1], g.Path[:len(g.Path)-1]) %}">..</a></div> + <div class="mode"><a href="{%s generateURL(name, Folder, ref, g.Path[len(g.Path)-1], g.Path[:len(g.Path)-1]) %}">..</a></div> <div class="name tree"></div> <div class="commit"></div> <div class="date"></div> @@ -55,13 +55,13 @@ {% for _, e := range g.Tree.Entries %} {% 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> + <div class="name blob"><a href="{%s generateURL(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> + <div class="name tree"><a href="{%s generateURL(name, Folder, ref, e.Name, g.Path) %}">{%s e.Name %}</a></div> {% endif %} <div class="commit"></div> <div class="date"></div> diff --git a/templates/gititemtree.qtpl.go b/templates/gititemtree.qtpl.go index 9116cd7..7a378cc 100644 --- a/templates/gititemtree.qtpl.go +++ b/templates/gititemtree.qtpl.go @@ -40,7 +40,7 @@ const ( ) //line templates/gititemtree.qtpl:18 -func url(name, mode, ref, filename string, path []string) string { +func generateURL(name, mode, ref, filename string, path []string) string { return u.NewPathing(). AddPath(name). AddPath(mode). @@ -94,7 +94,7 @@ func (g *GitItemTreePage) StreamGitContent(qw422016 *qt422016.Writer, name, ref //line templates/gititemtree.qtpl:34 qw422016.N().S(`<a href="`) //line templates/gititemtree.qtpl:35 - qw422016.E().S(url(name, Folder, ref, Root, []string{})) + qw422016.E().S(generateURL(name, Folder, ref, Root, []string{})) //line templates/gititemtree.qtpl:35 qw422016.N().S(`">root/</a>`) //line templates/gititemtree.qtpl:36 @@ -102,7 +102,7 @@ func (g *GitItemTreePage) StreamGitContent(qw422016 *qt422016.Writer, name, ref //line templates/gititemtree.qtpl:36 qw422016.N().S(`<a href="`) //line templates/gititemtree.qtpl:37 - qw422016.E().S(url(name, Folder, ref, Root, g.Path[:1+i])) + qw422016.E().S(generateURL(name, Folder, ref, Root, g.Path[:1+i])) //line templates/gititemtree.qtpl:37 qw422016.N().S(`">`) //line templates/gititemtree.qtpl:37 @@ -136,7 +136,7 @@ func (g *GitItemTreePage) StreamGitContent(qw422016 *qt422016.Writer, name, ref qw422016.N().S(` <div class="mode"><a href="`) //line templates/gititemtree.qtpl:49 - qw422016.E().S(url(name, Folder, ref, g.Path[len(g.Path)-1], g.Path[:len(g.Path)-1])) + qw422016.E().S(generateURL(name, Folder, ref, g.Path[len(g.Path)-1], g.Path[:len(g.Path)-1])) //line templates/gititemtree.qtpl:49 qw422016.N().S(`">..</a></div> <div class="name tree"></div> @@ -165,7 +165,7 @@ func (g *GitItemTreePage) StreamGitContent(qw422016 *qt422016.Writer, name, ref qw422016.N().S(`</div> <div class="name blob"><a href="`) //line templates/gititemtree.qtpl:58 - qw422016.E().S(url(name, Blob, ref, e.Name, g.Path)) + qw422016.E().S(generateURL(name, Blob, ref, e.Name, g.Path)) //line templates/gititemtree.qtpl:58 qw422016.N().S(`">`) //line templates/gititemtree.qtpl:58 @@ -191,7 +191,7 @@ func (g *GitItemTreePage) StreamGitContent(qw422016 *qt422016.Writer, name, ref <div class="mode">d---------</div> <div class="name tree"><a href="`) //line templates/gititemtree.qtpl:64 - qw422016.E().S(url(name, Folder, ref, e.Name, g.Path)) + qw422016.E().S(generateURL(name, Folder, ref, e.Name, g.Path)) //line templates/gititemtree.qtpl:64 qw422016.N().S(`">`) //line templates/gititemtree.qtpl:64 |