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