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.
|
|
|
|
|
2020-11-16 15:26:03 +00:00
|
|
|
//line templates/common.qtpl:1
|
2020-10-02 15:31:59 +00:00
|
|
|
package templates
|
|
|
|
|
2020-11-16 15:26:03 +00:00
|
|
|
//line templates/common.qtpl:1
|
|
|
|
import "net/http"
|
|
|
|
|
2020-10-02 15:31:59 +00:00
|
|
|
//line templates/common.qtpl:2
|
2020-11-16 15:26:03 +00:00
|
|
|
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"
|
|
|
|
)
|
|
|
|
|
2020-11-16 15:26:03 +00:00
|
|
|
//line templates/common.qtpl:6
|
2020-10-02 15:31:59 +00:00
|
|
|
var (
|
|
|
|
_ = qtio422016.Copy
|
|
|
|
_ = qt422016.AcquireByteBuffer
|
|
|
|
)
|
|
|
|
|
2020-11-16 15:26:03 +00:00
|
|
|
//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"},
|
2020-11-16 15:26:03 +00:00
|
|
|
{"delete-ask", "Delete"},
|
2020-10-02 15:31:59 +00:00
|
|
|
}
|
|
|
|
|
2020-11-16 15:26:03 +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
|
2021-01-09 20:49:48 +00:00
|
|
|
u := user.FromRequest(rq)
|
2020-11-16 15:26:03 +00:00
|
|
|
|
|
|
|
//line templates/common.qtpl:25
|
2020-10-02 15:31:59 +00:00
|
|
|
qw422016.N().S(`
|
2021-01-09 20:49:48 +00:00
|
|
|
|
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
|
|
|
`)
|
2020-11-16 15:26:03 +00:00
|
|
|
//line templates/common.qtpl:29
|
2021-01-09 20:49:48 +00:00
|
|
|
for _, entry := range navEntries {
|
|
|
|
//line templates/common.qtpl:30
|
2020-10-02 15:31:59 +00:00
|
|
|
if navType == "revision" && entry.path == "revision" {
|
2020-11-16 15:26:03 +00:00
|
|
|
//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])
|
2021-01-09 20:49:48 +00:00
|
|
|
//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
|
2021-01-09 20:49:48 +00:00
|
|
|
} 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
|
2021-01-09 20:49:48 +00:00
|
|
|
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-09 20:49:48 +00:00
|
|
|
}
|
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-09 20:49:48 +00:00
|
|
|
qw422016.N().S(` `)
|
2021-01-20 13:53:30 +00:00
|
|
|
//line templates/common.qtpl:44
|
2020-11-16 15:26:03 +00:00
|
|
|
qw422016.N().S(userMenuHTML(u))
|
2021-01-20 13:53:30 +00:00
|
|
|
//line templates/common.qtpl:44
|
2020-11-16 15:26:03 +00:00
|
|
|
qw422016.N().S(`
|
|
|
|
</ul>
|
2020-10-02 15:31:59 +00:00
|
|
|
</nav>
|
|
|
|
`)
|
2021-01-20 13:53:30 +00:00
|
|
|
//line templates/common.qtpl:47
|
2020-10-02 15:31:59 +00:00
|
|
|
}
|
|
|
|
|
2021-01-20 13:53:30 +00:00
|
|
|
//line templates/common.qtpl:47
|
2020-11-16 15:26:03 +00:00
|
|
|
func writenavHTML(qq422016 qtio422016.Writer, rq *http.Request, hyphaName, navType string, revisionHash ...string) {
|
2021-01-20 13:53:30 +00:00
|
|
|
//line templates/common.qtpl:47
|
2020-10-02 15:31:59 +00:00
|
|
|
qw422016 := qt422016.AcquireWriter(qq422016)
|
2021-01-20 13:53:30 +00:00
|
|
|
//line templates/common.qtpl:47
|
2020-11-16 15:26:03 +00:00
|
|
|
streamnavHTML(qw422016, rq, hyphaName, navType, revisionHash...)
|
2021-01-20 13:53:30 +00:00
|
|
|
//line templates/common.qtpl:47
|
2020-10-02 15:31:59 +00:00
|
|
|
qt422016.ReleaseWriter(qw422016)
|
2021-01-20 13:53:30 +00:00
|
|
|
//line templates/common.qtpl:47
|
2020-10-02 15:31:59 +00:00
|
|
|
}
|
|
|
|
|
2021-01-20 13:53:30 +00:00
|
|
|
//line templates/common.qtpl:47
|
2020-11-16 15:26:03 +00:00
|
|
|
func navHTML(rq *http.Request, hyphaName, navType string, revisionHash ...string) string {
|
2021-01-20 13:53:30 +00:00
|
|
|
//line templates/common.qtpl:47
|
2020-10-02 15:31:59 +00:00
|
|
|
qb422016 := qt422016.AcquireByteBuffer()
|
2021-01-20 13:53:30 +00:00
|
|
|
//line templates/common.qtpl:47
|
2020-11-16 15:26:03 +00:00
|
|
|
writenavHTML(qb422016, rq, hyphaName, navType, revisionHash...)
|
2021-01-20 13:53:30 +00:00
|
|
|
//line templates/common.qtpl:47
|
2020-10-02 15:31:59 +00:00
|
|
|
qs422016 := string(qb422016.B)
|
2021-01-20 13:53:30 +00:00
|
|
|
//line templates/common.qtpl:47
|
2020-10-02 15:31:59 +00:00
|
|
|
qt422016.ReleaseByteBuffer(qb422016)
|
2021-01-20 13:53:30 +00:00
|
|
|
//line templates/common.qtpl:47
|
2020-10-02 15:31:59 +00:00
|
|
|
return qs422016
|
2021-01-20 13:53:30 +00:00
|
|
|
//line templates/common.qtpl:47
|
2020-11-16 15:26:03 +00:00
|
|
|
}
|
|
|
|
|
2021-01-20 13:53:30 +00:00
|
|
|
//line templates/common.qtpl:49
|
2020-11-16 15:26:03 +00:00
|
|
|
func streamuserMenuHTML(qw422016 *qt422016.Writer, u *user.User) {
|
2021-01-20 13:53:30 +00:00
|
|
|
//line templates/common.qtpl:49
|
2020-11-16 15:26:03 +00:00
|
|
|
qw422016.N().S(`
|
2020-11-29 17:09:02 +00:00
|
|
|
`)
|
2021-01-20 13:53:30 +00:00
|
|
|
//line templates/common.qtpl:50
|
2020-11-29 17:09:02 +00:00
|
|
|
if user.AuthUsed {
|
2021-01-20 13:53:30 +00:00
|
|
|
//line templates/common.qtpl:50
|
2020-11-29 17:09:02 +00:00
|
|
|
qw422016.N().S(`
|
2021-01-20 13:53:30 +00:00
|
|
|
<li class="hypha-tabs__tab hypha-tabs__user">
|
2020-11-16 15:26:03 +00:00
|
|
|
`)
|
2021-01-20 13:53:30 +00:00
|
|
|
//line templates/common.qtpl:52
|
2021-01-09 20:49:48 +00:00
|
|
|
if u.Group == "anon" {
|
2021-01-20 13:53:30 +00:00
|
|
|
//line templates/common.qtpl:52
|
2020-11-29 17:09:02 +00:00
|
|
|
qw422016.N().S(`
|
2020-11-16 15:26:03 +00:00
|
|
|
<a href="/login">Login</a>
|
|
|
|
`)
|
2021-01-20 13:53:30 +00:00
|
|
|
//line templates/common.qtpl:54
|
2020-11-29 17:09:02 +00:00
|
|
|
} else {
|
2021-01-20 13:53:30 +00:00
|
|
|
//line templates/common.qtpl:54
|
2020-11-29 17:09:02 +00:00
|
|
|
qw422016.N().S(`
|
|
|
|
<a href="/page/`)
|
2021-01-20 13:53:30 +00:00
|
|
|
//line templates/common.qtpl:55
|
2020-11-29 17:09:02 +00:00
|
|
|
qw422016.E().S(util.UserTree)
|
2021-01-20 13:53:30 +00:00
|
|
|
//line templates/common.qtpl:55
|
2020-11-29 17:09:02 +00:00
|
|
|
qw422016.N().S(`/`)
|
2021-01-20 13:53:30 +00:00
|
|
|
//line templates/common.qtpl:55
|
2020-11-29 17:09:02 +00:00
|
|
|
qw422016.E().S(u.Name)
|
2021-01-20 13:53:30 +00:00
|
|
|
//line templates/common.qtpl:55
|
2020-11-29 17:09:02 +00:00
|
|
|
qw422016.N().S(`">`)
|
2021-01-20 13:53:30 +00:00
|
|
|
//line templates/common.qtpl:55
|
2020-11-29 17:09:02 +00:00
|
|
|
qw422016.E().S(u.Name)
|
2021-01-20 13:53:30 +00:00
|
|
|
//line templates/common.qtpl:55
|
2020-11-29 17:09:02 +00:00
|
|
|
qw422016.N().S(`</a>
|
|
|
|
`)
|
2021-01-20 13:53:30 +00:00
|
|
|
//line templates/common.qtpl:56
|
2020-11-29 17:09:02 +00:00
|
|
|
}
|
2021-01-20 13:53:30 +00:00
|
|
|
//line templates/common.qtpl:56
|
2020-11-29 17:09:02 +00:00
|
|
|
qw422016.N().S(`
|
2020-11-16 15:26:03 +00:00
|
|
|
</li>
|
2020-11-29 17:09:02 +00:00
|
|
|
`)
|
2021-01-20 13:53:30 +00:00
|
|
|
//line templates/common.qtpl:58
|
2020-11-29 17:09:02 +00:00
|
|
|
}
|
2021-01-20 13:53:30 +00:00
|
|
|
//line templates/common.qtpl:58
|
2020-11-29 17:09:02 +00:00
|
|
|
qw422016.N().S(`
|
2020-11-16 15:26:03 +00:00
|
|
|
`)
|
2021-01-20 13:53:30 +00:00
|
|
|
//line templates/common.qtpl:59
|
2020-11-16 15:26:03 +00:00
|
|
|
}
|
|
|
|
|
2021-01-20 13:53:30 +00:00
|
|
|
//line templates/common.qtpl:59
|
2020-11-16 15:26:03 +00:00
|
|
|
func writeuserMenuHTML(qq422016 qtio422016.Writer, u *user.User) {
|
2021-01-20 13:53:30 +00:00
|
|
|
//line templates/common.qtpl:59
|
2020-11-16 15:26:03 +00:00
|
|
|
qw422016 := qt422016.AcquireWriter(qq422016)
|
2021-01-20 13:53:30 +00:00
|
|
|
//line templates/common.qtpl:59
|
2020-11-16 15:26:03 +00:00
|
|
|
streamuserMenuHTML(qw422016, u)
|
2021-01-20 13:53:30 +00:00
|
|
|
//line templates/common.qtpl:59
|
2020-11-16 15:26:03 +00:00
|
|
|
qt422016.ReleaseWriter(qw422016)
|
2021-01-20 13:53:30 +00:00
|
|
|
//line templates/common.qtpl:59
|
2020-11-16 15:26:03 +00:00
|
|
|
}
|
|
|
|
|
2021-01-20 13:53:30 +00:00
|
|
|
//line templates/common.qtpl:59
|
2020-11-16 15:26:03 +00:00
|
|
|
func userMenuHTML(u *user.User) string {
|
2021-01-20 13:53:30 +00:00
|
|
|
//line templates/common.qtpl:59
|
2020-11-16 15:26:03 +00:00
|
|
|
qb422016 := qt422016.AcquireByteBuffer()
|
2021-01-20 13:53:30 +00:00
|
|
|
//line templates/common.qtpl:59
|
2020-11-16 15:26:03 +00:00
|
|
|
writeuserMenuHTML(qb422016, u)
|
2021-01-20 13:53:30 +00:00
|
|
|
//line templates/common.qtpl:59
|
2020-11-16 15:26:03 +00:00
|
|
|
qs422016 := string(qb422016.B)
|
2021-01-20 13:53:30 +00:00
|
|
|
//line templates/common.qtpl:59
|
2020-11-16 15:26:03 +00:00
|
|
|
qt422016.ReleaseByteBuffer(qb422016)
|
2021-01-20 13:53:30 +00:00
|
|
|
//line templates/common.qtpl:59
|
2020-11-16 15:26:03 +00:00
|
|
|
return qs422016
|
2021-01-20 13:53:30 +00:00
|
|
|
//line templates/common.qtpl:59
|
2020-10-02 15:31:59 +00:00
|
|
|
}
|