mirror of
https://github.com/osmarks/mycorrhiza.git
synced 2024-10-30 11:46:16 +00:00
339 lines
8.7 KiB
Go
339 lines
8.7 KiB
Go
// Code generated by qtc from "readers.qtpl". DO NOT EDIT.
|
|
// See https://github.com/valyala/quicktemplate for details.
|
|
|
|
//line views/readers.qtpl:1
|
|
package views
|
|
|
|
//line views/readers.qtpl:1
|
|
import "net/http"
|
|
|
|
//line views/readers.qtpl:2
|
|
import "path"
|
|
|
|
//line views/readers.qtpl:4
|
|
import "github.com/bouncepaw/mycorrhiza/hyphae"
|
|
|
|
//line views/readers.qtpl:5
|
|
import "github.com/bouncepaw/mycorrhiza/user"
|
|
|
|
//line views/readers.qtpl:6
|
|
import "github.com/bouncepaw/mycorrhiza/util"
|
|
|
|
//line views/readers.qtpl:7
|
|
import "github.com/bouncepaw/mycorrhiza/tree"
|
|
|
|
// If `contents` == "", a helpful message is shown instead.
|
|
|
|
//line views/readers.qtpl:10
|
|
import (
|
|
qtio422016 "io"
|
|
|
|
qt422016 "github.com/valyala/quicktemplate"
|
|
)
|
|
|
|
//line views/readers.qtpl:10
|
|
var (
|
|
_ = qtio422016.Copy
|
|
_ = qt422016.AcquireByteBuffer
|
|
)
|
|
|
|
//line views/readers.qtpl:10
|
|
func StreamHyphaHTML(qw422016 *qt422016.Writer, rq *http.Request, h *hyphae.Hypha, contents string) {
|
|
//line views/readers.qtpl:10
|
|
qw422016.N().S(`
|
|
`)
|
|
//line views/readers.qtpl:12
|
|
relatives, subhyphae, prevHyphaName, nextHyphaName := tree.Tree(h.Name)
|
|
|
|
//line views/readers.qtpl:13
|
|
qw422016.N().S(`
|
|
`)
|
|
//line views/readers.qtpl:14
|
|
StreamNavHTML(qw422016, rq, h.Name, "page")
|
|
//line views/readers.qtpl:14
|
|
qw422016.N().S(`
|
|
<div class="layout">
|
|
<main class="main-width">
|
|
<article>
|
|
`)
|
|
//line views/readers.qtpl:18
|
|
qw422016.N().S(NaviTitleHTML(h))
|
|
//line views/readers.qtpl:18
|
|
qw422016.N().S(`
|
|
`)
|
|
//line views/readers.qtpl:19
|
|
if contents == "" {
|
|
//line views/readers.qtpl:19
|
|
qw422016.N().S(`
|
|
<p>This hypha has no text. Why not <a href="/edit/`)
|
|
//line views/readers.qtpl:20
|
|
qw422016.E().S(h.Name)
|
|
//line views/readers.qtpl:20
|
|
qw422016.N().S(`">create it</a>?</p>
|
|
`)
|
|
//line views/readers.qtpl:21
|
|
} else {
|
|
//line views/readers.qtpl:21
|
|
qw422016.N().S(`
|
|
`)
|
|
//line views/readers.qtpl:22
|
|
qw422016.N().S(contents)
|
|
//line views/readers.qtpl:22
|
|
qw422016.N().S(`
|
|
`)
|
|
//line views/readers.qtpl:23
|
|
}
|
|
//line views/readers.qtpl:23
|
|
qw422016.N().S(`
|
|
</article>
|
|
<section class="prevnext">
|
|
`)
|
|
//line views/readers.qtpl:26
|
|
if prevHyphaName != "" {
|
|
//line views/readers.qtpl:26
|
|
qw422016.N().S(`
|
|
<a class="prevnext__el prevnext__prev" href="/hypha/`)
|
|
//line views/readers.qtpl:27
|
|
qw422016.E().S(prevHyphaName)
|
|
//line views/readers.qtpl:27
|
|
qw422016.N().S(`" rel="prev">← `)
|
|
//line views/readers.qtpl:27
|
|
qw422016.E().S(util.BeautifulName(path.Base(prevHyphaName)))
|
|
//line views/readers.qtpl:27
|
|
qw422016.N().S(`</a>
|
|
`)
|
|
//line views/readers.qtpl:28
|
|
}
|
|
//line views/readers.qtpl:28
|
|
qw422016.N().S(`
|
|
`)
|
|
//line views/readers.qtpl:29
|
|
if nextHyphaName != "" {
|
|
//line views/readers.qtpl:29
|
|
qw422016.N().S(`
|
|
<a class="prevnext__el prevnext__next" href="/hypha/`)
|
|
//line views/readers.qtpl:30
|
|
qw422016.E().S(nextHyphaName)
|
|
//line views/readers.qtpl:30
|
|
qw422016.N().S(`" rel="next">`)
|
|
//line views/readers.qtpl:30
|
|
qw422016.E().S(util.BeautifulName(path.Base(nextHyphaName)))
|
|
//line views/readers.qtpl:30
|
|
qw422016.N().S(` →</a>
|
|
`)
|
|
//line views/readers.qtpl:31
|
|
}
|
|
//line views/readers.qtpl:31
|
|
qw422016.N().S(`
|
|
</section>
|
|
`)
|
|
//line views/readers.qtpl:33
|
|
if u := user.FromRequest(rq); !user.AuthUsed || u.Group != "anon" {
|
|
//line views/readers.qtpl:33
|
|
qw422016.N().S(`
|
|
<form action="/upload-binary/`)
|
|
//line views/readers.qtpl:34
|
|
qw422016.E().S(h.Name)
|
|
//line views/readers.qtpl:34
|
|
qw422016.N().S(`"
|
|
method="post" enctype="multipart/form-data"
|
|
class="upload-amnt">
|
|
`)
|
|
//line views/readers.qtpl:37
|
|
if h.Exists && h.BinaryPath != "" {
|
|
//line views/readers.qtpl:37
|
|
qw422016.N().S(`
|
|
<a class="upload-amnt__unattach" href="/unattach-ask/`)
|
|
//line views/readers.qtpl:38
|
|
qw422016.E().S(h.Name)
|
|
//line views/readers.qtpl:38
|
|
qw422016.N().S(`">Unattach current attachment?</a>
|
|
`)
|
|
//line views/readers.qtpl:39
|
|
}
|
|
//line views/readers.qtpl:39
|
|
qw422016.N().S(`
|
|
<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 views/readers.qtpl:45
|
|
}
|
|
//line views/readers.qtpl:45
|
|
qw422016.N().S(`
|
|
`)
|
|
//line views/readers.qtpl:46
|
|
StreamSubhyphaeHTML(qw422016, subhyphae)
|
|
//line views/readers.qtpl:46
|
|
qw422016.N().S(`
|
|
</main>
|
|
`)
|
|
//line views/readers.qtpl:48
|
|
StreamRelativeHyphaeHTML(qw422016, relatives)
|
|
//line views/readers.qtpl:48
|
|
qw422016.N().S(`
|
|
`)
|
|
//line views/readers.qtpl:49
|
|
StreamBackLinksHTML(qw422016, h)
|
|
//line views/readers.qtpl:49
|
|
qw422016.N().S(`
|
|
</div>
|
|
`)
|
|
//line views/readers.qtpl:51
|
|
}
|
|
|
|
//line views/readers.qtpl:51
|
|
func WriteHyphaHTML(qq422016 qtio422016.Writer, rq *http.Request, h *hyphae.Hypha, contents string) {
|
|
//line views/readers.qtpl:51
|
|
qw422016 := qt422016.AcquireWriter(qq422016)
|
|
//line views/readers.qtpl:51
|
|
StreamHyphaHTML(qw422016, rq, h, contents)
|
|
//line views/readers.qtpl:51
|
|
qt422016.ReleaseWriter(qw422016)
|
|
//line views/readers.qtpl:51
|
|
}
|
|
|
|
//line views/readers.qtpl:51
|
|
func HyphaHTML(rq *http.Request, h *hyphae.Hypha, contents string) string {
|
|
//line views/readers.qtpl:51
|
|
qb422016 := qt422016.AcquireByteBuffer()
|
|
//line views/readers.qtpl:51
|
|
WriteHyphaHTML(qb422016, rq, h, contents)
|
|
//line views/readers.qtpl:51
|
|
qs422016 := string(qb422016.B)
|
|
//line views/readers.qtpl:51
|
|
qt422016.ReleaseByteBuffer(qb422016)
|
|
//line views/readers.qtpl:51
|
|
return qs422016
|
|
//line views/readers.qtpl:51
|
|
}
|
|
|
|
//line views/readers.qtpl:53
|
|
func StreamRevisionHTML(qw422016 *qt422016.Writer, rq *http.Request, h *hyphae.Hypha, contents, revHash string) {
|
|
//line views/readers.qtpl:53
|
|
qw422016.N().S(`
|
|
`)
|
|
//line views/readers.qtpl:55
|
|
relatives, subhyphae, _, _ := tree.Tree(h.Name)
|
|
|
|
//line views/readers.qtpl:56
|
|
qw422016.N().S(`
|
|
`)
|
|
//line views/readers.qtpl:57
|
|
StreamNavHTML(qw422016, rq, h.Name, "revision", revHash)
|
|
//line views/readers.qtpl:57
|
|
qw422016.N().S(`
|
|
<div class="layout">
|
|
<main class="main-width">
|
|
<article>
|
|
<p>Please note that viewing binary parts of hyphae is not supported in history for now.</p>
|
|
`)
|
|
//line views/readers.qtpl:62
|
|
qw422016.N().S(NaviTitleHTML(h))
|
|
//line views/readers.qtpl:62
|
|
qw422016.N().S(`
|
|
`)
|
|
//line views/readers.qtpl:63
|
|
qw422016.N().S(contents)
|
|
//line views/readers.qtpl:63
|
|
qw422016.N().S(`
|
|
</article>
|
|
`)
|
|
//line views/readers.qtpl:65
|
|
StreamSubhyphaeHTML(qw422016, subhyphae)
|
|
//line views/readers.qtpl:65
|
|
qw422016.N().S(`
|
|
</main>
|
|
`)
|
|
//line views/readers.qtpl:67
|
|
StreamRelativeHyphaeHTML(qw422016, relatives)
|
|
//line views/readers.qtpl:67
|
|
qw422016.N().S(`
|
|
</div>
|
|
`)
|
|
//line views/readers.qtpl:69
|
|
}
|
|
|
|
//line views/readers.qtpl:69
|
|
func WriteRevisionHTML(qq422016 qtio422016.Writer, rq *http.Request, h *hyphae.Hypha, contents, revHash string) {
|
|
//line views/readers.qtpl:69
|
|
qw422016 := qt422016.AcquireWriter(qq422016)
|
|
//line views/readers.qtpl:69
|
|
StreamRevisionHTML(qw422016, rq, h, contents, revHash)
|
|
//line views/readers.qtpl:69
|
|
qt422016.ReleaseWriter(qw422016)
|
|
//line views/readers.qtpl:69
|
|
}
|
|
|
|
//line views/readers.qtpl:69
|
|
func RevisionHTML(rq *http.Request, h *hyphae.Hypha, contents, revHash string) string {
|
|
//line views/readers.qtpl:69
|
|
qb422016 := qt422016.AcquireByteBuffer()
|
|
//line views/readers.qtpl:69
|
|
WriteRevisionHTML(qb422016, rq, h, contents, revHash)
|
|
//line views/readers.qtpl:69
|
|
qs422016 := string(qb422016.B)
|
|
//line views/readers.qtpl:69
|
|
qt422016.ReleaseByteBuffer(qb422016)
|
|
//line views/readers.qtpl:69
|
|
return qs422016
|
|
//line views/readers.qtpl:69
|
|
}
|
|
|
|
//line views/readers.qtpl:71
|
|
func StreamHistoryHTML(qw422016 *qt422016.Writer, rq *http.Request, hyphaName, list string) {
|
|
//line views/readers.qtpl:71
|
|
qw422016.N().S(`
|
|
`)
|
|
//line views/readers.qtpl:72
|
|
StreamNavHTML(qw422016, rq, hyphaName, "history")
|
|
//line views/readers.qtpl:72
|
|
qw422016.N().S(`
|
|
<div class="layout">
|
|
<main class="main-width">
|
|
<article class="history">
|
|
<h1>History of `)
|
|
//line views/readers.qtpl:76
|
|
qw422016.E().S(hyphaName)
|
|
//line views/readers.qtpl:76
|
|
qw422016.N().S(`</h1>
|
|
`)
|
|
//line views/readers.qtpl:77
|
|
qw422016.N().S(list)
|
|
//line views/readers.qtpl:77
|
|
qw422016.N().S(`
|
|
</article>
|
|
</main>
|
|
</div>
|
|
`)
|
|
//line views/readers.qtpl:81
|
|
}
|
|
|
|
//line views/readers.qtpl:81
|
|
func WriteHistoryHTML(qq422016 qtio422016.Writer, rq *http.Request, hyphaName, list string) {
|
|
//line views/readers.qtpl:81
|
|
qw422016 := qt422016.AcquireWriter(qq422016)
|
|
//line views/readers.qtpl:81
|
|
StreamHistoryHTML(qw422016, rq, hyphaName, list)
|
|
//line views/readers.qtpl:81
|
|
qt422016.ReleaseWriter(qw422016)
|
|
//line views/readers.qtpl:81
|
|
}
|
|
|
|
//line views/readers.qtpl:81
|
|
func HistoryHTML(rq *http.Request, hyphaName, list string) string {
|
|
//line views/readers.qtpl:81
|
|
qb422016 := qt422016.AcquireByteBuffer()
|
|
//line views/readers.qtpl:81
|
|
WriteHistoryHTML(qb422016, rq, hyphaName, list)
|
|
//line views/readers.qtpl:81
|
|
qs422016 := string(qb422016.B)
|
|
//line views/readers.qtpl:81
|
|
qt422016.ReleaseByteBuffer(qb422016)
|
|
//line views/readers.qtpl:81
|
|
return qs422016
|
|
//line views/readers.qtpl:81
|
|
}
|