1
0
mirror of https://github.com/osmarks/mycorrhiza.git synced 2024-10-30 19:56:16 +00:00
mycorrhiza/templates/common.qtpl.go

215 lines
5.5 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"},
{"text", "Raw text"},
{"history", "History"},
{"revision", "NOT REACHED"},
{"rename-ask", "Rename"},
{"delete-ask", "Delete"},
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-20 13:53:30 +00:00
<nav class="hypha-tabs">
<ul class="hypha-tabs__flex">
2020-10-02 15:31:59 +00:00
`)
//line templates/common.qtpl:29
for _, entry := range navEntries {
//line templates/common.qtpl:30
2020-10-02 15:31:59 +00:00
if navType == "revision" && entry.path == "revision" {
//line templates/common.qtpl:30
2021-01-20 13:53:30 +00:00
qw422016.N().S(` <li class="hypha-tabs__tab hypha-tabs__tab_active">
`)
//line templates/common.qtpl:32
2020-10-02 15:31:59 +00:00
qw422016.E().S(revisionHash[0])
//line templates/common.qtpl:32
2021-01-20 13:53:30 +00:00
qw422016.N().S(`
</li>
`)
//line templates/common.qtpl:34
2020-10-02 15:31:59 +00:00
} else if navType == entry.path {
2021-01-20 13:53:30 +00:00
//line templates/common.qtpl:34
qw422016.N().S(` <li class="hypha-tabs__tab hypha-tabs__tab_active">
`)
//line templates/common.qtpl:36
2020-10-02 15:31:59 +00:00
qw422016.E().S(entry.title)
2021-01-20 13:53:30 +00:00
//line templates/common.qtpl:36
qw422016.N().S(`
</li>
2020-10-02 15:31:59 +00:00
`)
2021-01-20 13:53:30 +00:00
//line templates/common.qtpl:38
} else if entry.path != "revision" && u.CanProceed(entry.path) {
2021-01-20 13:53:30 +00:00
//line templates/common.qtpl:38
qw422016.N().S(` <li class="hypha-tabs__tab">
<a href="/`)
//line templates/common.qtpl:40
qw422016.E().S(entry.path)
2021-01-20 13:53:30 +00:00
//line templates/common.qtpl:40
2020-10-02 15:31:59 +00:00
qw422016.N().S(`/`)
2021-01-20 13:53:30 +00:00
//line templates/common.qtpl:40
2020-10-02 15:31:59 +00:00
qw422016.E().S(hyphaName)
2021-01-20 13:53:30 +00:00
//line templates/common.qtpl:40
2020-10-02 15:31:59 +00:00
qw422016.N().S(`">`)
2021-01-20 13:53:30 +00:00
//line templates/common.qtpl:40
2020-10-02 15:31:59 +00:00
qw422016.E().S(entry.title)
2021-01-20 13:53:30 +00:00
//line templates/common.qtpl:40
qw422016.N().S(`</a>
</li>
2020-10-02 15:31:59 +00:00
`)
2021-01-20 13:53:30 +00:00
//line templates/common.qtpl:42
}
2021-01-20 13:53:30 +00:00
//line templates/common.qtpl:43
2020-10-02 15:31:59 +00:00
}
2021-01-20 13:53:30 +00:00
//line templates/common.qtpl:43
2021-01-24 07:30:14 +00:00
qw422016.N().S(` </ul>
2020-10-02 15:31:59 +00:00
</nav>
`)
2021-01-24 07:30:14 +00:00
//line templates/common.qtpl:46
2020-10-02 15:31:59 +00:00
}
2021-01-24 07:30:14 +00:00
//line templates/common.qtpl:46
func writenavHTML(qq422016 qtio422016.Writer, rq *http.Request, hyphaName, navType string, revisionHash ...string) {
2021-01-24 07:30:14 +00:00
//line templates/common.qtpl:46
2020-10-02 15:31:59 +00:00
qw422016 := qt422016.AcquireWriter(qq422016)
2021-01-24 07:30:14 +00:00
//line templates/common.qtpl:46
streamnavHTML(qw422016, rq, hyphaName, navType, revisionHash...)
2021-01-24 07:30:14 +00:00
//line templates/common.qtpl:46
2020-10-02 15:31:59 +00:00
qt422016.ReleaseWriter(qw422016)
2021-01-24 07:30:14 +00:00
//line templates/common.qtpl:46
2020-10-02 15:31:59 +00:00
}
2021-01-24 07:30:14 +00:00
//line templates/common.qtpl:46
func navHTML(rq *http.Request, hyphaName, navType string, revisionHash ...string) string {
2021-01-24 07:30:14 +00:00
//line templates/common.qtpl:46
2020-10-02 15:31:59 +00:00
qb422016 := qt422016.AcquireByteBuffer()
2021-01-24 07:30:14 +00:00
//line templates/common.qtpl:46
writenavHTML(qb422016, rq, hyphaName, navType, revisionHash...)
2021-01-24 07:30:14 +00:00
//line templates/common.qtpl:46
2020-10-02 15:31:59 +00:00
qs422016 := string(qb422016.B)
2021-01-24 07:30:14 +00:00
//line templates/common.qtpl:46
2020-10-02 15:31:59 +00:00
qt422016.ReleaseByteBuffer(qb422016)
2021-01-24 07:30:14 +00:00
//line templates/common.qtpl:46
2020-10-02 15:31:59 +00:00
return qs422016
2021-01-24 07:30:14 +00:00
//line templates/common.qtpl:46
}
2021-01-24 07:30:14 +00:00
//line templates/common.qtpl:48
func streamuserMenuHTML(qw422016 *qt422016.Writer, u *user.User) {
2021-01-24 07:30:14 +00:00
//line templates/common.qtpl:48
qw422016.N().S(`
2021-01-24 07:30:14 +00:00
`)
//line templates/common.qtpl:49
if user.AuthUsed {
2021-01-24 07:30:14 +00:00
//line templates/common.qtpl:49
qw422016.N().S(`
2021-01-24 07:30:14 +00:00
<li class="header-links__entry header-links__entry_user">
`)
//line templates/common.qtpl:51
if u.Group == "anon" {
2021-01-24 07:30:14 +00:00
//line templates/common.qtpl:51
qw422016.N().S(`
2021-01-24 07:30:14 +00:00
<a href="/login" class="header-links__link">Login</a>
`)
//line templates/common.qtpl:53
} else {
2021-01-24 07:30:14 +00:00
//line templates/common.qtpl:53
qw422016.N().S(`
2021-01-24 07:30:14 +00:00
<a href="/page/`)
//line templates/common.qtpl:54
2021-01-23 16:37:29 +00:00
qw422016.E().S(util.UserHypha)
2021-01-24 07:30:14 +00:00
//line templates/common.qtpl:54
qw422016.N().S(`/`)
2021-01-24 07:30:14 +00:00
//line templates/common.qtpl:54
qw422016.E().S(u.Name)
2021-01-24 07:30:14 +00:00
//line templates/common.qtpl:54
qw422016.N().S(`" class="header-links__link">`)
//line templates/common.qtpl:54
qw422016.E().S(u.Name)
2021-01-24 07:30:14 +00:00
//line templates/common.qtpl:54
qw422016.N().S(`</a>
2021-01-24 07:30:14 +00:00
`)
//line templates/common.qtpl:55
}
2021-01-24 07:30:14 +00:00
//line templates/common.qtpl:55
qw422016.N().S(`
2021-01-24 07:30:14 +00:00
</li>
`)
//line templates/common.qtpl:57
}
2021-01-24 07:30:14 +00:00
//line templates/common.qtpl:57
qw422016.N().S(`
`)
2021-01-24 07:30:14 +00:00
//line templates/common.qtpl:58
}
2021-01-24 07:30:14 +00:00
//line templates/common.qtpl:58
func writeuserMenuHTML(qq422016 qtio422016.Writer, u *user.User) {
2021-01-24 07:30:14 +00:00
//line templates/common.qtpl:58
qw422016 := qt422016.AcquireWriter(qq422016)
2021-01-24 07:30:14 +00:00
//line templates/common.qtpl:58
streamuserMenuHTML(qw422016, u)
2021-01-24 07:30:14 +00:00
//line templates/common.qtpl:58
qt422016.ReleaseWriter(qw422016)
2021-01-24 07:30:14 +00:00
//line templates/common.qtpl:58
}
2021-01-24 07:30:14 +00:00
//line templates/common.qtpl:58
func userMenuHTML(u *user.User) string {
2021-01-24 07:30:14 +00:00
//line templates/common.qtpl:58
qb422016 := qt422016.AcquireByteBuffer()
2021-01-24 07:30:14 +00:00
//line templates/common.qtpl:58
writeuserMenuHTML(qb422016, u)
2021-01-24 07:30:14 +00:00
//line templates/common.qtpl:58
qs422016 := string(qb422016.B)
2021-01-24 07:30:14 +00:00
//line templates/common.qtpl:58
qt422016.ReleaseByteBuffer(qb422016)
2021-01-24 07:30:14 +00:00
//line templates/common.qtpl:58
return qs422016
2021-01-24 07:30:14 +00:00
//line templates/common.qtpl:58
2020-10-02 15:31:59 +00:00
}