1// Code generated by qtc from "base.qtpl". DO NOT EDIT.
2// See https://github.com/valyala/quicktemplate for details.
3
4// This is a base page template. All the other template pages implement this interface.
5//
6
7//line templates/base.qtpl:3
8package templates
9
10//line templates/base.qtpl:3
11import "context"
12
13//line templates/base.qtpl:4
14import "strconv"
15
16//line templates/base.qtpl:5
17import "time"
18
19//line templates/base.qtpl:7
20import (
21 qtio422016 "io"
22
23 qt422016 "github.com/valyala/quicktemplate"
24)
25
26//line templates/base.qtpl:7
27var (
28 _ = qtio422016.Copy
29 _ = qt422016.AcquireByteBuffer
30)
31
32//line templates/base.qtpl:8
33var Slug = ""
34
35//line templates/base.qtpl:12
36type Page interface {
37//line templates/base.qtpl:12
38 Title(ctx context.Context) string
39//line templates/base.qtpl:12
40 StreamTitle(qw422016 *qt422016.Writer, ctx context.Context)
41//line templates/base.qtpl:12
42 WriteTitle(qq422016 qtio422016.Writer, ctx context.Context)
43//line templates/base.qtpl:12
44 Content(ctx context.Context) string
45//line templates/base.qtpl:12
46 StreamContent(qw422016 *qt422016.Writer, ctx context.Context)
47//line templates/base.qtpl:12
48 WriteContent(qq422016 qtio422016.Writer, ctx context.Context)
49//line templates/base.qtpl:12
50 Script(ctx context.Context) string
51//line templates/base.qtpl:12
52 StreamScript(qw422016 *qt422016.Writer, ctx context.Context)
53//line templates/base.qtpl:12
54 WriteScript(qq422016 qtio422016.Writer, ctx context.Context)
55//line templates/base.qtpl:12
56 Navbar(ctx context.Context) string
57//line templates/base.qtpl:12
58 StreamNavbar(qw422016 *qt422016.Writer, ctx context.Context)
59//line templates/base.qtpl:12
60 WriteNavbar(qq422016 qtio422016.Writer, ctx context.Context)
61//line templates/base.qtpl:12
62}
63
64//line templates/base.qtpl:21
65func FromUInttoString(u *uint) string {
66 if u != nil {
67 return strconv.FormatUint(uint64(*u), 10)
68 }
69 return ""
70}
71
72//line templates/base.qtpl:31
73func TimeFormat(t time.Time) string {
74 return t.Format("02.01.2006")
75}
76
77//line templates/base.qtpl:36
78func Ignore[T any](v T, _ error) T {
79 return v
80}
81
82//line templates/base.qtpl:42
83func IsAuthenticationDisabled(ctx context.Context) bool {
84 t, ok := ctx.Value("disableAuthentication").(bool)
85 return ok && t
86}
87
88//line templates/base.qtpl:48
89func IsLoggedIn(ctx context.Context) bool {
90 t, ok := ctx.Value("logged").(bool)
91 return ok && t
92}
93
94// Page prints a page implementing Page interface.
95
96//line templates/base.qtpl:55
97func StreamPageTemplate(qw422016 *qt422016.Writer, p Page, ctx context.Context) {
98//line templates/base.qtpl:55
99 qw422016.N().S(`
100<!DOCTYPE html>
101<html lang="en" data-bs-theme="light">
102 <head>
103 <meta charset="utf-8">
104 <link rel="icon" href="data:,">
105 <title>`)
106//line templates/base.qtpl:61
107 p.StreamTitle(qw422016, ctx)
108//line templates/base.qtpl:61
109 qw422016.N().S(`</title>
110 <link rel="stylesheet" href="/static/main`)
111//line templates/base.qtpl:62
112 qw422016.E().S(Slug)
113//line templates/base.qtpl:62
114 qw422016.N().S(`.css">
115 <html data-bs-theme="dark">
116 <meta content="text/html;charset=utf-8" http-equiv="Content-Type">
117 <meta name="viewport" content="width=device-width, initial-scale=1" />
118 </head>
119 <body>
120 `)
121//line templates/base.qtpl:68
122 p.StreamNavbar(qw422016, ctx)
123//line templates/base.qtpl:68
124 qw422016.N().S(`
125 <div class="container">
126 `)
127//line templates/base.qtpl:70
128 p.StreamContent(qw422016, ctx)
129//line templates/base.qtpl:70
130 qw422016.N().S(`
131 </div>
132 </body>
133 `)
134//line templates/base.qtpl:73
135 p.StreamScript(qw422016, ctx)
136//line templates/base.qtpl:73
137 qw422016.N().S(`
138 <script>
139 function a(){const e=window.matchMedia("(prefers-color-scheme: dark)").matches;document.documentElement.setAttribute("data-bs-theme",e?"dark":"light")}a(),window.matchMedia("(prefers-color-scheme: dark)").addEventListener("change",a);
140 </script>
141</html>
142`)
143//line templates/base.qtpl:78
144}
145
146//line templates/base.qtpl:78
147func WritePageTemplate(qq422016 qtio422016.Writer, p Page, ctx context.Context) {
148//line templates/base.qtpl:78
149 qw422016 := qt422016.AcquireWriter(qq422016)
150//line templates/base.qtpl:78
151 StreamPageTemplate(qw422016, p, ctx)
152//line templates/base.qtpl:78
153 qt422016.ReleaseWriter(qw422016)
154//line templates/base.qtpl:78
155}
156
157//line templates/base.qtpl:78
158func PageTemplate(p Page, ctx context.Context) string {
159//line templates/base.qtpl:78
160 qb422016 := qt422016.AcquireByteBuffer()
161//line templates/base.qtpl:78
162 WritePageTemplate(qb422016, p, ctx)
163//line templates/base.qtpl:78
164 qs422016 := string(qb422016.B)
165//line templates/base.qtpl:78
166 qt422016.ReleaseByteBuffer(qb422016)
167//line templates/base.qtpl:78
168 return qs422016
169//line templates/base.qtpl:78
170}