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

303 lines
8.6 KiB
Go
Raw Normal View History

2021-01-24 12:52:40 +00:00
// Code generated by qtc from "readers.qtpl". DO NOT EDIT.
2020-08-31 17:52:26 +00:00
// See https://github.com/valyala/quicktemplate for details.
2021-01-24 12:52:40 +00:00
//line templates/readers.qtpl:1
2020-08-31 17:52:26 +00:00
package templates
2021-01-24 12:52:40 +00:00
//line templates/readers.qtpl:1
import "net/http"
2021-01-24 12:52:40 +00:00
//line templates/readers.qtpl:2
2020-11-29 11:32:52 +00:00
import "path"
2021-01-24 12:52:40 +00:00
//line templates/readers.qtpl:3
import "github.com/bouncepaw/mycorrhiza/user"
2021-01-24 12:52:40 +00:00
//line templates/readers.qtpl:5
2020-08-31 17:52:26 +00:00
import (
qtio422016 "io"
qt422016 "github.com/valyala/quicktemplate"
)
2021-01-24 12:52:40 +00:00
//line templates/readers.qtpl:5
2020-08-31 17:52:26 +00:00
var (
_ = qtio422016.Copy
_ = qt422016.AcquireByteBuffer
)
2021-01-24 12:52:40 +00:00
//line templates/readers.qtpl:5
2020-11-29 17:06:45 +00:00
func StreamHistoryHTML(qw422016 *qt422016.Writer, rq *http.Request, hyphaName, list string) {
2021-01-24 12:52:40 +00:00
//line templates/readers.qtpl:5
2020-08-31 17:52:26 +00:00
qw422016.N().S(`
2020-10-02 15:31:59 +00:00
`)
2021-01-24 12:52:40 +00:00
//line templates/readers.qtpl:6
streamnavHTML(qw422016, rq, hyphaName, "history")
2021-01-24 12:52:40 +00:00
//line templates/readers.qtpl:6
2020-10-02 15:31:59 +00:00
qw422016.N().S(`
2021-01-26 05:41:57 +00:00
<div class="layout">
<main class="main-width">
2020-11-29 17:06:45 +00:00
<article class="history">
<h1>History of `)
2021-01-26 05:41:57 +00:00
//line templates/readers.qtpl:10
2020-11-29 17:06:45 +00:00
qw422016.E().S(hyphaName)
2021-01-26 05:41:57 +00:00
//line templates/readers.qtpl:10
2020-11-29 17:06:45 +00:00
qw422016.N().S(`</h1>
2020-10-02 15:31:59 +00:00
`)
2021-01-26 05:41:57 +00:00
//line templates/readers.qtpl:11
2020-11-29 17:06:45 +00:00
qw422016.N().S(list)
2021-01-26 05:41:57 +00:00
//line templates/readers.qtpl:11
2020-08-31 17:52:26 +00:00
qw422016.N().S(`
2020-11-29 17:06:45 +00:00
</article>
2020-10-02 15:31:59 +00:00
</main>
2021-01-26 05:41:57 +00:00
</div>
2020-08-31 17:52:26 +00:00
`)
2021-01-26 05:41:57 +00:00
//line templates/readers.qtpl:15
2020-08-31 17:52:26 +00:00
}
2021-01-26 05:41:57 +00:00
//line templates/readers.qtpl:15
2020-11-29 17:06:45 +00:00
func WriteHistoryHTML(qq422016 qtio422016.Writer, rq *http.Request, hyphaName, list string) {
2021-01-26 05:41:57 +00:00
//line templates/readers.qtpl:15
2020-08-31 17:52:26 +00:00
qw422016 := qt422016.AcquireWriter(qq422016)
2021-01-26 05:41:57 +00:00
//line templates/readers.qtpl:15
2020-11-29 17:06:45 +00:00
StreamHistoryHTML(qw422016, rq, hyphaName, list)
2021-01-26 05:41:57 +00:00
//line templates/readers.qtpl:15
2020-08-31 17:52:26 +00:00
qt422016.ReleaseWriter(qw422016)
2021-01-26 05:41:57 +00:00
//line templates/readers.qtpl:15
2020-08-31 17:52:26 +00:00
}
2021-01-26 05:41:57 +00:00
//line templates/readers.qtpl:15
2020-11-29 17:06:45 +00:00
func HistoryHTML(rq *http.Request, hyphaName, list string) string {
2021-01-26 05:41:57 +00:00
//line templates/readers.qtpl:15
2020-08-31 17:52:26 +00:00
qb422016 := qt422016.AcquireByteBuffer()
2021-01-26 05:41:57 +00:00
//line templates/readers.qtpl:15
2020-11-29 17:06:45 +00:00
WriteHistoryHTML(qb422016, rq, hyphaName, list)
2021-01-26 05:41:57 +00:00
//line templates/readers.qtpl:15
2020-08-31 17:52:26 +00:00
qs422016 := string(qb422016.B)
2021-01-26 05:41:57 +00:00
//line templates/readers.qtpl:15
2020-08-31 17:52:26 +00:00
qt422016.ReleaseByteBuffer(qb422016)
2021-01-26 05:41:57 +00:00
//line templates/readers.qtpl:15
2020-08-31 17:52:26 +00:00
return qs422016
2021-01-26 05:41:57 +00:00
//line templates/readers.qtpl:15
2020-08-31 17:52:26 +00:00
}
2021-01-26 05:41:57 +00:00
//line templates/readers.qtpl:17
func StreamRevisionHTML(qw422016 *qt422016.Writer, rq *http.Request, hyphaName, naviTitle, contents, relatives, revHash string) {
//line templates/readers.qtpl:17
2020-08-31 17:52:26 +00:00
qw422016.N().S(`
2020-10-02 15:31:59 +00:00
`)
2021-01-26 05:41:57 +00:00
//line templates/readers.qtpl:18
streamnavHTML(qw422016, rq, hyphaName, "revision", revHash)
2021-01-26 05:41:57 +00:00
//line templates/readers.qtpl:18
2020-10-02 15:31:59 +00:00
qw422016.N().S(`
2021-01-26 05:41:57 +00:00
<div class="layout">
<main class="main-width">
2020-10-02 15:31:59 +00:00
<article>
<p>Please note that viewing binary parts of hyphae is not supported in history for now.</p>
`)
2021-01-26 05:41:57 +00:00
//line templates/readers.qtpl:23
2020-08-31 17:52:26 +00:00
qw422016.N().S(naviTitle)
2021-01-26 05:41:57 +00:00
//line templates/readers.qtpl:23
2020-08-31 17:52:26 +00:00
qw422016.N().S(`
2020-10-02 15:31:59 +00:00
`)
2021-01-26 05:41:57 +00:00
//line templates/readers.qtpl:24
2020-08-31 17:52:26 +00:00
qw422016.N().S(contents)
2021-01-26 05:41:57 +00:00
//line templates/readers.qtpl:24
2020-08-31 17:52:26 +00:00
qw422016.N().S(`
2020-10-02 15:31:59 +00:00
</article>
</main>
2020-08-31 17:52:26 +00:00
`)
2021-01-26 05:41:57 +00:00
//line templates/readers.qtpl:27
streamrelativeHyphae(qw422016, relatives)
//line templates/readers.qtpl:27
qw422016.N().S(`
</div>
`)
//line templates/readers.qtpl:29
2020-08-31 17:52:26 +00:00
}
2021-01-26 05:41:57 +00:00
//line templates/readers.qtpl:29
func WriteRevisionHTML(qq422016 qtio422016.Writer, rq *http.Request, hyphaName, naviTitle, contents, relatives, revHash string) {
//line templates/readers.qtpl:29
2020-08-31 17:52:26 +00:00
qw422016 := qt422016.AcquireWriter(qq422016)
2021-01-26 05:41:57 +00:00
//line templates/readers.qtpl:29
StreamRevisionHTML(qw422016, rq, hyphaName, naviTitle, contents, relatives, revHash)
//line templates/readers.qtpl:29
2020-08-31 17:52:26 +00:00
qt422016.ReleaseWriter(qw422016)
2021-01-26 05:41:57 +00:00
//line templates/readers.qtpl:29
2020-08-31 17:52:26 +00:00
}
2021-01-26 05:41:57 +00:00
//line templates/readers.qtpl:29
func RevisionHTML(rq *http.Request, hyphaName, naviTitle, contents, relatives, revHash string) string {
//line templates/readers.qtpl:29
2020-08-31 17:52:26 +00:00
qb422016 := qt422016.AcquireByteBuffer()
2021-01-26 05:41:57 +00:00
//line templates/readers.qtpl:29
WriteRevisionHTML(qb422016, rq, hyphaName, naviTitle, contents, relatives, revHash)
//line templates/readers.qtpl:29
2020-08-31 17:52:26 +00:00
qs422016 := string(qb422016.B)
2021-01-26 05:41:57 +00:00
//line templates/readers.qtpl:29
2020-08-31 17:52:26 +00:00
qt422016.ReleaseByteBuffer(qb422016)
2021-01-26 05:41:57 +00:00
//line templates/readers.qtpl:29
2020-08-31 17:52:26 +00:00
return qs422016
2021-01-26 05:41:57 +00:00
//line templates/readers.qtpl:29
2020-08-31 17:52:26 +00:00
}
// If `contents` == "", a helpful message is shown instead.
2021-01-26 05:41:57 +00:00
//line templates/readers.qtpl:32
func StreamPageHTML(qw422016 *qt422016.Writer, rq *http.Request, hyphaName, naviTitle, contents, relatives, prevHyphaName, nextHyphaName string, hasAmnt bool) {
2021-01-26 05:41:57 +00:00
//line templates/readers.qtpl:32
2020-08-31 17:52:26 +00:00
qw422016.N().S(`
2020-10-02 15:31:59 +00:00
`)
2021-01-26 05:41:57 +00:00
//line templates/readers.qtpl:33
streamnavHTML(qw422016, rq, hyphaName, "page")
2021-01-26 05:41:57 +00:00
//line templates/readers.qtpl:33
2020-10-02 15:31:59 +00:00
qw422016.N().S(`
2021-01-25 18:37:21 +00:00
<div class="layout">
2021-01-26 05:41:57 +00:00
<main class="main-width">
<article>
`)
//line templates/readers.qtpl:37
2021-01-26 05:41:57 +00:00
qw422016.N().S(naviTitle)
//line templates/readers.qtpl:37
2021-01-26 05:41:57 +00:00
qw422016.N().S(`
`)
//line templates/readers.qtpl:38
2021-01-26 05:41:57 +00:00
if contents == "" {
//line templates/readers.qtpl:38
2021-01-26 05:41:57 +00:00
qw422016.N().S(`
<p>This hypha has no text. Why not <a href="/edit/`)
//line templates/readers.qtpl:39
2021-01-26 05:41:57 +00:00
qw422016.E().S(hyphaName)
//line templates/readers.qtpl:39
2021-01-26 05:41:57 +00:00
qw422016.N().S(`">create it</a>?</p>
`)
//line templates/readers.qtpl:40
2021-01-26 05:41:57 +00:00
} else {
//line templates/readers.qtpl:40
2020-08-31 17:52:26 +00:00
qw422016.N().S(`
2021-01-25 18:37:21 +00:00
`)
//line templates/readers.qtpl:41
2021-01-26 05:41:57 +00:00
qw422016.N().S(contents)
//line templates/readers.qtpl:41
2021-01-26 05:41:57 +00:00
qw422016.N().S(`
`)
//line templates/readers.qtpl:42
}
//line templates/readers.qtpl:42
2020-08-31 17:52:26 +00:00
qw422016.N().S(`
2021-01-26 05:41:57 +00:00
</article>
<section class="prevnext">
`)
//line templates/readers.qtpl:45
2020-11-29 11:32:52 +00:00
if prevHyphaName != "" {
//line templates/readers.qtpl:45
2021-01-26 05:41:57 +00:00
qw422016.N().S(`
<a class="prevnext__el prevnext__prev" href="/page/`)
//line templates/readers.qtpl:46
2020-11-29 11:32:52 +00:00
qw422016.E().S(prevHyphaName)
2021-01-26 05:41:57 +00:00
//line templates/readers.qtpl:46
2021-01-14 11:39:54 +00:00
qw422016.N().S(`" rel="prev">← `)
2021-01-26 05:41:57 +00:00
//line templates/readers.qtpl:46
2020-11-29 11:32:52 +00:00
qw422016.E().S(path.Base(prevHyphaName))
//line templates/readers.qtpl:46
2021-01-26 05:41:57 +00:00
qw422016.N().S(`</a>
`)
//line templates/readers.qtpl:47
2020-11-29 11:32:52 +00:00
}
//line templates/readers.qtpl:47
2021-01-26 05:41:57 +00:00
qw422016.N().S(`
`)
//line templates/readers.qtpl:48
2020-11-29 11:32:52 +00:00
if nextHyphaName != "" {
//line templates/readers.qtpl:48
2021-01-26 05:41:57 +00:00
qw422016.N().S(`
<a class="prevnext__el prevnext__next" href="/page/`)
//line templates/readers.qtpl:49
2020-11-29 11:32:52 +00:00
qw422016.E().S(nextHyphaName)
2021-01-26 05:41:57 +00:00
//line templates/readers.qtpl:49
2021-01-14 11:39:54 +00:00
qw422016.N().S(`" rel="next">`)
2021-01-26 05:41:57 +00:00
//line templates/readers.qtpl:49
2020-11-29 11:32:52 +00:00
qw422016.E().S(path.Base(nextHyphaName))
//line templates/readers.qtpl:49
2021-01-26 05:41:57 +00:00
qw422016.N().S(` </a>
`)
//line templates/readers.qtpl:50
2020-11-29 11:32:52 +00:00
}
2021-01-26 05:41:57 +00:00
//line templates/readers.qtpl:50
2020-11-29 11:32:52 +00:00
qw422016.N().S(`
2021-01-26 05:41:57 +00:00
</section>
`)
//line templates/readers.qtpl:52
if u := user.FromRequest(rq); !user.AuthUsed || u.Group != "anon" {
//line templates/readers.qtpl:52
2021-01-26 05:41:57 +00:00
qw422016.N().S(`
<form action="/upload-binary/`)
//line templates/readers.qtpl:53
qw422016.E().S(hyphaName)
2021-01-26 05:41:57 +00:00
//line templates/readers.qtpl:53
qw422016.N().S(`"
2021-01-26 05:41:57 +00:00
method="post" enctype="multipart/form-data"
class="upload-amnt">
`)
//line templates/readers.qtpl:56
2021-01-19 18:08:59 +00:00
if hasAmnt {
//line templates/readers.qtpl:56
2021-01-26 05:41:57 +00:00
qw422016.N().S(`
<a class="upload-amnt__unattach" href="/unattach-ask/`)
//line templates/readers.qtpl:57
2021-01-19 18:08:59 +00:00
qw422016.E().S(hyphaName)
//line templates/readers.qtpl:57
2021-01-26 05:41:57 +00:00
qw422016.N().S(`">Unattach current attachment?</a>
`)
//line templates/readers.qtpl:58
2021-01-19 18:08:59 +00:00
}
2021-01-26 05:41:57 +00:00
//line templates/readers.qtpl:58
2021-01-19 18:08:59 +00:00
qw422016.N().S(`
2021-01-26 05:41:57 +00:00
<label for="upload-binary__input">Upload a new attachment</label>
<br>
<input type="file" id="upload-binary__input" name="binary"/>
<input type="submit"/>
</form>
`)
//line templates/readers.qtpl:64
}
2021-01-26 05:41:57 +00:00
//line templates/readers.qtpl:64
2020-08-31 17:52:26 +00:00
qw422016.N().S(`
2021-01-26 05:41:57 +00:00
</main>
`)
//line templates/readers.qtpl:66
streamrelativeHyphae(qw422016, relatives)
//line templates/readers.qtpl:66
qw422016.N().S(`
</div>
`)
2021-01-26 05:41:57 +00:00
//line templates/readers.qtpl:68
2020-08-31 17:52:26 +00:00
}
2021-01-26 05:41:57 +00:00
//line templates/readers.qtpl:68
func WritePageHTML(qq422016 qtio422016.Writer, rq *http.Request, hyphaName, naviTitle, contents, relatives, prevHyphaName, nextHyphaName string, hasAmnt bool) {
2021-01-26 05:41:57 +00:00
//line templates/readers.qtpl:68
2020-08-31 17:52:26 +00:00
qw422016 := qt422016.AcquireWriter(qq422016)
2021-01-26 05:41:57 +00:00
//line templates/readers.qtpl:68
StreamPageHTML(qw422016, rq, hyphaName, naviTitle, contents, relatives, prevHyphaName, nextHyphaName, hasAmnt)
2021-01-26 05:41:57 +00:00
//line templates/readers.qtpl:68
2020-08-31 17:52:26 +00:00
qt422016.ReleaseWriter(qw422016)
2021-01-26 05:41:57 +00:00
//line templates/readers.qtpl:68
2020-08-31 17:52:26 +00:00
}
2021-01-26 05:41:57 +00:00
//line templates/readers.qtpl:68
func PageHTML(rq *http.Request, hyphaName, naviTitle, contents, relatives, prevHyphaName, nextHyphaName string, hasAmnt bool) string {
2021-01-26 05:41:57 +00:00
//line templates/readers.qtpl:68
2020-08-31 17:52:26 +00:00
qb422016 := qt422016.AcquireByteBuffer()
2021-01-26 05:41:57 +00:00
//line templates/readers.qtpl:68
WritePageHTML(qb422016, rq, hyphaName, naviTitle, contents, relatives, prevHyphaName, nextHyphaName, hasAmnt)
2021-01-26 05:41:57 +00:00
//line templates/readers.qtpl:68
2020-08-31 17:52:26 +00:00
qs422016 := string(qb422016.B)
2021-01-26 05:41:57 +00:00
//line templates/readers.qtpl:68
2020-08-31 17:52:26 +00:00
qt422016.ReleaseByteBuffer(qb422016)
2021-01-26 05:41:57 +00:00
//line templates/readers.qtpl:68
2020-08-31 17:52:26 +00:00
return qs422016
2021-01-26 05:41:57 +00:00
//line templates/readers.qtpl:68
2020-08-31 17:52:26 +00:00
}