cerrado @ 92c57a05fab452c1de83131498552424c9c5b598

  1// Code generated by qtc from "gititemtree.qtpl". DO NOT EDIT.
  2// See https://github.com/valyala/quicktemplate for details.
  3
  4//line templates/gititemtree.qtpl:1
  5package templates
  6
  7//line templates/gititemtree.qtpl:1
  8import "git.gabrielgio.me/cerrado/pkg/u"
  9
 10//line templates/gititemtree.qtpl:2
 11import "github.com/go-git/go-git/v5/plumbing/object"
 12
 13//line templates/gititemtree.qtpl:3
 14import "github.com/go-git/go-git/v5/plumbing/filemode"
 15
 16//line templates/gititemtree.qtpl:5
 17import (
 18	qtio422016 "io"
 19
 20	qt422016 "github.com/valyala/quicktemplate"
 21)
 22
 23//line templates/gititemtree.qtpl:5
 24var (
 25	_ = qtio422016.Copy
 26	_ = qt422016.AcquireByteBuffer
 27)
 28
 29//line templates/gititemtree.qtpl:5
 30type GitItemTreePage struct {
 31	Path []string
 32	Tree *object.Tree
 33}
 34
 35//line templates/gititemtree.qtpl:11
 36const (
 37	Folder = "tree"
 38	Blob   = "blob"
 39	Root   = ""
 40)
 41
 42//line templates/gititemtree.qtpl:18
 43func url(name, mode, ref, filename string, path []string) string {
 44	return u.NewPathing().
 45		AddPath(name).
 46		AddPath(mode).
 47		AddPath(ref).
 48		AddPaths(path).
 49		AddPath(filename).
 50		Done()
 51}
 52
 53//line templates/gititemtree.qtpl:29
 54func (g *GitItemTreePage) StreamNav(qw422016 *qt422016.Writer, name, ref string) {
 55//line templates/gititemtree.qtpl:29
 56	StreamGitItemNav(qw422016, name, ref, Tree)
 57//line templates/gititemtree.qtpl:29
 58}
 59
 60//line templates/gititemtree.qtpl:29
 61func (g *GitItemTreePage) WriteNav(qq422016 qtio422016.Writer, name, ref string) {
 62//line templates/gititemtree.qtpl:29
 63	qw422016 := qt422016.AcquireWriter(qq422016)
 64//line templates/gititemtree.qtpl:29
 65	g.StreamNav(qw422016, name, ref)
 66//line templates/gititemtree.qtpl:29
 67	qt422016.ReleaseWriter(qw422016)
 68//line templates/gititemtree.qtpl:29
 69}
 70
 71//line templates/gititemtree.qtpl:29
 72func (g *GitItemTreePage) Nav(name, ref string) string {
 73//line templates/gititemtree.qtpl:29
 74	qb422016 := qt422016.AcquireByteBuffer()
 75//line templates/gititemtree.qtpl:29
 76	g.WriteNav(qb422016, name, ref)
 77//line templates/gititemtree.qtpl:29
 78	qs422016 := string(qb422016.B)
 79//line templates/gititemtree.qtpl:29
 80	qt422016.ReleaseByteBuffer(qb422016)
 81//line templates/gititemtree.qtpl:29
 82	return qs422016
 83//line templates/gititemtree.qtpl:29
 84}
 85
 86//line templates/gititemtree.qtpl:31
 87func (g *GitItemTreePage) StreamGitContent(qw422016 *qt422016.Writer, name, ref string) {
 88//line templates/gititemtree.qtpl:31
 89	qw422016.N().S(`
 90<div class="pathing">
 91    `)
 92//line templates/gititemtree.qtpl:34
 93	if len(g.Path) != 0 {
 94//line templates/gititemtree.qtpl:34
 95		qw422016.N().S(`<a href="`)
 96//line templates/gititemtree.qtpl:35
 97		qw422016.E().S(url(name, Folder, ref, Root, []string{}))
 98//line templates/gititemtree.qtpl:35
 99		qw422016.N().S(`">root/</a>`)
100//line templates/gititemtree.qtpl:36
101		for i, e := range g.Path[:len(g.Path)-1] {
102//line templates/gititemtree.qtpl:36
103			qw422016.N().S(`<a href="`)
104//line templates/gititemtree.qtpl:37
105			qw422016.E().S(url(name, Folder, ref, Root, g.Path[:1+i]))
106//line templates/gititemtree.qtpl:37
107			qw422016.N().S(`">`)
108//line templates/gititemtree.qtpl:37
109			qw422016.E().S(e)
110//line templates/gititemtree.qtpl:37
111			qw422016.N().S(`/</a>`)
112//line templates/gititemtree.qtpl:38
113		}
114//line templates/gititemtree.qtpl:38
115		qw422016.N().S(`<a>`)
116//line templates/gititemtree.qtpl:39
117		qw422016.E().S(u.LastOrZero(g.Path))
118//line templates/gititemtree.qtpl:39
119		qw422016.N().S(`</a>`)
120//line templates/gititemtree.qtpl:40
121	} else {
122//line templates/gititemtree.qtpl:40
123		qw422016.N().S(`<a>root/</a>`)
124//line templates/gititemtree.qtpl:42
125	}
126//line templates/gititemtree.qtpl:43
127	qw422016.N().S(`
128</div>
129<div class="row">
130  <div class="col-md-12">
131    <div class="tree-list">
132      `)
133//line templates/gititemtree.qtpl:48
134	if len(g.Path) != 0 {
135//line templates/gititemtree.qtpl:48
136		qw422016.N().S(`
137          <div class="mode"><a href="`)
138//line templates/gititemtree.qtpl:49
139		qw422016.E().S(url(name, Folder, ref, g.Path[len(g.Path)-1], g.Path[:len(g.Path)-1]))
140//line templates/gititemtree.qtpl:49
141		qw422016.N().S(`">..</a></div>
142          <div class="name tree"></div>
143          <div class="commit"></div>
144          <div class="date"></div>
145          <div class="size"></div>
146      `)
147//line templates/gititemtree.qtpl:54
148	}
149//line templates/gititemtree.qtpl:54
150	qw422016.N().S(`
151      `)
152//line templates/gititemtree.qtpl:55
153	for _, e := range g.Tree.Entries {
154//line templates/gititemtree.qtpl:55
155		qw422016.N().S(`
156          `)
157//line templates/gititemtree.qtpl:56
158		if e.Mode.IsFile() {
159//line templates/gititemtree.qtpl:56
160			qw422016.N().S(`
161          <div class="mode">`)
162//line templates/gititemtree.qtpl:57
163			qw422016.E().S(Ignore(e.Mode.ToOSFileMode()).String())
164//line templates/gititemtree.qtpl:57
165			qw422016.N().S(`</div>
166          <div class="name blob"><a href="`)
167//line templates/gititemtree.qtpl:58
168			qw422016.E().S(url(name, Blob, ref, e.Name, g.Path))
169//line templates/gititemtree.qtpl:58
170			qw422016.N().S(`">`)
171//line templates/gititemtree.qtpl:58
172			qw422016.E().S(e.Name)
173//line templates/gititemtree.qtpl:58
174			qw422016.N().S(`</a></div>
175          `)
176//line templates/gititemtree.qtpl:59
177		} else if e.Mode == filemode.Submodule {
178//line templates/gititemtree.qtpl:59
179			qw422016.N().S(`
180          <div class="mode">m---------</div>
181          <div class="name tree">`)
182//line templates/gititemtree.qtpl:61
183			qw422016.E().S(e.Name)
184//line templates/gititemtree.qtpl:61
185			qw422016.N().S(` (submodule)</div>
186          `)
187//line templates/gititemtree.qtpl:62
188		} else {
189//line templates/gititemtree.qtpl:62
190			qw422016.N().S(`
191          <div class="mode">d---------</div>
192          <div class="name tree"><a href="`)
193//line templates/gititemtree.qtpl:64
194			qw422016.E().S(url(name, Folder, ref, e.Name, g.Path))
195//line templates/gititemtree.qtpl:64
196			qw422016.N().S(`">`)
197//line templates/gititemtree.qtpl:64
198			qw422016.E().S(e.Name)
199//line templates/gititemtree.qtpl:64
200			qw422016.N().S(`</a></div>
201          `)
202//line templates/gititemtree.qtpl:65
203		}
204//line templates/gititemtree.qtpl:65
205		qw422016.N().S(`
206          <div class="commit"></div>
207          <div class="date"></div>
208          <div class="size">`)
209//line templates/gititemtree.qtpl:68
210		qw422016.N().DL(Ignore(g.Tree.Size(e.Name)))
211//line templates/gititemtree.qtpl:68
212		qw422016.N().S(` KiB</div>
213      `)
214//line templates/gititemtree.qtpl:69
215	}
216//line templates/gititemtree.qtpl:69
217	qw422016.N().S(`
218    </div>
219  </div>
220</div>
221`)
222//line templates/gititemtree.qtpl:73
223}
224
225//line templates/gititemtree.qtpl:73
226func (g *GitItemTreePage) WriteGitContent(qq422016 qtio422016.Writer, name, ref string) {
227//line templates/gititemtree.qtpl:73
228	qw422016 := qt422016.AcquireWriter(qq422016)
229//line templates/gititemtree.qtpl:73
230	g.StreamGitContent(qw422016, name, ref)
231//line templates/gititemtree.qtpl:73
232	qt422016.ReleaseWriter(qw422016)
233//line templates/gititemtree.qtpl:73
234}
235
236//line templates/gititemtree.qtpl:73
237func (g *GitItemTreePage) GitContent(name, ref string) string {
238//line templates/gititemtree.qtpl:73
239	qb422016 := qt422016.AcquireByteBuffer()
240//line templates/gititemtree.qtpl:73
241	g.WriteGitContent(qb422016, name, ref)
242//line templates/gititemtree.qtpl:73
243	qs422016 := string(qb422016.B)
244//line templates/gititemtree.qtpl:73
245	qt422016.ReleaseByteBuffer(qb422016)
246//line templates/gititemtree.qtpl:73
247	return qs422016
248//line templates/gititemtree.qtpl:73
249}