1
0
mirror of https://github.com/osmarks/mycorrhiza.git synced 2024-12-14 06:10:26 +00:00
mycorrhiza/templates/common.qtpl.go

256 lines
6.8 KiB
Go
Raw Normal View History

2020-10-02 15:31:59 +00:00
// Code generated by qtc from "common.qtpl". DO NOT EDIT.
// See https://github.com/valyala/quicktemplate for details.
//line templates/common.qtpl:1
2020-10-02 15:31:59 +00:00
package templates
//line templates/common.qtpl:1
import "net/http"
2020-10-02 15:31:59 +00:00
//line templates/common.qtpl:2
import "github.com/bouncepaw/mycorrhiza/user"
//line templates/common.qtpl:3
import "github.com/bouncepaw/mycorrhiza/util"
// This is the <nav> seen on top of many pages.
//line templates/common.qtpl:6
2020-10-02 15:31:59 +00:00
import (
qtio422016 "io"
qt422016 "github.com/valyala/quicktemplate"
)
//line templates/common.qtpl:6
2020-10-02 15:31:59 +00:00
var (
_ = qtio422016.Copy
_ = qt422016.AcquireByteBuffer
)
//line templates/common.qtpl:7
2020-10-02 15:31:59 +00:00
type navEntry struct {
path string
title string
}
var navEntries = []navEntry{
{"page", "Hypha"},
{"edit", "Edit"},
{"history", "History"},
{"revision", "NOT REACHED"},
{"rename-ask", "Rename"},
{"delete-ask", "Delete"},
2021-01-26 05:41:57 +00:00
{"text", "Raw text"},
2020-10-02 15:31:59 +00:00
}
//line templates/common.qtpl:22
func streamnavHTML(qw422016 *qt422016.Writer, rq *http.Request, hyphaName, navType string, revisionHash ...string) {
//line templates/common.qtpl:22
qw422016.N().S(`
`)
//line templates/common.qtpl:24
u := user.FromRequest(rq)
//line templates/common.qtpl:25
2020-10-02 15:31:59 +00:00
qw422016.N().S(`
2021-01-25 18:37:21 +00:00
<nav class="hypha-tabs main-width">
2021-01-20 13:53:30 +00:00
<ul class="hypha-tabs__flex">
2020-10-02 15:31:59 +00:00
`)
2021-01-25 18:37:21 +00:00
//line templates/common.qtpl:28
for _, entry := range navEntries {
2021-01-25 18:37:21 +00:00
//line templates/common.qtpl:29
2020-10-02 15:31:59 +00:00
if navType == "revision" && entry.path == "revision" {
2021-01-25 18:37:21 +00:00
//line templates/common.qtpl:29
2021-01-20 13:53:30 +00:00
qw422016.N().S(` <li class="hypha-tabs__tab hypha-tabs__tab_active">
2021-01-25 18:37:21 +00:00
<span class="hypha-tabs__selection">`)
//line templates/common.qtpl:31
2020-10-02 15:31:59 +00:00
qw422016.E().S(revisionHash[0])
2021-01-25 18:37:21 +00:00
//line templates/common.qtpl:31
qw422016.N().S(`</span>
2021-01-20 13:53:30 +00:00
</li>
`)
2021-01-25 18:37:21 +00:00
//line templates/common.qtpl:33
2020-10-02 15:31:59 +00:00
} else if navType == entry.path {
2021-01-25 18:37:21 +00:00
//line templates/common.qtpl:33
2021-01-20 13:53:30 +00:00
qw422016.N().S(` <li class="hypha-tabs__tab hypha-tabs__tab_active">
2021-01-25 18:37:21 +00:00
<span class="hypha-tabs__selection">`)
//line templates/common.qtpl:35
2020-10-02 15:31:59 +00:00
qw422016.E().S(entry.title)
2021-01-25 18:37:21 +00:00
//line templates/common.qtpl:35
qw422016.N().S(`</span>
2021-01-20 13:53:30 +00:00
</li>
2020-10-02 15:31:59 +00:00
`)
2021-01-25 18:37:21 +00:00
//line templates/common.qtpl:37
} else if entry.path != "revision" && u.CanProceed(entry.path) {
2021-01-25 18:37:21 +00:00
//line templates/common.qtpl:37
2021-01-20 13:53:30 +00:00
qw422016.N().S(` <li class="hypha-tabs__tab">
2021-01-25 18:37:21 +00:00
<a class="hypha-tabs__link" href="/`)
//line templates/common.qtpl:39
qw422016.E().S(entry.path)
2021-01-25 18:37:21 +00:00
//line templates/common.qtpl:39
2020-10-02 15:31:59 +00:00
qw422016.N().S(`/`)
2021-01-25 18:37:21 +00:00
//line templates/common.qtpl:39
2020-10-02 15:31:59 +00:00
qw422016.E().S(hyphaName)
2021-01-25 18:37:21 +00:00
//line templates/common.qtpl:39
2020-10-02 15:31:59 +00:00
qw422016.N().S(`">`)
2021-01-25 18:37:21 +00:00
//line templates/common.qtpl:39
2020-10-02 15:31:59 +00:00
qw422016.E().S(entry.title)
2021-01-25 18:37:21 +00:00
//line templates/common.qtpl:39
2021-01-20 13:53:30 +00:00
qw422016.N().S(`</a>
</li>
2020-10-02 15:31:59 +00:00
`)
2021-01-25 18:37:21 +00:00
//line templates/common.qtpl:41
}
2021-01-25 18:37:21 +00:00
//line templates/common.qtpl:42
2020-10-02 15:31:59 +00:00
}
2021-01-25 18:37:21 +00:00
//line templates/common.qtpl:42
2021-01-24 07:30:14 +00:00
qw422016.N().S(` </ul>
2020-10-02 15:31:59 +00:00
</nav>
`)
2021-01-25 18:37:21 +00:00
//line templates/common.qtpl:45
2020-10-02 15:31:59 +00:00
}
2021-01-25 18:37:21 +00:00
//line templates/common.qtpl:45
func writenavHTML(qq422016 qtio422016.Writer, rq *http.Request, hyphaName, navType string, revisionHash ...string) {
2021-01-25 18:37:21 +00:00
//line templates/common.qtpl:45
2020-10-02 15:31:59 +00:00
qw422016 := qt422016.AcquireWriter(qq422016)
2021-01-25 18:37:21 +00:00
//line templates/common.qtpl:45
streamnavHTML(qw422016, rq, hyphaName, navType, revisionHash...)
2021-01-25 18:37:21 +00:00
//line templates/common.qtpl:45
2020-10-02 15:31:59 +00:00
qt422016.ReleaseWriter(qw422016)
2021-01-25 18:37:21 +00:00
//line templates/common.qtpl:45
2020-10-02 15:31:59 +00:00
}
2021-01-25 18:37:21 +00:00
//line templates/common.qtpl:45
func navHTML(rq *http.Request, hyphaName, navType string, revisionHash ...string) string {
2021-01-25 18:37:21 +00:00
//line templates/common.qtpl:45
2020-10-02 15:31:59 +00:00
qb422016 := qt422016.AcquireByteBuffer()
2021-01-25 18:37:21 +00:00
//line templates/common.qtpl:45
writenavHTML(qb422016, rq, hyphaName, navType, revisionHash...)
2021-01-25 18:37:21 +00:00
//line templates/common.qtpl:45
2020-10-02 15:31:59 +00:00
qs422016 := string(qb422016.B)
2021-01-25 18:37:21 +00:00
//line templates/common.qtpl:45
2020-10-02 15:31:59 +00:00
qt422016.ReleaseByteBuffer(qb422016)
2021-01-25 18:37:21 +00:00
//line templates/common.qtpl:45
2020-10-02 15:31:59 +00:00
return qs422016
2021-01-25 18:37:21 +00:00
//line templates/common.qtpl:45
}
2021-01-25 18:37:21 +00:00
//line templates/common.qtpl:47
func streamuserMenuHTML(qw422016 *qt422016.Writer, u *user.User) {
2021-01-25 18:37:21 +00:00
//line templates/common.qtpl:47
qw422016.N().S(`
2021-01-24 07:30:14 +00:00
`)
2021-01-25 18:37:21 +00:00
//line templates/common.qtpl:48
if user.AuthUsed {
2021-01-25 18:37:21 +00:00
//line templates/common.qtpl:48
qw422016.N().S(`
2021-01-24 07:30:14 +00:00
<li class="header-links__entry header-links__entry_user">
`)
2021-01-25 18:37:21 +00:00
//line templates/common.qtpl:50
if u.Group == "anon" {
2021-01-25 18:37:21 +00:00
//line templates/common.qtpl:50
qw422016.N().S(`
2021-01-24 07:30:14 +00:00
<a href="/login" class="header-links__link">Login</a>
`)
2021-01-25 18:37:21 +00:00
//line templates/common.qtpl:52
} else {
2021-01-25 18:37:21 +00:00
//line templates/common.qtpl:52
qw422016.N().S(`
2021-01-24 07:30:14 +00:00
<a href="/page/`)
2021-01-25 18:37:21 +00:00
//line templates/common.qtpl:53
2021-01-23 16:37:29 +00:00
qw422016.E().S(util.UserHypha)
2021-01-25 18:37:21 +00:00
//line templates/common.qtpl:53
qw422016.N().S(`/`)
2021-01-25 18:37:21 +00:00
//line templates/common.qtpl:53
qw422016.E().S(u.Name)
2021-01-25 18:37:21 +00:00
//line templates/common.qtpl:53
2021-01-24 07:30:14 +00:00
qw422016.N().S(`" class="header-links__link">`)
2021-01-25 18:37:21 +00:00
//line templates/common.qtpl:53
qw422016.E().S(u.Name)
2021-01-25 18:37:21 +00:00
//line templates/common.qtpl:53
qw422016.N().S(`</a>
2021-01-24 07:30:14 +00:00
`)
2021-01-25 18:37:21 +00:00
//line templates/common.qtpl:54
}
2021-01-25 18:37:21 +00:00
//line templates/common.qtpl:54
qw422016.N().S(`
2021-01-24 07:30:14 +00:00
</li>
`)
2021-01-25 18:37:21 +00:00
//line templates/common.qtpl:56
}
2021-01-25 18:37:21 +00:00
//line templates/common.qtpl:56
qw422016.N().S(`
`)
2021-01-25 18:37:21 +00:00
//line templates/common.qtpl:57
}
2021-01-25 18:37:21 +00:00
//line templates/common.qtpl:57
func writeuserMenuHTML(qq422016 qtio422016.Writer, u *user.User) {
2021-01-25 18:37:21 +00:00
//line templates/common.qtpl:57
qw422016 := qt422016.AcquireWriter(qq422016)
2021-01-25 18:37:21 +00:00
//line templates/common.qtpl:57
streamuserMenuHTML(qw422016, u)
2021-01-25 18:37:21 +00:00
//line templates/common.qtpl:57
qt422016.ReleaseWriter(qw422016)
2021-01-25 18:37:21 +00:00
//line templates/common.qtpl:57
}
2021-01-25 18:37:21 +00:00
//line templates/common.qtpl:57
func userMenuHTML(u *user.User) string {
2021-01-25 18:37:21 +00:00
//line templates/common.qtpl:57
qb422016 := qt422016.AcquireByteBuffer()
2021-01-25 18:37:21 +00:00
//line templates/common.qtpl:57
writeuserMenuHTML(qb422016, u)
2021-01-25 18:37:21 +00:00
//line templates/common.qtpl:57
qs422016 := string(qb422016.B)
2021-01-25 18:37:21 +00:00
//line templates/common.qtpl:57
qt422016.ReleaseByteBuffer(qb422016)
2021-01-25 18:37:21 +00:00
//line templates/common.qtpl:57
return qs422016
2021-01-25 18:37:21 +00:00
//line templates/common.qtpl:57
2020-10-02 15:31:59 +00:00
}
2021-01-26 05:41:57 +00:00
//line templates/common.qtpl:59
func streamrelativeHyphae(qw422016 *qt422016.Writer, relatives string) {
//line templates/common.qtpl:59
qw422016.N().S(`
<aside class="relative-hyphae layout-card">
<h1 class="relative-hyphae__title layout-card__title">Relative hyphae</h1>
`)
//line templates/common.qtpl:62
qw422016.N().S(relatives)
//line templates/common.qtpl:62
qw422016.N().S(`
</aside>
`)
//line templates/common.qtpl:64
}
//line templates/common.qtpl:64
func writerelativeHyphae(qq422016 qtio422016.Writer, relatives string) {
//line templates/common.qtpl:64
qw422016 := qt422016.AcquireWriter(qq422016)
//line templates/common.qtpl:64
streamrelativeHyphae(qw422016, relatives)
//line templates/common.qtpl:64
qt422016.ReleaseWriter(qw422016)
//line templates/common.qtpl:64
}
//line templates/common.qtpl:64
func relativeHyphae(relatives string) string {
//line templates/common.qtpl:64
qb422016 := qt422016.AcquireByteBuffer()
//line templates/common.qtpl:64
writerelativeHyphae(qb422016, relatives)
//line templates/common.qtpl:64
qs422016 := string(qb422016.B)
//line templates/common.qtpl:64
qt422016.ReleaseByteBuffer(qb422016)
//line templates/common.qtpl:64
return qs422016
//line templates/common.qtpl:64
}