cerrado @ 57efc8d2173fdff1ef99157a2633d3f1d366a290

  1// Code generated by qtc from "navbar.qtpl". DO NOT EDIT.
  2// See https://github.com/valyala/quicktemplate for details.
  3
  4//line templates/navbar.qtpl:1
  5package templates
  6
  7//line templates/navbar.qtpl:1
  8import "context"
  9
 10//line templates/navbar.qtpl:3
 11import (
 12	qtio422016 "io"
 13
 14	qt422016 "github.com/valyala/quicktemplate"
 15)
 16
 17//line templates/navbar.qtpl:3
 18var (
 19	_ = qtio422016.Copy
 20	_ = qt422016.AcquireByteBuffer
 21)
 22
 23//line templates/navbar.qtpl:4
 24type Selection int
 25
 26const (
 27	Git Selection = iota
 28	List
 29	About
 30	Config
 31	Login
 32)
 33
 34//line templates/navbar.qtpl:15
 35type GitSelection int
 36
 37const (
 38	Readme GitSelection = iota
 39	Log
 40	Summary
 41	Refs
 42	Tree
 43)
 44
 45//line templates/navbar.qtpl:25
 46func streaminsertIfEqual(qw422016 *qt422016.Writer, s, d any) {
 47//line templates/navbar.qtpl:25
 48	if s == d {
 49//line templates/navbar.qtpl:25
 50		qw422016.N().S(` selected`)
 51//line templates/navbar.qtpl:25
 52	}
 53//line templates/navbar.qtpl:25
 54}
 55
 56//line templates/navbar.qtpl:25
 57func writeinsertIfEqual(qq422016 qtio422016.Writer, s, d any) {
 58//line templates/navbar.qtpl:25
 59	qw422016 := qt422016.AcquireWriter(qq422016)
 60//line templates/navbar.qtpl:25
 61	streaminsertIfEqual(qw422016, s, d)
 62//line templates/navbar.qtpl:25
 63	qt422016.ReleaseWriter(qw422016)
 64//line templates/navbar.qtpl:25
 65}
 66
 67//line templates/navbar.qtpl:25
 68func insertIfEqual(s, d any) string {
 69//line templates/navbar.qtpl:25
 70	qb422016 := qt422016.AcquireByteBuffer()
 71//line templates/navbar.qtpl:25
 72	writeinsertIfEqual(qb422016, s, d)
 73//line templates/navbar.qtpl:25
 74	qs422016 := string(qb422016.B)
 75//line templates/navbar.qtpl:25
 76	qt422016.ReleaseByteBuffer(qb422016)
 77//line templates/navbar.qtpl:25
 78	return qs422016
 79//line templates/navbar.qtpl:25
 80}
 81
 82//line templates/navbar.qtpl:27
 83func StreamNavbar(qw422016 *qt422016.Writer, ctx context.Context, s Selection) {
 84//line templates/navbar.qtpl:27
 85	qw422016.N().S(`
 86        <nav class="container navbar navbar-expand">
 87          <div class="navbar-nav">
 88            <a class="nav-link`)
 89//line templates/navbar.qtpl:30
 90	streaminsertIfEqual(qw422016, s, Git)
 91//line templates/navbar.qtpl:30
 92	qw422016.N().S(`" href="/">git</a>
 93          </div>
 94          <div class="navbar-nav ms-auto">
 95          `)
 96//line templates/navbar.qtpl:33
 97	if IsLoggedIn(ctx) {
 98//line templates/navbar.qtpl:33
 99		qw422016.N().S(`
100            <a class="nav-link`)
101//line templates/navbar.qtpl:34
102		streaminsertIfEqual(qw422016, s, Login)
103//line templates/navbar.qtpl:34
104		qw422016.N().S(`" href="/logout/">logout</a>
105          `)
106//line templates/navbar.qtpl:35
107	} else {
108//line templates/navbar.qtpl:35
109		qw422016.N().S(`
110            <a class="nav-link`)
111//line templates/navbar.qtpl:36
112		streaminsertIfEqual(qw422016, s, Login)
113//line templates/navbar.qtpl:36
114		qw422016.N().S(`" href="/login/">login</a>
115          `)
116//line templates/navbar.qtpl:37
117	}
118//line templates/navbar.qtpl:37
119	qw422016.N().S(`
120`)
121//line templates/navbar.qtpl:41
122	qw422016.N().S(`
123`)
124//line templates/navbar.qtpl:45
125	qw422016.N().S(`
126          </div>
127        </nav>
128`)
129//line templates/navbar.qtpl:48
130}
131
132//line templates/navbar.qtpl:48
133func WriteNavbar(qq422016 qtio422016.Writer, ctx context.Context, s Selection) {
134//line templates/navbar.qtpl:48
135	qw422016 := qt422016.AcquireWriter(qq422016)
136//line templates/navbar.qtpl:48
137	StreamNavbar(qw422016, ctx, s)
138//line templates/navbar.qtpl:48
139	qt422016.ReleaseWriter(qw422016)
140//line templates/navbar.qtpl:48
141}
142
143//line templates/navbar.qtpl:48
144func Navbar(ctx context.Context, s Selection) string {
145//line templates/navbar.qtpl:48
146	qb422016 := qt422016.AcquireByteBuffer()
147//line templates/navbar.qtpl:48
148	WriteNavbar(qb422016, ctx, s)
149//line templates/navbar.qtpl:48
150	qs422016 := string(qb422016.B)
151//line templates/navbar.qtpl:48
152	qt422016.ReleaseByteBuffer(qb422016)
153//line templates/navbar.qtpl:48
154	return qs422016
155//line templates/navbar.qtpl:48
156}
157
158//line templates/navbar.qtpl:50
159func StreamGitItemNav(qw422016 *qt422016.Writer, name, ref string, s GitSelection) {
160//line templates/navbar.qtpl:50
161	qw422016.N().S(`
162<div class="row">
163    <h3 id="name">`)
164//line templates/navbar.qtpl:52
165	qw422016.E().S(name)
166//line templates/navbar.qtpl:52
167	qw422016.N().S(` `)
168//line templates/navbar.qtpl:52
169	if ref != "" && (s == Log || s == Tree) {
170//line templates/navbar.qtpl:52
171		qw422016.N().S(`@ `)
172//line templates/navbar.qtpl:52
173		qw422016.E().S(ref)
174//line templates/navbar.qtpl:52
175	}
176//line templates/navbar.qtpl:52
177	qw422016.N().S(`</h3>
178</div>
179<div class="row">
180  <ul class="nav">
181    <li class="nav-item">
182      <a class="nav-link`)
183//line templates/navbar.qtpl:57
184	streaminsertIfEqual(qw422016, s, Readme)
185//line templates/navbar.qtpl:57
186	qw422016.N().S(`" aria-current="page" href="/`)
187//line templates/navbar.qtpl:57
188	qw422016.E().S(name)
189//line templates/navbar.qtpl:57
190	qw422016.N().S(`/about/">about</a>
191    </li>
192    <li class="nav-item">
193      <a class="nav-link`)
194//line templates/navbar.qtpl:60
195	streaminsertIfEqual(qw422016, s, Summary)
196//line templates/navbar.qtpl:60
197	qw422016.N().S(`" aria-current="page" href="/`)
198//line templates/navbar.qtpl:60
199	qw422016.E().S(name)
200//line templates/navbar.qtpl:60
201	qw422016.N().S(`/">summary</a>
202    </li>
203    <li class="nav-item">
204      <a class="nav-link`)
205//line templates/navbar.qtpl:63
206	streaminsertIfEqual(qw422016, s, Refs)
207//line templates/navbar.qtpl:63
208	qw422016.N().S(`" aria-current="page" href="/`)
209//line templates/navbar.qtpl:63
210	qw422016.E().S(name)
211//line templates/navbar.qtpl:63
212	qw422016.N().S(`/refs/">refs</a>
213    </li>
214    <li class="nav-item">
215      <a class="nav-link`)
216//line templates/navbar.qtpl:66
217	streaminsertIfEqual(qw422016, s, Log)
218//line templates/navbar.qtpl:66
219	qw422016.N().S(`" aria-current="page" href="/`)
220//line templates/navbar.qtpl:66
221	qw422016.E().S(name)
222//line templates/navbar.qtpl:66
223	qw422016.N().S(`/log/`)
224//line templates/navbar.qtpl:66
225	qw422016.E().S(ref)
226//line templates/navbar.qtpl:66
227	qw422016.N().S(`/">log</a>
228    </li>
229    <li class="nav-item">
230      <a class="nav-link`)
231//line templates/navbar.qtpl:69
232	streaminsertIfEqual(qw422016, s, Tree)
233//line templates/navbar.qtpl:69
234	qw422016.N().S(`" aria-current="page" href="/`)
235//line templates/navbar.qtpl:69
236	qw422016.E().S(name)
237//line templates/navbar.qtpl:69
238	qw422016.N().S(`/tree/`)
239//line templates/navbar.qtpl:69
240	qw422016.E().S(ref)
241//line templates/navbar.qtpl:69
242	qw422016.N().S(`/">tree</a>
243    </li>
244  </ul>
245</div>
246`)
247//line templates/navbar.qtpl:73
248}
249
250//line templates/navbar.qtpl:73
251func WriteGitItemNav(qq422016 qtio422016.Writer, name, ref string, s GitSelection) {
252//line templates/navbar.qtpl:73
253	qw422016 := qt422016.AcquireWriter(qq422016)
254//line templates/navbar.qtpl:73
255	StreamGitItemNav(qw422016, name, ref, s)
256//line templates/navbar.qtpl:73
257	qt422016.ReleaseWriter(qw422016)
258//line templates/navbar.qtpl:73
259}
260
261//line templates/navbar.qtpl:73
262func GitItemNav(name, ref string, s GitSelection) string {
263//line templates/navbar.qtpl:73
264	qb422016 := qt422016.AcquireByteBuffer()
265//line templates/navbar.qtpl:73
266	WriteGitItemNav(qb422016, name, ref, s)
267//line templates/navbar.qtpl:73
268	qs422016 := string(qb422016.B)
269//line templates/navbar.qtpl:73
270	qt422016.ReleaseByteBuffer(qb422016)
271//line templates/navbar.qtpl:73
272	return qs422016
273//line templates/navbar.qtpl:73
274}