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

302 lines
8.9 KiB
Go
Raw Normal View History

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