mirror of
https://github.com/osmarks/mycorrhiza.git
synced 2024-12-12 05:20:26 +00:00
Move readers views to the views module
This commit is contained in:
parent
bcaa1de6b7
commit
1917e50367
@ -8,9 +8,9 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/bouncepaw/mycorrhiza/history"
|
"github.com/bouncepaw/mycorrhiza/history"
|
||||||
"github.com/bouncepaw/mycorrhiza/templates"
|
|
||||||
"github.com/bouncepaw/mycorrhiza/user"
|
"github.com/bouncepaw/mycorrhiza/user"
|
||||||
"github.com/bouncepaw/mycorrhiza/util"
|
"github.com/bouncepaw/mycorrhiza/util"
|
||||||
|
"github.com/bouncepaw/mycorrhiza/views"
|
||||||
)
|
)
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
@ -35,7 +35,7 @@ func handlerHistory(w http.ResponseWriter, rq *http.Request) {
|
|||||||
log.Println("Found", len(revs), "revisions for", hyphaName)
|
log.Println("Found", len(revs), "revisions for", hyphaName)
|
||||||
|
|
||||||
util.HTTP200Page(w,
|
util.HTTP200Page(w,
|
||||||
base(hyphaName, templates.HistoryHTML(rq, hyphaName, list), user.FromRequest(rq)))
|
base(hyphaName, views.HistoryHTML(rq, hyphaName, list), user.FromRequest(rq)))
|
||||||
}
|
}
|
||||||
|
|
||||||
// Recent changes
|
// Recent changes
|
||||||
|
@ -14,7 +14,6 @@ import (
|
|||||||
"github.com/bouncepaw/mycorrhiza/markup"
|
"github.com/bouncepaw/mycorrhiza/markup"
|
||||||
"github.com/bouncepaw/mycorrhiza/mimetype"
|
"github.com/bouncepaw/mycorrhiza/mimetype"
|
||||||
"github.com/bouncepaw/mycorrhiza/templates"
|
"github.com/bouncepaw/mycorrhiza/templates"
|
||||||
"github.com/bouncepaw/mycorrhiza/tree"
|
|
||||||
"github.com/bouncepaw/mycorrhiza/user"
|
"github.com/bouncepaw/mycorrhiza/user"
|
||||||
"github.com/bouncepaw/mycorrhiza/util"
|
"github.com/bouncepaw/mycorrhiza/util"
|
||||||
"github.com/bouncepaw/mycorrhiza/views"
|
"github.com/bouncepaw/mycorrhiza/views"
|
||||||
@ -44,13 +43,10 @@ func handlerRevision(w http.ResponseWriter, rq *http.Request) {
|
|||||||
if err == nil {
|
if err == nil {
|
||||||
contents = markup.Doc(hyphaName, textContents).AsHTML()
|
contents = markup.Doc(hyphaName, textContents).AsHTML()
|
||||||
}
|
}
|
||||||
treeHTML, subhyphae, _, _ := tree.Tree(hyphaName)
|
page := views.RevisionHTML(
|
||||||
page := templates.RevisionHTML(
|
|
||||||
rq,
|
rq,
|
||||||
h,
|
h,
|
||||||
contents,
|
contents,
|
||||||
treeHTML,
|
|
||||||
subhyphae,
|
|
||||||
revHash,
|
revHash,
|
||||||
)
|
)
|
||||||
w.Header().Set("Content-Type", "text/html;charset=utf-8")
|
w.Header().Set("Content-Type", "text/html;charset=utf-8")
|
||||||
@ -102,16 +98,10 @@ func handlerHypha(w http.ResponseWriter, rq *http.Request) {
|
|||||||
contents = views.AttachmentHTML(h) + contents
|
contents = views.AttachmentHTML(h) + contents
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
treeHTML, subhyphaeHTML, prevHypha, nextHypha := tree.Tree(hyphaName)
|
|
||||||
util.HTTP200Page(w,
|
util.HTTP200Page(w,
|
||||||
templates.BaseHTML(
|
templates.BaseHTML(
|
||||||
util.BeautifulName(hyphaName),
|
util.BeautifulName(hyphaName),
|
||||||
templates.PageHTML(rq, h,
|
views.HyphaHTML(rq, h, contents),
|
||||||
contents,
|
|
||||||
treeHTML,
|
|
||||||
subhyphaeHTML,
|
|
||||||
prevHypha, nextHypha,
|
|
||||||
),
|
|
||||||
u,
|
u,
|
||||||
openGraph))
|
openGraph))
|
||||||
}
|
}
|
||||||
|
@ -1,78 +1,19 @@
|
|||||||
{% import "net/http" %}
|
{% import "net/http" %}
|
||||||
{% import "strings" %}
|
|
||||||
{% import "github.com/bouncepaw/mycorrhiza/user" %}
|
{% import "github.com/bouncepaw/mycorrhiza/user" %}
|
||||||
{% import "github.com/bouncepaw/mycorrhiza/util" %}
|
{% import "github.com/bouncepaw/mycorrhiza/views" %}
|
||||||
|
|
||||||
This is the <nav> seen on top of many pages.
|
|
||||||
{% code
|
|
||||||
type navEntry struct {
|
|
||||||
path string
|
|
||||||
title string
|
|
||||||
}
|
|
||||||
var navEntries = []navEntry{
|
|
||||||
{"page", "Hypha"},
|
|
||||||
{"edit", "Edit"},
|
|
||||||
{"history", "History"},
|
|
||||||
{"revision", "NOT REACHED"},
|
|
||||||
{"rename-ask", "Rename"},
|
|
||||||
{"delete-ask", "Delete"},
|
|
||||||
{"text", "Raw text"},
|
|
||||||
}
|
|
||||||
%}
|
|
||||||
|
|
||||||
{% func navHTML(rq *http.Request, hyphaName, navType string, revisionHash ...string) %}
|
{% func navHTML(rq *http.Request, hyphaName, navType string, revisionHash ...string) %}
|
||||||
{% code
|
{%s= views.NavHTML(rq, hyphaName, navType, revisionHash...) %}
|
||||||
u := user.FromRequest(rq)
|
|
||||||
%}
|
|
||||||
<nav class="hypha-tabs main-width">
|
|
||||||
<ul class="hypha-tabs__flex">
|
|
||||||
{%- for _, entry := range navEntries -%}
|
|
||||||
{%- if navType == "revision" && entry.path == "revision" -%}
|
|
||||||
<li class="hypha-tabs__tab hypha-tabs__tab_active">
|
|
||||||
<span class="hypha-tabs__selection">{%s revisionHash[0] %}</span>
|
|
||||||
</li>
|
|
||||||
{%- elseif navType == entry.path -%}
|
|
||||||
<li class="hypha-tabs__tab hypha-tabs__tab_active">
|
|
||||||
<span class="hypha-tabs__selection">{%s entry.title %}</span>
|
|
||||||
</li>
|
|
||||||
{%- elseif entry.path != "revision" && u.CanProceed(entry.path) -%}
|
|
||||||
<li class="hypha-tabs__tab">
|
|
||||||
<a class="hypha-tabs__link" href="/{%s entry.path %}/{%s hyphaName %}">{%s entry.title %}</a>
|
|
||||||
</li>
|
|
||||||
{%- endif -%}
|
|
||||||
{%- endfor -%}
|
|
||||||
</ul>
|
|
||||||
</nav>
|
|
||||||
{% endfunc %}
|
{% endfunc %}
|
||||||
|
|
||||||
{% func userMenuHTML(u *user.User) %}
|
{% func userMenuHTML(u *user.User) %}
|
||||||
{% if user.AuthUsed %}
|
{%s= views.UserMenuHTML(u) %}
|
||||||
<li class="header-links__entry header-links__entry_user">
|
|
||||||
{% if u.Group == "anon" %}
|
|
||||||
<a href="/login" class="header-links__link">Login</a>
|
|
||||||
{% else %}
|
|
||||||
<a href="/page/{%s util.UserHypha %}/{%s u.Name %}" class="header-links__link">{%s u.Name %}</a>
|
|
||||||
{% endif %}
|
|
||||||
</li>
|
|
||||||
{% endif %}
|
|
||||||
{% endfunc %}
|
{% endfunc %}
|
||||||
|
|
||||||
{% func relativeHyphae(relatives string) %}
|
{% func relativeHyphae(relatives string) %}
|
||||||
<aside class="relative-hyphae layout-card">
|
{%s= views.RelativeHyphaeHTML(relatives) %}
|
||||||
<h2 class="relative-hyphae__title layout-card__title">Relative hyphae</h2>
|
|
||||||
{%s= relatives %}
|
|
||||||
</aside>
|
|
||||||
{% endfunc %}
|
{% endfunc %}
|
||||||
|
|
||||||
{% func subhyphaeMatrix(subhyphae string) %}
|
{% func subhyphaeMatrix(subhyphae string) %}
|
||||||
{% if strings.TrimSpace(subhyphae) != "" %}
|
{%s= views.SubhyphaeHTML(subhyphae) %}
|
||||||
<section class="subhyphae">
|
|
||||||
<h2 class="subhyphae__title">Subhyphae</h2>
|
|
||||||
<nav class="subhyphae__nav">
|
|
||||||
<ul class="subhyphae__list">
|
|
||||||
{%s= subhyphae %}
|
|
||||||
</ul>
|
|
||||||
</nav>
|
|
||||||
</section>
|
|
||||||
{% endif %}
|
|
||||||
{% endfunc %}
|
{% endfunc %}
|
||||||
|
@ -8,307 +8,176 @@ package templates
|
|||||||
import "net/http"
|
import "net/http"
|
||||||
|
|
||||||
//line templates/common.qtpl:2
|
//line templates/common.qtpl:2
|
||||||
import "strings"
|
|
||||||
|
|
||||||
//line templates/common.qtpl:3
|
|
||||||
import "github.com/bouncepaw/mycorrhiza/user"
|
import "github.com/bouncepaw/mycorrhiza/user"
|
||||||
|
|
||||||
//line templates/common.qtpl:4
|
//line templates/common.qtpl:3
|
||||||
import "github.com/bouncepaw/mycorrhiza/util"
|
import "github.com/bouncepaw/mycorrhiza/views"
|
||||||
|
|
||||||
// This is the <nav> seen on top of many pages.
|
//line templates/common.qtpl:5
|
||||||
|
|
||||||
//line templates/common.qtpl:7
|
|
||||||
import (
|
import (
|
||||||
qtio422016 "io"
|
qtio422016 "io"
|
||||||
|
|
||||||
qt422016 "github.com/valyala/quicktemplate"
|
qt422016 "github.com/valyala/quicktemplate"
|
||||||
)
|
)
|
||||||
|
|
||||||
//line templates/common.qtpl:7
|
//line templates/common.qtpl:5
|
||||||
var (
|
var (
|
||||||
_ = qtio422016.Copy
|
_ = qtio422016.Copy
|
||||||
_ = qt422016.AcquireByteBuffer
|
_ = qt422016.AcquireByteBuffer
|
||||||
)
|
)
|
||||||
|
|
||||||
//line templates/common.qtpl:8
|
//line templates/common.qtpl:5
|
||||||
type navEntry struct {
|
|
||||||
path string
|
|
||||||
title string
|
|
||||||
}
|
|
||||||
|
|
||||||
var navEntries = []navEntry{
|
|
||||||
{"page", "Hypha"},
|
|
||||||
{"edit", "Edit"},
|
|
||||||
{"history", "History"},
|
|
||||||
{"revision", "NOT REACHED"},
|
|
||||||
{"rename-ask", "Rename"},
|
|
||||||
{"delete-ask", "Delete"},
|
|
||||||
{"text", "Raw text"},
|
|
||||||
}
|
|
||||||
|
|
||||||
//line templates/common.qtpl:23
|
|
||||||
func streamnavHTML(qw422016 *qt422016.Writer, rq *http.Request, hyphaName, navType string, revisionHash ...string) {
|
func streamnavHTML(qw422016 *qt422016.Writer, rq *http.Request, hyphaName, navType string, revisionHash ...string) {
|
||||||
//line templates/common.qtpl:23
|
//line templates/common.qtpl:5
|
||||||
qw422016.N().S(`
|
qw422016.N().S(`
|
||||||
`)
|
`)
|
||||||
//line templates/common.qtpl:25
|
//line templates/common.qtpl:6
|
||||||
u := user.FromRequest(rq)
|
qw422016.N().S(views.NavHTML(rq, hyphaName, navType, revisionHash...))
|
||||||
|
//line templates/common.qtpl:6
|
||||||
//line templates/common.qtpl:26
|
|
||||||
qw422016.N().S(`
|
qw422016.N().S(`
|
||||||
<nav class="hypha-tabs main-width">
|
|
||||||
<ul class="hypha-tabs__flex">
|
|
||||||
`)
|
`)
|
||||||
//line templates/common.qtpl:29
|
//line templates/common.qtpl:7
|
||||||
for _, entry := range navEntries {
|
|
||||||
//line templates/common.qtpl:30
|
|
||||||
if navType == "revision" && entry.path == "revision" {
|
|
||||||
//line templates/common.qtpl:30
|
|
||||||
qw422016.N().S(` <li class="hypha-tabs__tab hypha-tabs__tab_active">
|
|
||||||
<span class="hypha-tabs__selection">`)
|
|
||||||
//line templates/common.qtpl:32
|
|
||||||
qw422016.E().S(revisionHash[0])
|
|
||||||
//line templates/common.qtpl:32
|
|
||||||
qw422016.N().S(`</span>
|
|
||||||
</li>
|
|
||||||
`)
|
|
||||||
//line templates/common.qtpl:34
|
|
||||||
} else if navType == entry.path {
|
|
||||||
//line templates/common.qtpl:34
|
|
||||||
qw422016.N().S(` <li class="hypha-tabs__tab hypha-tabs__tab_active">
|
|
||||||
<span class="hypha-tabs__selection">`)
|
|
||||||
//line templates/common.qtpl:36
|
|
||||||
qw422016.E().S(entry.title)
|
|
||||||
//line templates/common.qtpl:36
|
|
||||||
qw422016.N().S(`</span>
|
|
||||||
</li>
|
|
||||||
`)
|
|
||||||
//line templates/common.qtpl:38
|
|
||||||
} else if entry.path != "revision" && u.CanProceed(entry.path) {
|
|
||||||
//line templates/common.qtpl:38
|
|
||||||
qw422016.N().S(` <li class="hypha-tabs__tab">
|
|
||||||
<a class="hypha-tabs__link" href="/`)
|
|
||||||
//line templates/common.qtpl:40
|
|
||||||
qw422016.E().S(entry.path)
|
|
||||||
//line templates/common.qtpl:40
|
|
||||||
qw422016.N().S(`/`)
|
|
||||||
//line templates/common.qtpl:40
|
|
||||||
qw422016.E().S(hyphaName)
|
|
||||||
//line templates/common.qtpl:40
|
|
||||||
qw422016.N().S(`">`)
|
|
||||||
//line templates/common.qtpl:40
|
|
||||||
qw422016.E().S(entry.title)
|
|
||||||
//line templates/common.qtpl:40
|
|
||||||
qw422016.N().S(`</a>
|
|
||||||
</li>
|
|
||||||
`)
|
|
||||||
//line templates/common.qtpl:42
|
|
||||||
}
|
|
||||||
//line templates/common.qtpl:43
|
|
||||||
}
|
|
||||||
//line templates/common.qtpl:43
|
|
||||||
qw422016.N().S(` </ul>
|
|
||||||
</nav>
|
|
||||||
`)
|
|
||||||
//line templates/common.qtpl:46
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//line templates/common.qtpl:46
|
//line templates/common.qtpl:7
|
||||||
func writenavHTML(qq422016 qtio422016.Writer, rq *http.Request, hyphaName, navType string, revisionHash ...string) {
|
func writenavHTML(qq422016 qtio422016.Writer, rq *http.Request, hyphaName, navType string, revisionHash ...string) {
|
||||||
//line templates/common.qtpl:46
|
//line templates/common.qtpl:7
|
||||||
qw422016 := qt422016.AcquireWriter(qq422016)
|
qw422016 := qt422016.AcquireWriter(qq422016)
|
||||||
//line templates/common.qtpl:46
|
//line templates/common.qtpl:7
|
||||||
streamnavHTML(qw422016, rq, hyphaName, navType, revisionHash...)
|
streamnavHTML(qw422016, rq, hyphaName, navType, revisionHash...)
|
||||||
//line templates/common.qtpl:46
|
//line templates/common.qtpl:7
|
||||||
qt422016.ReleaseWriter(qw422016)
|
qt422016.ReleaseWriter(qw422016)
|
||||||
//line templates/common.qtpl:46
|
//line templates/common.qtpl:7
|
||||||
}
|
}
|
||||||
|
|
||||||
//line templates/common.qtpl:46
|
//line templates/common.qtpl:7
|
||||||
func navHTML(rq *http.Request, hyphaName, navType string, revisionHash ...string) string {
|
func navHTML(rq *http.Request, hyphaName, navType string, revisionHash ...string) string {
|
||||||
//line templates/common.qtpl:46
|
//line templates/common.qtpl:7
|
||||||
qb422016 := qt422016.AcquireByteBuffer()
|
qb422016 := qt422016.AcquireByteBuffer()
|
||||||
//line templates/common.qtpl:46
|
//line templates/common.qtpl:7
|
||||||
writenavHTML(qb422016, rq, hyphaName, navType, revisionHash...)
|
writenavHTML(qb422016, rq, hyphaName, navType, revisionHash...)
|
||||||
//line templates/common.qtpl:46
|
//line templates/common.qtpl:7
|
||||||
qs422016 := string(qb422016.B)
|
qs422016 := string(qb422016.B)
|
||||||
//line templates/common.qtpl:46
|
//line templates/common.qtpl:7
|
||||||
qt422016.ReleaseByteBuffer(qb422016)
|
qt422016.ReleaseByteBuffer(qb422016)
|
||||||
//line templates/common.qtpl:46
|
//line templates/common.qtpl:7
|
||||||
return qs422016
|
return qs422016
|
||||||
//line templates/common.qtpl:46
|
//line templates/common.qtpl:7
|
||||||
}
|
}
|
||||||
|
|
||||||
//line templates/common.qtpl:48
|
//line templates/common.qtpl:9
|
||||||
func streamuserMenuHTML(qw422016 *qt422016.Writer, u *user.User) {
|
func streamuserMenuHTML(qw422016 *qt422016.Writer, u *user.User) {
|
||||||
//line templates/common.qtpl:48
|
//line templates/common.qtpl:9
|
||||||
qw422016.N().S(`
|
qw422016.N().S(`
|
||||||
`)
|
`)
|
||||||
//line templates/common.qtpl:49
|
//line templates/common.qtpl:10
|
||||||
if user.AuthUsed {
|
qw422016.N().S(views.UserMenuHTML(u))
|
||||||
//line templates/common.qtpl:49
|
//line templates/common.qtpl:10
|
||||||
qw422016.N().S(`
|
|
||||||
<li class="header-links__entry header-links__entry_user">
|
|
||||||
`)
|
|
||||||
//line templates/common.qtpl:51
|
|
||||||
if u.Group == "anon" {
|
|
||||||
//line templates/common.qtpl:51
|
|
||||||
qw422016.N().S(`
|
|
||||||
<a href="/login" class="header-links__link">Login</a>
|
|
||||||
`)
|
|
||||||
//line templates/common.qtpl:53
|
|
||||||
} else {
|
|
||||||
//line templates/common.qtpl:53
|
|
||||||
qw422016.N().S(`
|
|
||||||
<a href="/page/`)
|
|
||||||
//line templates/common.qtpl:54
|
|
||||||
qw422016.E().S(util.UserHypha)
|
|
||||||
//line templates/common.qtpl:54
|
|
||||||
qw422016.N().S(`/`)
|
|
||||||
//line templates/common.qtpl:54
|
|
||||||
qw422016.E().S(u.Name)
|
|
||||||
//line templates/common.qtpl:54
|
|
||||||
qw422016.N().S(`" class="header-links__link">`)
|
|
||||||
//line templates/common.qtpl:54
|
|
||||||
qw422016.E().S(u.Name)
|
|
||||||
//line templates/common.qtpl:54
|
|
||||||
qw422016.N().S(`</a>
|
|
||||||
`)
|
|
||||||
//line templates/common.qtpl:55
|
|
||||||
}
|
|
||||||
//line templates/common.qtpl:55
|
|
||||||
qw422016.N().S(`
|
|
||||||
</li>
|
|
||||||
`)
|
|
||||||
//line templates/common.qtpl:57
|
|
||||||
}
|
|
||||||
//line templates/common.qtpl:57
|
|
||||||
qw422016.N().S(`
|
qw422016.N().S(`
|
||||||
`)
|
`)
|
||||||
//line templates/common.qtpl:58
|
//line templates/common.qtpl:11
|
||||||
}
|
}
|
||||||
|
|
||||||
//line templates/common.qtpl:58
|
//line templates/common.qtpl:11
|
||||||
func writeuserMenuHTML(qq422016 qtio422016.Writer, u *user.User) {
|
func writeuserMenuHTML(qq422016 qtio422016.Writer, u *user.User) {
|
||||||
//line templates/common.qtpl:58
|
//line templates/common.qtpl:11
|
||||||
qw422016 := qt422016.AcquireWriter(qq422016)
|
qw422016 := qt422016.AcquireWriter(qq422016)
|
||||||
//line templates/common.qtpl:58
|
//line templates/common.qtpl:11
|
||||||
streamuserMenuHTML(qw422016, u)
|
streamuserMenuHTML(qw422016, u)
|
||||||
//line templates/common.qtpl:58
|
//line templates/common.qtpl:11
|
||||||
qt422016.ReleaseWriter(qw422016)
|
qt422016.ReleaseWriter(qw422016)
|
||||||
//line templates/common.qtpl:58
|
//line templates/common.qtpl:11
|
||||||
}
|
}
|
||||||
|
|
||||||
//line templates/common.qtpl:58
|
//line templates/common.qtpl:11
|
||||||
func userMenuHTML(u *user.User) string {
|
func userMenuHTML(u *user.User) string {
|
||||||
//line templates/common.qtpl:58
|
//line templates/common.qtpl:11
|
||||||
qb422016 := qt422016.AcquireByteBuffer()
|
qb422016 := qt422016.AcquireByteBuffer()
|
||||||
//line templates/common.qtpl:58
|
//line templates/common.qtpl:11
|
||||||
writeuserMenuHTML(qb422016, u)
|
writeuserMenuHTML(qb422016, u)
|
||||||
//line templates/common.qtpl:58
|
//line templates/common.qtpl:11
|
||||||
qs422016 := string(qb422016.B)
|
qs422016 := string(qb422016.B)
|
||||||
//line templates/common.qtpl:58
|
//line templates/common.qtpl:11
|
||||||
qt422016.ReleaseByteBuffer(qb422016)
|
qt422016.ReleaseByteBuffer(qb422016)
|
||||||
//line templates/common.qtpl:58
|
//line templates/common.qtpl:11
|
||||||
return qs422016
|
return qs422016
|
||||||
//line templates/common.qtpl:58
|
//line templates/common.qtpl:11
|
||||||
}
|
}
|
||||||
|
|
||||||
//line templates/common.qtpl:60
|
//line templates/common.qtpl:13
|
||||||
func streamrelativeHyphae(qw422016 *qt422016.Writer, relatives string) {
|
func streamrelativeHyphae(qw422016 *qt422016.Writer, relatives string) {
|
||||||
//line templates/common.qtpl:60
|
//line templates/common.qtpl:13
|
||||||
qw422016.N().S(`
|
qw422016.N().S(`
|
||||||
<aside class="relative-hyphae layout-card">
|
|
||||||
<h2 class="relative-hyphae__title layout-card__title">Relative hyphae</h2>
|
|
||||||
`)
|
|
||||||
//line templates/common.qtpl:63
|
|
||||||
qw422016.N().S(relatives)
|
|
||||||
//line templates/common.qtpl:63
|
|
||||||
qw422016.N().S(`
|
|
||||||
</aside>
|
|
||||||
`)
|
`)
|
||||||
//line templates/common.qtpl:65
|
//line templates/common.qtpl:14
|
||||||
|
qw422016.N().S(views.RelativeHyphaeHTML(relatives))
|
||||||
|
//line templates/common.qtpl:14
|
||||||
|
qw422016.N().S(`
|
||||||
|
`)
|
||||||
|
//line templates/common.qtpl:15
|
||||||
}
|
}
|
||||||
|
|
||||||
//line templates/common.qtpl:65
|
//line templates/common.qtpl:15
|
||||||
func writerelativeHyphae(qq422016 qtio422016.Writer, relatives string) {
|
func writerelativeHyphae(qq422016 qtio422016.Writer, relatives string) {
|
||||||
//line templates/common.qtpl:65
|
//line templates/common.qtpl:15
|
||||||
qw422016 := qt422016.AcquireWriter(qq422016)
|
qw422016 := qt422016.AcquireWriter(qq422016)
|
||||||
//line templates/common.qtpl:65
|
//line templates/common.qtpl:15
|
||||||
streamrelativeHyphae(qw422016, relatives)
|
streamrelativeHyphae(qw422016, relatives)
|
||||||
//line templates/common.qtpl:65
|
//line templates/common.qtpl:15
|
||||||
qt422016.ReleaseWriter(qw422016)
|
qt422016.ReleaseWriter(qw422016)
|
||||||
//line templates/common.qtpl:65
|
//line templates/common.qtpl:15
|
||||||
}
|
}
|
||||||
|
|
||||||
//line templates/common.qtpl:65
|
//line templates/common.qtpl:15
|
||||||
func relativeHyphae(relatives string) string {
|
func relativeHyphae(relatives string) string {
|
||||||
//line templates/common.qtpl:65
|
//line templates/common.qtpl:15
|
||||||
qb422016 := qt422016.AcquireByteBuffer()
|
qb422016 := qt422016.AcquireByteBuffer()
|
||||||
//line templates/common.qtpl:65
|
//line templates/common.qtpl:15
|
||||||
writerelativeHyphae(qb422016, relatives)
|
writerelativeHyphae(qb422016, relatives)
|
||||||
//line templates/common.qtpl:65
|
//line templates/common.qtpl:15
|
||||||
qs422016 := string(qb422016.B)
|
qs422016 := string(qb422016.B)
|
||||||
//line templates/common.qtpl:65
|
//line templates/common.qtpl:15
|
||||||
qt422016.ReleaseByteBuffer(qb422016)
|
qt422016.ReleaseByteBuffer(qb422016)
|
||||||
//line templates/common.qtpl:65
|
//line templates/common.qtpl:15
|
||||||
return qs422016
|
return qs422016
|
||||||
//line templates/common.qtpl:65
|
//line templates/common.qtpl:15
|
||||||
}
|
}
|
||||||
|
|
||||||
//line templates/common.qtpl:67
|
//line templates/common.qtpl:17
|
||||||
func streamsubhyphaeMatrix(qw422016 *qt422016.Writer, subhyphae string) {
|
func streamsubhyphaeMatrix(qw422016 *qt422016.Writer, subhyphae string) {
|
||||||
//line templates/common.qtpl:67
|
//line templates/common.qtpl:17
|
||||||
qw422016.N().S(`
|
qw422016.N().S(`
|
||||||
`)
|
`)
|
||||||
//line templates/common.qtpl:68
|
//line templates/common.qtpl:18
|
||||||
if strings.TrimSpace(subhyphae) != "" {
|
qw422016.N().S(views.SubhyphaeHTML(subhyphae))
|
||||||
//line templates/common.qtpl:68
|
//line templates/common.qtpl:18
|
||||||
qw422016.N().S(`
|
|
||||||
<section class="subhyphae">
|
|
||||||
<h2 class="subhyphae__title">Subhyphae</h2>
|
|
||||||
<nav class="subhyphae__nav">
|
|
||||||
<ul class="subhyphae__list">
|
|
||||||
`)
|
|
||||||
//line templates/common.qtpl:73
|
|
||||||
qw422016.N().S(subhyphae)
|
|
||||||
//line templates/common.qtpl:73
|
|
||||||
qw422016.N().S(`
|
|
||||||
</ul>
|
|
||||||
</nav>
|
|
||||||
</section>
|
|
||||||
`)
|
|
||||||
//line templates/common.qtpl:77
|
|
||||||
}
|
|
||||||
//line templates/common.qtpl:77
|
|
||||||
qw422016.N().S(`
|
qw422016.N().S(`
|
||||||
`)
|
`)
|
||||||
//line templates/common.qtpl:78
|
//line templates/common.qtpl:19
|
||||||
}
|
}
|
||||||
|
|
||||||
//line templates/common.qtpl:78
|
//line templates/common.qtpl:19
|
||||||
func writesubhyphaeMatrix(qq422016 qtio422016.Writer, subhyphae string) {
|
func writesubhyphaeMatrix(qq422016 qtio422016.Writer, subhyphae string) {
|
||||||
//line templates/common.qtpl:78
|
//line templates/common.qtpl:19
|
||||||
qw422016 := qt422016.AcquireWriter(qq422016)
|
qw422016 := qt422016.AcquireWriter(qq422016)
|
||||||
//line templates/common.qtpl:78
|
//line templates/common.qtpl:19
|
||||||
streamsubhyphaeMatrix(qw422016, subhyphae)
|
streamsubhyphaeMatrix(qw422016, subhyphae)
|
||||||
//line templates/common.qtpl:78
|
//line templates/common.qtpl:19
|
||||||
qt422016.ReleaseWriter(qw422016)
|
qt422016.ReleaseWriter(qw422016)
|
||||||
//line templates/common.qtpl:78
|
//line templates/common.qtpl:19
|
||||||
}
|
}
|
||||||
|
|
||||||
//line templates/common.qtpl:78
|
//line templates/common.qtpl:19
|
||||||
func subhyphaeMatrix(subhyphae string) string {
|
func subhyphaeMatrix(subhyphae string) string {
|
||||||
//line templates/common.qtpl:78
|
//line templates/common.qtpl:19
|
||||||
qb422016 := qt422016.AcquireByteBuffer()
|
qb422016 := qt422016.AcquireByteBuffer()
|
||||||
//line templates/common.qtpl:78
|
//line templates/common.qtpl:19
|
||||||
writesubhyphaeMatrix(qb422016, subhyphae)
|
writesubhyphaeMatrix(qb422016, subhyphae)
|
||||||
//line templates/common.qtpl:78
|
//line templates/common.qtpl:19
|
||||||
qs422016 := string(qb422016.B)
|
qs422016 := string(qb422016.B)
|
||||||
//line templates/common.qtpl:78
|
//line templates/common.qtpl:19
|
||||||
qt422016.ReleaseByteBuffer(qb422016)
|
qt422016.ReleaseByteBuffer(qb422016)
|
||||||
//line templates/common.qtpl:78
|
//line templates/common.qtpl:19
|
||||||
return qs422016
|
return qs422016
|
||||||
//line templates/common.qtpl:78
|
//line templates/common.qtpl:19
|
||||||
}
|
}
|
||||||
|
@ -1,326 +0,0 @@
|
|||||||
// Code generated by qtc from "readers.qtpl". DO NOT EDIT.
|
|
||||||
// See https://github.com/valyala/quicktemplate for details.
|
|
||||||
|
|
||||||
//line templates/readers.qtpl:1
|
|
||||||
package templates
|
|
||||||
|
|
||||||
//line templates/readers.qtpl:1
|
|
||||||
import "net/http"
|
|
||||||
|
|
||||||
//line templates/readers.qtpl:2
|
|
||||||
import "path"
|
|
||||||
|
|
||||||
//line templates/readers.qtpl:3
|
|
||||||
import "github.com/bouncepaw/mycorrhiza/hyphae"
|
|
||||||
|
|
||||||
//line templates/readers.qtpl:4
|
|
||||||
import "github.com/bouncepaw/mycorrhiza/user"
|
|
||||||
|
|
||||||
//line templates/readers.qtpl:5
|
|
||||||
import "github.com/bouncepaw/mycorrhiza/util"
|
|
||||||
|
|
||||||
//line templates/readers.qtpl:6
|
|
||||||
import "github.com/bouncepaw/mycorrhiza/views"
|
|
||||||
|
|
||||||
//line templates/readers.qtpl:8
|
|
||||||
import (
|
|
||||||
qtio422016 "io"
|
|
||||||
|
|
||||||
qt422016 "github.com/valyala/quicktemplate"
|
|
||||||
)
|
|
||||||
|
|
||||||
//line templates/readers.qtpl:8
|
|
||||||
var (
|
|
||||||
_ = qtio422016.Copy
|
|
||||||
_ = qt422016.AcquireByteBuffer
|
|
||||||
)
|
|
||||||
|
|
||||||
//line templates/readers.qtpl:8
|
|
||||||
func StreamHistoryHTML(qw422016 *qt422016.Writer, rq *http.Request, hyphaName, list string) {
|
|
||||||
//line templates/readers.qtpl:8
|
|
||||||
qw422016.N().S(`
|
|
||||||
`)
|
|
||||||
//line templates/readers.qtpl:9
|
|
||||||
streamnavHTML(qw422016, rq, hyphaName, "history")
|
|
||||||
//line templates/readers.qtpl:9
|
|
||||||
qw422016.N().S(`
|
|
||||||
<div class="layout">
|
|
||||||
<main class="main-width">
|
|
||||||
<article class="history">
|
|
||||||
<h1>History of `)
|
|
||||||
//line templates/readers.qtpl:13
|
|
||||||
qw422016.E().S(hyphaName)
|
|
||||||
//line templates/readers.qtpl:13
|
|
||||||
qw422016.N().S(`</h1>
|
|
||||||
`)
|
|
||||||
//line templates/readers.qtpl:14
|
|
||||||
qw422016.N().S(list)
|
|
||||||
//line templates/readers.qtpl:14
|
|
||||||
qw422016.N().S(`
|
|
||||||
</article>
|
|
||||||
</main>
|
|
||||||
</div>
|
|
||||||
`)
|
|
||||||
//line templates/readers.qtpl:18
|
|
||||||
}
|
|
||||||
|
|
||||||
//line templates/readers.qtpl:18
|
|
||||||
func WriteHistoryHTML(qq422016 qtio422016.Writer, rq *http.Request, hyphaName, list string) {
|
|
||||||
//line templates/readers.qtpl:18
|
|
||||||
qw422016 := qt422016.AcquireWriter(qq422016)
|
|
||||||
//line templates/readers.qtpl:18
|
|
||||||
StreamHistoryHTML(qw422016, rq, hyphaName, list)
|
|
||||||
//line templates/readers.qtpl:18
|
|
||||||
qt422016.ReleaseWriter(qw422016)
|
|
||||||
//line templates/readers.qtpl:18
|
|
||||||
}
|
|
||||||
|
|
||||||
//line templates/readers.qtpl:18
|
|
||||||
func HistoryHTML(rq *http.Request, hyphaName, list string) string {
|
|
||||||
//line templates/readers.qtpl:18
|
|
||||||
qb422016 := qt422016.AcquireByteBuffer()
|
|
||||||
//line templates/readers.qtpl:18
|
|
||||||
WriteHistoryHTML(qb422016, rq, hyphaName, list)
|
|
||||||
//line templates/readers.qtpl:18
|
|
||||||
qs422016 := string(qb422016.B)
|
|
||||||
//line templates/readers.qtpl:18
|
|
||||||
qt422016.ReleaseByteBuffer(qb422016)
|
|
||||||
//line templates/readers.qtpl:18
|
|
||||||
return qs422016
|
|
||||||
//line templates/readers.qtpl:18
|
|
||||||
}
|
|
||||||
|
|
||||||
//line templates/readers.qtpl:20
|
|
||||||
func StreamRevisionHTML(qw422016 *qt422016.Writer, rq *http.Request, h *hyphae.Hypha, contents, relatives, subhyphae, revHash string) {
|
|
||||||
//line templates/readers.qtpl:20
|
|
||||||
qw422016.N().S(`
|
|
||||||
`)
|
|
||||||
//line templates/readers.qtpl:21
|
|
||||||
streamnavHTML(qw422016, rq, h.Name, "revision", revHash)
|
|
||||||
//line templates/readers.qtpl:21
|
|
||||||
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 templates/readers.qtpl:26
|
|
||||||
qw422016.N().S(views.NaviTitleHTML(h))
|
|
||||||
//line templates/readers.qtpl:26
|
|
||||||
qw422016.N().S(`
|
|
||||||
`)
|
|
||||||
//line templates/readers.qtpl:27
|
|
||||||
qw422016.N().S(contents)
|
|
||||||
//line templates/readers.qtpl:27
|
|
||||||
qw422016.N().S(`
|
|
||||||
</article>
|
|
||||||
`)
|
|
||||||
//line templates/readers.qtpl:29
|
|
||||||
streamsubhyphaeMatrix(qw422016, subhyphae)
|
|
||||||
//line templates/readers.qtpl:29
|
|
||||||
qw422016.N().S(`
|
|
||||||
</main>
|
|
||||||
`)
|
|
||||||
//line templates/readers.qtpl:31
|
|
||||||
streamrelativeHyphae(qw422016, relatives)
|
|
||||||
//line templates/readers.qtpl:31
|
|
||||||
qw422016.N().S(`
|
|
||||||
</div>
|
|
||||||
`)
|
|
||||||
//line templates/readers.qtpl:33
|
|
||||||
}
|
|
||||||
|
|
||||||
//line templates/readers.qtpl:33
|
|
||||||
func WriteRevisionHTML(qq422016 qtio422016.Writer, rq *http.Request, h *hyphae.Hypha, contents, relatives, subhyphae, revHash string) {
|
|
||||||
//line templates/readers.qtpl:33
|
|
||||||
qw422016 := qt422016.AcquireWriter(qq422016)
|
|
||||||
//line templates/readers.qtpl:33
|
|
||||||
StreamRevisionHTML(qw422016, rq, h, contents, relatives, subhyphae, revHash)
|
|
||||||
//line templates/readers.qtpl:33
|
|
||||||
qt422016.ReleaseWriter(qw422016)
|
|
||||||
//line templates/readers.qtpl:33
|
|
||||||
}
|
|
||||||
|
|
||||||
//line templates/readers.qtpl:33
|
|
||||||
func RevisionHTML(rq *http.Request, h *hyphae.Hypha, contents, relatives, subhyphae, revHash string) string {
|
|
||||||
//line templates/readers.qtpl:33
|
|
||||||
qb422016 := qt422016.AcquireByteBuffer()
|
|
||||||
//line templates/readers.qtpl:33
|
|
||||||
WriteRevisionHTML(qb422016, rq, h, contents, relatives, subhyphae, revHash)
|
|
||||||
//line templates/readers.qtpl:33
|
|
||||||
qs422016 := string(qb422016.B)
|
|
||||||
//line templates/readers.qtpl:33
|
|
||||||
qt422016.ReleaseByteBuffer(qb422016)
|
|
||||||
//line templates/readers.qtpl:33
|
|
||||||
return qs422016
|
|
||||||
//line templates/readers.qtpl:33
|
|
||||||
}
|
|
||||||
|
|
||||||
// If `contents` == "", a helpful message is shown instead.
|
|
||||||
|
|
||||||
//line templates/readers.qtpl:36
|
|
||||||
func StreamPageHTML(qw422016 *qt422016.Writer, rq *http.Request, h *hyphae.Hypha, contents, relatives, subhyphae, prevHyphaName, nextHyphaName string) {
|
|
||||||
//line templates/readers.qtpl:36
|
|
||||||
qw422016.N().S(`
|
|
||||||
`)
|
|
||||||
//line templates/readers.qtpl:37
|
|
||||||
streamnavHTML(qw422016, rq, h.Name, "page")
|
|
||||||
//line templates/readers.qtpl:37
|
|
||||||
qw422016.N().S(`
|
|
||||||
<div class="layout">
|
|
||||||
<main class="main-width">
|
|
||||||
<article>
|
|
||||||
`)
|
|
||||||
//line templates/readers.qtpl:41
|
|
||||||
qw422016.N().S(views.NaviTitleHTML(h))
|
|
||||||
//line templates/readers.qtpl:41
|
|
||||||
qw422016.N().S(`
|
|
||||||
`)
|
|
||||||
//line templates/readers.qtpl:42
|
|
||||||
if contents == "" {
|
|
||||||
//line templates/readers.qtpl:42
|
|
||||||
qw422016.N().S(`
|
|
||||||
<p>This hypha has no text. Why not <a href="/edit/`)
|
|
||||||
//line templates/readers.qtpl:43
|
|
||||||
qw422016.E().S(h.Name)
|
|
||||||
//line templates/readers.qtpl:43
|
|
||||||
qw422016.N().S(`">create it</a>?</p>
|
|
||||||
`)
|
|
||||||
//line templates/readers.qtpl:44
|
|
||||||
} else {
|
|
||||||
//line templates/readers.qtpl:44
|
|
||||||
qw422016.N().S(`
|
|
||||||
`)
|
|
||||||
//line templates/readers.qtpl:45
|
|
||||||
qw422016.N().S(contents)
|
|
||||||
//line templates/readers.qtpl:45
|
|
||||||
qw422016.N().S(`
|
|
||||||
`)
|
|
||||||
//line templates/readers.qtpl:46
|
|
||||||
}
|
|
||||||
//line templates/readers.qtpl:46
|
|
||||||
qw422016.N().S(`
|
|
||||||
</article>
|
|
||||||
<section class="prevnext">
|
|
||||||
`)
|
|
||||||
//line templates/readers.qtpl:49
|
|
||||||
if prevHyphaName != "" {
|
|
||||||
//line templates/readers.qtpl:49
|
|
||||||
qw422016.N().S(`
|
|
||||||
<a class="prevnext__el prevnext__prev" href="/hypha/`)
|
|
||||||
//line templates/readers.qtpl:50
|
|
||||||
qw422016.E().S(prevHyphaName)
|
|
||||||
//line templates/readers.qtpl:50
|
|
||||||
qw422016.N().S(`" rel="prev">← `)
|
|
||||||
//line templates/readers.qtpl:50
|
|
||||||
qw422016.E().S(util.BeautifulName(path.Base(prevHyphaName)))
|
|
||||||
//line templates/readers.qtpl:50
|
|
||||||
qw422016.N().S(`</a>
|
|
||||||
`)
|
|
||||||
//line templates/readers.qtpl:51
|
|
||||||
}
|
|
||||||
//line templates/readers.qtpl:51
|
|
||||||
qw422016.N().S(`
|
|
||||||
`)
|
|
||||||
//line templates/readers.qtpl:52
|
|
||||||
if nextHyphaName != "" {
|
|
||||||
//line templates/readers.qtpl:52
|
|
||||||
qw422016.N().S(`
|
|
||||||
<a class="prevnext__el prevnext__next" href="/hypha/`)
|
|
||||||
//line templates/readers.qtpl:53
|
|
||||||
qw422016.E().S(nextHyphaName)
|
|
||||||
//line templates/readers.qtpl:53
|
|
||||||
qw422016.N().S(`" rel="next">`)
|
|
||||||
//line templates/readers.qtpl:53
|
|
||||||
qw422016.E().S(util.BeautifulName(path.Base(nextHyphaName)))
|
|
||||||
//line templates/readers.qtpl:53
|
|
||||||
qw422016.N().S(` →</a>
|
|
||||||
`)
|
|
||||||
//line templates/readers.qtpl:54
|
|
||||||
}
|
|
||||||
//line templates/readers.qtpl:54
|
|
||||||
qw422016.N().S(`
|
|
||||||
</section>
|
|
||||||
`)
|
|
||||||
//line templates/readers.qtpl:56
|
|
||||||
if u := user.FromRequest(rq); !user.AuthUsed || u.Group != "anon" {
|
|
||||||
//line templates/readers.qtpl:56
|
|
||||||
qw422016.N().S(`
|
|
||||||
<form action="/upload-binary/`)
|
|
||||||
//line templates/readers.qtpl:57
|
|
||||||
qw422016.E().S(h.Name)
|
|
||||||
//line templates/readers.qtpl:57
|
|
||||||
qw422016.N().S(`"
|
|
||||||
method="post" enctype="multipart/form-data"
|
|
||||||
class="upload-amnt">
|
|
||||||
`)
|
|
||||||
//line templates/readers.qtpl:60
|
|
||||||
if h.Exists && h.BinaryPath != "" {
|
|
||||||
//line templates/readers.qtpl:60
|
|
||||||
qw422016.N().S(`
|
|
||||||
<a class="upload-amnt__unattach" href="/unattach-ask/`)
|
|
||||||
//line templates/readers.qtpl:61
|
|
||||||
qw422016.E().S(h.Name)
|
|
||||||
//line templates/readers.qtpl:61
|
|
||||||
qw422016.N().S(`">Unattach current attachment?</a>
|
|
||||||
`)
|
|
||||||
//line templates/readers.qtpl:62
|
|
||||||
}
|
|
||||||
//line templates/readers.qtpl:62
|
|
||||||
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 templates/readers.qtpl:68
|
|
||||||
}
|
|
||||||
//line templates/readers.qtpl:68
|
|
||||||
qw422016.N().S(`
|
|
||||||
`)
|
|
||||||
//line templates/readers.qtpl:69
|
|
||||||
streamsubhyphaeMatrix(qw422016, subhyphae)
|
|
||||||
//line templates/readers.qtpl:69
|
|
||||||
qw422016.N().S(`
|
|
||||||
</main>
|
|
||||||
`)
|
|
||||||
//line templates/readers.qtpl:71
|
|
||||||
streamrelativeHyphae(qw422016, relatives)
|
|
||||||
//line templates/readers.qtpl:71
|
|
||||||
qw422016.N().S(`
|
|
||||||
`)
|
|
||||||
//line templates/readers.qtpl:72
|
|
||||||
views.StreamBackLinksHTML(qw422016, h)
|
|
||||||
//line templates/readers.qtpl:72
|
|
||||||
qw422016.N().S(`
|
|
||||||
</div>
|
|
||||||
`)
|
|
||||||
//line templates/readers.qtpl:74
|
|
||||||
}
|
|
||||||
|
|
||||||
//line templates/readers.qtpl:74
|
|
||||||
func WritePageHTML(qq422016 qtio422016.Writer, rq *http.Request, h *hyphae.Hypha, contents, relatives, subhyphae, prevHyphaName, nextHyphaName string) {
|
|
||||||
//line templates/readers.qtpl:74
|
|
||||||
qw422016 := qt422016.AcquireWriter(qq422016)
|
|
||||||
//line templates/readers.qtpl:74
|
|
||||||
StreamPageHTML(qw422016, rq, h, contents, relatives, subhyphae, prevHyphaName, nextHyphaName)
|
|
||||||
//line templates/readers.qtpl:74
|
|
||||||
qt422016.ReleaseWriter(qw422016)
|
|
||||||
//line templates/readers.qtpl:74
|
|
||||||
}
|
|
||||||
|
|
||||||
//line templates/readers.qtpl:74
|
|
||||||
func PageHTML(rq *http.Request, h *hyphae.Hypha, contents, relatives, subhyphae, prevHyphaName, nextHyphaName string) string {
|
|
||||||
//line templates/readers.qtpl:74
|
|
||||||
qb422016 := qt422016.AcquireByteBuffer()
|
|
||||||
//line templates/readers.qtpl:74
|
|
||||||
WritePageHTML(qb422016, rq, h, contents, relatives, subhyphae, prevHyphaName, nextHyphaName)
|
|
||||||
//line templates/readers.qtpl:74
|
|
||||||
qs422016 := string(qb422016.B)
|
|
||||||
//line templates/readers.qtpl:74
|
|
||||||
qt422016.ReleaseByteBuffer(qb422016)
|
|
||||||
//line templates/readers.qtpl:74
|
|
||||||
return qs422016
|
|
||||||
//line templates/readers.qtpl:74
|
|
||||||
}
|
|
78
views/nav.qtpl
Normal file
78
views/nav.qtpl
Normal file
@ -0,0 +1,78 @@
|
|||||||
|
{% import "net/http" %}
|
||||||
|
{% import "strings" %}
|
||||||
|
{% import "github.com/bouncepaw/mycorrhiza/user" %}
|
||||||
|
{% import "github.com/bouncepaw/mycorrhiza/util" %}
|
||||||
|
|
||||||
|
This is the <nav> seen on top of many pages.
|
||||||
|
{% code
|
||||||
|
type navEntry struct {
|
||||||
|
path string
|
||||||
|
title string
|
||||||
|
}
|
||||||
|
var navEntries = []navEntry{
|
||||||
|
{"page", "Hypha"},
|
||||||
|
{"edit", "Edit"},
|
||||||
|
{"history", "History"},
|
||||||
|
{"revision", "NOT REACHED"},
|
||||||
|
{"rename-ask", "Rename"},
|
||||||
|
{"delete-ask", "Delete"},
|
||||||
|
{"text", "Raw text"},
|
||||||
|
}
|
||||||
|
%}
|
||||||
|
|
||||||
|
{% func NavHTML(rq *http.Request, hyphaName, navType string, revisionHash ...string) %}
|
||||||
|
{% code
|
||||||
|
u := user.FromRequest(rq)
|
||||||
|
%}
|
||||||
|
<nav class="hypha-tabs main-width">
|
||||||
|
<ul class="hypha-tabs__flex">
|
||||||
|
{%- for _, entry := range navEntries -%}
|
||||||
|
{%- if navType == "revision" && entry.path == "revision" -%}
|
||||||
|
<li class="hypha-tabs__tab hypha-tabs__tab_active">
|
||||||
|
<span class="hypha-tabs__selection">{%s revisionHash[0] %}</span>
|
||||||
|
</li>
|
||||||
|
{%- elseif navType == entry.path -%}
|
||||||
|
<li class="hypha-tabs__tab hypha-tabs__tab_active">
|
||||||
|
<span class="hypha-tabs__selection">{%s entry.title %}</span>
|
||||||
|
</li>
|
||||||
|
{%- elseif entry.path != "revision" && u.CanProceed(entry.path) -%}
|
||||||
|
<li class="hypha-tabs__tab">
|
||||||
|
<a class="hypha-tabs__link" href="/{%s entry.path %}/{%s hyphaName %}">{%s entry.title %}</a>
|
||||||
|
</li>
|
||||||
|
{%- endif -%}
|
||||||
|
{%- endfor -%}
|
||||||
|
</ul>
|
||||||
|
</nav>
|
||||||
|
{% endfunc %}
|
||||||
|
|
||||||
|
{% func UserMenuHTML(u *user.User) %}
|
||||||
|
{% if user.AuthUsed %}
|
||||||
|
<li class="header-links__entry header-links__entry_user">
|
||||||
|
{% if u.Group == "anon" %}
|
||||||
|
<a href="/login" class="header-links__link">Login</a>
|
||||||
|
{% else %}
|
||||||
|
<a href="/page/{%s util.UserHypha %}/{%s u.Name %}" class="header-links__link">{%s u.Name %}</a>
|
||||||
|
{% endif %}
|
||||||
|
</li>
|
||||||
|
{% endif %}
|
||||||
|
{% endfunc %}
|
||||||
|
|
||||||
|
{% func RelativeHyphaeHTML(relatives string) %}
|
||||||
|
<aside class="relative-hyphae layout-card">
|
||||||
|
<h2 class="relative-hyphae__title layout-card__title">Relative hyphae</h2>
|
||||||
|
{%s= relatives %}
|
||||||
|
</aside>
|
||||||
|
{% endfunc %}
|
||||||
|
|
||||||
|
{% func SubhyphaeHTML(subhyphae string) %}
|
||||||
|
{% if strings.TrimSpace(subhyphae) != "" %}
|
||||||
|
<section class="subhyphae">
|
||||||
|
<h2 class="subhyphae__title">Subhyphae</h2>
|
||||||
|
<nav class="subhyphae__nav">
|
||||||
|
<ul class="subhyphae__list">
|
||||||
|
{%s= subhyphae %}
|
||||||
|
</ul>
|
||||||
|
</nav>
|
||||||
|
</section>
|
||||||
|
{% endif %}
|
||||||
|
{% endfunc %}
|
314
views/nav.qtpl.go
Normal file
314
views/nav.qtpl.go
Normal file
@ -0,0 +1,314 @@
|
|||||||
|
// Code generated by qtc from "nav.qtpl". DO NOT EDIT.
|
||||||
|
// See https://github.com/valyala/quicktemplate for details.
|
||||||
|
|
||||||
|
//line views/nav.qtpl:1
|
||||||
|
package views
|
||||||
|
|
||||||
|
//line views/nav.qtpl:1
|
||||||
|
import "net/http"
|
||||||
|
|
||||||
|
//line views/nav.qtpl:2
|
||||||
|
import "strings"
|
||||||
|
|
||||||
|
//line views/nav.qtpl:3
|
||||||
|
import "github.com/bouncepaw/mycorrhiza/user"
|
||||||
|
|
||||||
|
//line views/nav.qtpl:4
|
||||||
|
import "github.com/bouncepaw/mycorrhiza/util"
|
||||||
|
|
||||||
|
// This is the <nav> seen on top of many pages.
|
||||||
|
|
||||||
|
//line views/nav.qtpl:7
|
||||||
|
import (
|
||||||
|
qtio422016 "io"
|
||||||
|
|
||||||
|
qt422016 "github.com/valyala/quicktemplate"
|
||||||
|
)
|
||||||
|
|
||||||
|
//line views/nav.qtpl:7
|
||||||
|
var (
|
||||||
|
_ = qtio422016.Copy
|
||||||
|
_ = qt422016.AcquireByteBuffer
|
||||||
|
)
|
||||||
|
|
||||||
|
//line views/nav.qtpl:8
|
||||||
|
type navEntry struct {
|
||||||
|
path string
|
||||||
|
title string
|
||||||
|
}
|
||||||
|
|
||||||
|
var navEntries = []navEntry{
|
||||||
|
{"page", "Hypha"},
|
||||||
|
{"edit", "Edit"},
|
||||||
|
{"history", "History"},
|
||||||
|
{"revision", "NOT REACHED"},
|
||||||
|
{"rename-ask", "Rename"},
|
||||||
|
{"delete-ask", "Delete"},
|
||||||
|
{"text", "Raw text"},
|
||||||
|
}
|
||||||
|
|
||||||
|
//line views/nav.qtpl:23
|
||||||
|
func StreamNavHTML(qw422016 *qt422016.Writer, rq *http.Request, hyphaName, navType string, revisionHash ...string) {
|
||||||
|
//line views/nav.qtpl:23
|
||||||
|
qw422016.N().S(`
|
||||||
|
`)
|
||||||
|
//line views/nav.qtpl:25
|
||||||
|
u := user.FromRequest(rq)
|
||||||
|
|
||||||
|
//line views/nav.qtpl:26
|
||||||
|
qw422016.N().S(`
|
||||||
|
<nav class="hypha-tabs main-width">
|
||||||
|
<ul class="hypha-tabs__flex">
|
||||||
|
`)
|
||||||
|
//line views/nav.qtpl:29
|
||||||
|
for _, entry := range navEntries {
|
||||||
|
//line views/nav.qtpl:30
|
||||||
|
if navType == "revision" && entry.path == "revision" {
|
||||||
|
//line views/nav.qtpl:30
|
||||||
|
qw422016.N().S(` <li class="hypha-tabs__tab hypha-tabs__tab_active">
|
||||||
|
<span class="hypha-tabs__selection">`)
|
||||||
|
//line views/nav.qtpl:32
|
||||||
|
qw422016.E().S(revisionHash[0])
|
||||||
|
//line views/nav.qtpl:32
|
||||||
|
qw422016.N().S(`</span>
|
||||||
|
</li>
|
||||||
|
`)
|
||||||
|
//line views/nav.qtpl:34
|
||||||
|
} else if navType == entry.path {
|
||||||
|
//line views/nav.qtpl:34
|
||||||
|
qw422016.N().S(` <li class="hypha-tabs__tab hypha-tabs__tab_active">
|
||||||
|
<span class="hypha-tabs__selection">`)
|
||||||
|
//line views/nav.qtpl:36
|
||||||
|
qw422016.E().S(entry.title)
|
||||||
|
//line views/nav.qtpl:36
|
||||||
|
qw422016.N().S(`</span>
|
||||||
|
</li>
|
||||||
|
`)
|
||||||
|
//line views/nav.qtpl:38
|
||||||
|
} else if entry.path != "revision" && u.CanProceed(entry.path) {
|
||||||
|
//line views/nav.qtpl:38
|
||||||
|
qw422016.N().S(` <li class="hypha-tabs__tab">
|
||||||
|
<a class="hypha-tabs__link" href="/`)
|
||||||
|
//line views/nav.qtpl:40
|
||||||
|
qw422016.E().S(entry.path)
|
||||||
|
//line views/nav.qtpl:40
|
||||||
|
qw422016.N().S(`/`)
|
||||||
|
//line views/nav.qtpl:40
|
||||||
|
qw422016.E().S(hyphaName)
|
||||||
|
//line views/nav.qtpl:40
|
||||||
|
qw422016.N().S(`">`)
|
||||||
|
//line views/nav.qtpl:40
|
||||||
|
qw422016.E().S(entry.title)
|
||||||
|
//line views/nav.qtpl:40
|
||||||
|
qw422016.N().S(`</a>
|
||||||
|
</li>
|
||||||
|
`)
|
||||||
|
//line views/nav.qtpl:42
|
||||||
|
}
|
||||||
|
//line views/nav.qtpl:43
|
||||||
|
}
|
||||||
|
//line views/nav.qtpl:43
|
||||||
|
qw422016.N().S(` </ul>
|
||||||
|
</nav>
|
||||||
|
`)
|
||||||
|
//line views/nav.qtpl:46
|
||||||
|
}
|
||||||
|
|
||||||
|
//line views/nav.qtpl:46
|
||||||
|
func WriteNavHTML(qq422016 qtio422016.Writer, rq *http.Request, hyphaName, navType string, revisionHash ...string) {
|
||||||
|
//line views/nav.qtpl:46
|
||||||
|
qw422016 := qt422016.AcquireWriter(qq422016)
|
||||||
|
//line views/nav.qtpl:46
|
||||||
|
StreamNavHTML(qw422016, rq, hyphaName, navType, revisionHash...)
|
||||||
|
//line views/nav.qtpl:46
|
||||||
|
qt422016.ReleaseWriter(qw422016)
|
||||||
|
//line views/nav.qtpl:46
|
||||||
|
}
|
||||||
|
|
||||||
|
//line views/nav.qtpl:46
|
||||||
|
func NavHTML(rq *http.Request, hyphaName, navType string, revisionHash ...string) string {
|
||||||
|
//line views/nav.qtpl:46
|
||||||
|
qb422016 := qt422016.AcquireByteBuffer()
|
||||||
|
//line views/nav.qtpl:46
|
||||||
|
WriteNavHTML(qb422016, rq, hyphaName, navType, revisionHash...)
|
||||||
|
//line views/nav.qtpl:46
|
||||||
|
qs422016 := string(qb422016.B)
|
||||||
|
//line views/nav.qtpl:46
|
||||||
|
qt422016.ReleaseByteBuffer(qb422016)
|
||||||
|
//line views/nav.qtpl:46
|
||||||
|
return qs422016
|
||||||
|
//line views/nav.qtpl:46
|
||||||
|
}
|
||||||
|
|
||||||
|
//line views/nav.qtpl:48
|
||||||
|
func StreamUserMenuHTML(qw422016 *qt422016.Writer, u *user.User) {
|
||||||
|
//line views/nav.qtpl:48
|
||||||
|
qw422016.N().S(`
|
||||||
|
`)
|
||||||
|
//line views/nav.qtpl:49
|
||||||
|
if user.AuthUsed {
|
||||||
|
//line views/nav.qtpl:49
|
||||||
|
qw422016.N().S(`
|
||||||
|
<li class="header-links__entry header-links__entry_user">
|
||||||
|
`)
|
||||||
|
//line views/nav.qtpl:51
|
||||||
|
if u.Group == "anon" {
|
||||||
|
//line views/nav.qtpl:51
|
||||||
|
qw422016.N().S(`
|
||||||
|
<a href="/login" class="header-links__link">Login</a>
|
||||||
|
`)
|
||||||
|
//line views/nav.qtpl:53
|
||||||
|
} else {
|
||||||
|
//line views/nav.qtpl:53
|
||||||
|
qw422016.N().S(`
|
||||||
|
<a href="/page/`)
|
||||||
|
//line views/nav.qtpl:54
|
||||||
|
qw422016.E().S(util.UserHypha)
|
||||||
|
//line views/nav.qtpl:54
|
||||||
|
qw422016.N().S(`/`)
|
||||||
|
//line views/nav.qtpl:54
|
||||||
|
qw422016.E().S(u.Name)
|
||||||
|
//line views/nav.qtpl:54
|
||||||
|
qw422016.N().S(`" class="header-links__link">`)
|
||||||
|
//line views/nav.qtpl:54
|
||||||
|
qw422016.E().S(u.Name)
|
||||||
|
//line views/nav.qtpl:54
|
||||||
|
qw422016.N().S(`</a>
|
||||||
|
`)
|
||||||
|
//line views/nav.qtpl:55
|
||||||
|
}
|
||||||
|
//line views/nav.qtpl:55
|
||||||
|
qw422016.N().S(`
|
||||||
|
</li>
|
||||||
|
`)
|
||||||
|
//line views/nav.qtpl:57
|
||||||
|
}
|
||||||
|
//line views/nav.qtpl:57
|
||||||
|
qw422016.N().S(`
|
||||||
|
`)
|
||||||
|
//line views/nav.qtpl:58
|
||||||
|
}
|
||||||
|
|
||||||
|
//line views/nav.qtpl:58
|
||||||
|
func WriteUserMenuHTML(qq422016 qtio422016.Writer, u *user.User) {
|
||||||
|
//line views/nav.qtpl:58
|
||||||
|
qw422016 := qt422016.AcquireWriter(qq422016)
|
||||||
|
//line views/nav.qtpl:58
|
||||||
|
StreamUserMenuHTML(qw422016, u)
|
||||||
|
//line views/nav.qtpl:58
|
||||||
|
qt422016.ReleaseWriter(qw422016)
|
||||||
|
//line views/nav.qtpl:58
|
||||||
|
}
|
||||||
|
|
||||||
|
//line views/nav.qtpl:58
|
||||||
|
func UserMenuHTML(u *user.User) string {
|
||||||
|
//line views/nav.qtpl:58
|
||||||
|
qb422016 := qt422016.AcquireByteBuffer()
|
||||||
|
//line views/nav.qtpl:58
|
||||||
|
WriteUserMenuHTML(qb422016, u)
|
||||||
|
//line views/nav.qtpl:58
|
||||||
|
qs422016 := string(qb422016.B)
|
||||||
|
//line views/nav.qtpl:58
|
||||||
|
qt422016.ReleaseByteBuffer(qb422016)
|
||||||
|
//line views/nav.qtpl:58
|
||||||
|
return qs422016
|
||||||
|
//line views/nav.qtpl:58
|
||||||
|
}
|
||||||
|
|
||||||
|
//line views/nav.qtpl:60
|
||||||
|
func StreamRelativeHyphaeHTML(qw422016 *qt422016.Writer, relatives string) {
|
||||||
|
//line views/nav.qtpl:60
|
||||||
|
qw422016.N().S(`
|
||||||
|
<aside class="relative-hyphae layout-card">
|
||||||
|
<h2 class="relative-hyphae__title layout-card__title">Relative hyphae</h2>
|
||||||
|
`)
|
||||||
|
//line views/nav.qtpl:63
|
||||||
|
qw422016.N().S(relatives)
|
||||||
|
//line views/nav.qtpl:63
|
||||||
|
qw422016.N().S(`
|
||||||
|
</aside>
|
||||||
|
`)
|
||||||
|
//line views/nav.qtpl:65
|
||||||
|
}
|
||||||
|
|
||||||
|
//line views/nav.qtpl:65
|
||||||
|
func WriteRelativeHyphaeHTML(qq422016 qtio422016.Writer, relatives string) {
|
||||||
|
//line views/nav.qtpl:65
|
||||||
|
qw422016 := qt422016.AcquireWriter(qq422016)
|
||||||
|
//line views/nav.qtpl:65
|
||||||
|
StreamRelativeHyphaeHTML(qw422016, relatives)
|
||||||
|
//line views/nav.qtpl:65
|
||||||
|
qt422016.ReleaseWriter(qw422016)
|
||||||
|
//line views/nav.qtpl:65
|
||||||
|
}
|
||||||
|
|
||||||
|
//line views/nav.qtpl:65
|
||||||
|
func RelativeHyphaeHTML(relatives string) string {
|
||||||
|
//line views/nav.qtpl:65
|
||||||
|
qb422016 := qt422016.AcquireByteBuffer()
|
||||||
|
//line views/nav.qtpl:65
|
||||||
|
WriteRelativeHyphaeHTML(qb422016, relatives)
|
||||||
|
//line views/nav.qtpl:65
|
||||||
|
qs422016 := string(qb422016.B)
|
||||||
|
//line views/nav.qtpl:65
|
||||||
|
qt422016.ReleaseByteBuffer(qb422016)
|
||||||
|
//line views/nav.qtpl:65
|
||||||
|
return qs422016
|
||||||
|
//line views/nav.qtpl:65
|
||||||
|
}
|
||||||
|
|
||||||
|
//line views/nav.qtpl:67
|
||||||
|
func StreamSubhyphaeHTML(qw422016 *qt422016.Writer, subhyphae string) {
|
||||||
|
//line views/nav.qtpl:67
|
||||||
|
qw422016.N().S(`
|
||||||
|
`)
|
||||||
|
//line views/nav.qtpl:68
|
||||||
|
if strings.TrimSpace(subhyphae) != "" {
|
||||||
|
//line views/nav.qtpl:68
|
||||||
|
qw422016.N().S(`
|
||||||
|
<section class="subhyphae">
|
||||||
|
<h2 class="subhyphae__title">Subhyphae</h2>
|
||||||
|
<nav class="subhyphae__nav">
|
||||||
|
<ul class="subhyphae__list">
|
||||||
|
`)
|
||||||
|
//line views/nav.qtpl:73
|
||||||
|
qw422016.N().S(subhyphae)
|
||||||
|
//line views/nav.qtpl:73
|
||||||
|
qw422016.N().S(`
|
||||||
|
</ul>
|
||||||
|
</nav>
|
||||||
|
</section>
|
||||||
|
`)
|
||||||
|
//line views/nav.qtpl:77
|
||||||
|
}
|
||||||
|
//line views/nav.qtpl:77
|
||||||
|
qw422016.N().S(`
|
||||||
|
`)
|
||||||
|
//line views/nav.qtpl:78
|
||||||
|
}
|
||||||
|
|
||||||
|
//line views/nav.qtpl:78
|
||||||
|
func WriteSubhyphaeHTML(qq422016 qtio422016.Writer, subhyphae string) {
|
||||||
|
//line views/nav.qtpl:78
|
||||||
|
qw422016 := qt422016.AcquireWriter(qq422016)
|
||||||
|
//line views/nav.qtpl:78
|
||||||
|
StreamSubhyphaeHTML(qw422016, subhyphae)
|
||||||
|
//line views/nav.qtpl:78
|
||||||
|
qt422016.ReleaseWriter(qw422016)
|
||||||
|
//line views/nav.qtpl:78
|
||||||
|
}
|
||||||
|
|
||||||
|
//line views/nav.qtpl:78
|
||||||
|
func SubhyphaeHTML(subhyphae string) string {
|
||||||
|
//line views/nav.qtpl:78
|
||||||
|
qb422016 := qt422016.AcquireByteBuffer()
|
||||||
|
//line views/nav.qtpl:78
|
||||||
|
WriteSubhyphaeHTML(qb422016, subhyphae)
|
||||||
|
//line views/nav.qtpl:78
|
||||||
|
qs422016 := string(qb422016.B)
|
||||||
|
//line views/nav.qtpl:78
|
||||||
|
qt422016.ReleaseByteBuffer(qb422016)
|
||||||
|
//line views/nav.qtpl:78
|
||||||
|
return qs422016
|
||||||
|
//line views/nav.qtpl:78
|
||||||
|
}
|
@ -1,44 +1,21 @@
|
|||||||
{% import "net/http" %}
|
{% import "net/http" %}
|
||||||
{% import "path" %}
|
{% import "path" %}
|
||||||
|
|
||||||
{% import "github.com/bouncepaw/mycorrhiza/hyphae" %}
|
{% import "github.com/bouncepaw/mycorrhiza/hyphae" %}
|
||||||
{% import "github.com/bouncepaw/mycorrhiza/user" %}
|
{% import "github.com/bouncepaw/mycorrhiza/user" %}
|
||||||
{% import "github.com/bouncepaw/mycorrhiza/util" %}
|
{% import "github.com/bouncepaw/mycorrhiza/util" %}
|
||||||
{% import "github.com/bouncepaw/mycorrhiza/views" %}
|
{% import "github.com/bouncepaw/mycorrhiza/tree" %}
|
||||||
|
|
||||||
{% func HistoryHTML(rq *http.Request, hyphaName, list string) %}
|
|
||||||
{%= navHTML(rq, hyphaName, "history") %}
|
|
||||||
<div class="layout">
|
|
||||||
<main class="main-width">
|
|
||||||
<article class="history">
|
|
||||||
<h1>History of {%s hyphaName %}</h1>
|
|
||||||
{%s= list %}
|
|
||||||
</article>
|
|
||||||
</main>
|
|
||||||
</div>
|
|
||||||
{% endfunc %}
|
|
||||||
|
|
||||||
{% func RevisionHTML(rq *http.Request, h *hyphae.Hypha, contents, relatives, subhyphae, revHash string) %}
|
|
||||||
{%= navHTML(rq, h.Name, "revision", revHash) %}
|
|
||||||
<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>
|
|
||||||
{%s= views.NaviTitleHTML(h) %}
|
|
||||||
{%s= contents %}
|
|
||||||
</article>
|
|
||||||
{%= subhyphaeMatrix(subhyphae) %}
|
|
||||||
</main>
|
|
||||||
{%= relativeHyphae(relatives) %}
|
|
||||||
</div>
|
|
||||||
{% endfunc %}
|
|
||||||
|
|
||||||
If `contents` == "", a helpful message is shown instead.
|
If `contents` == "", a helpful message is shown instead.
|
||||||
{% func PageHTML(rq *http.Request, h *hyphae.Hypha, contents, relatives, subhyphae, prevHyphaName, nextHyphaName string) %}
|
{% func HyphaHTML(rq *http.Request, h *hyphae.Hypha, contents string) %}
|
||||||
{%= navHTML(rq, h.Name, "page") %}
|
{% code
|
||||||
|
relatives, subhyphae, prevHyphaName, nextHyphaName := tree.Tree(h.Name)
|
||||||
|
%}
|
||||||
|
{%= NavHTML(rq, h.Name, "page") %}
|
||||||
<div class="layout">
|
<div class="layout">
|
||||||
<main class="main-width">
|
<main class="main-width">
|
||||||
<article>
|
<article>
|
||||||
{%s= views.NaviTitleHTML(h) %}
|
{%s= NaviTitleHTML(h) %}
|
||||||
{% if contents == "" %}
|
{% if contents == "" %}
|
||||||
<p>This hypha has no text. Why not <a href="/edit/{%s h.Name %}">create it</a>?</p>
|
<p>This hypha has no text. Why not <a href="/edit/{%s h.Name %}">create it</a>?</p>
|
||||||
{% else %}
|
{% else %}
|
||||||
@ -66,9 +43,39 @@ If `contents` == "", a helpful message is shown instead.
|
|||||||
<input type="submit"/>
|
<input type="submit"/>
|
||||||
</form>
|
</form>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{%= subhyphaeMatrix(subhyphae) %}
|
{%= SubhyphaeHTML(subhyphae) %}
|
||||||
|
</main>
|
||||||
|
{%= RelativeHyphaeHTML(relatives) %}
|
||||||
|
{%= BackLinksHTML(h) %}
|
||||||
|
</div>
|
||||||
|
{% endfunc %}
|
||||||
|
|
||||||
|
{% func RevisionHTML(rq *http.Request, h *hyphae.Hypha, contents, revHash string) %}
|
||||||
|
{% code
|
||||||
|
relatives, subhyphae, _, _ := tree.Tree(h.Name)
|
||||||
|
%}
|
||||||
|
{%= NavHTML(rq, h.Name, "revision", revHash) %}
|
||||||
|
<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>
|
||||||
|
{%s= NaviTitleHTML(h) %}
|
||||||
|
{%s= contents %}
|
||||||
|
</article>
|
||||||
|
{%= SubhyphaeHTML(subhyphae) %}
|
||||||
|
</main>
|
||||||
|
{%= RelativeHyphaeHTML(relatives) %}
|
||||||
|
</div>
|
||||||
|
{% endfunc %}
|
||||||
|
|
||||||
|
{% func HistoryHTML(rq *http.Request, hyphaName, list string) %}
|
||||||
|
{%= NavHTML(rq, hyphaName, "history") %}
|
||||||
|
<div class="layout">
|
||||||
|
<main class="main-width">
|
||||||
|
<article class="history">
|
||||||
|
<h1>History of {%s hyphaName %}</h1>
|
||||||
|
{%s= list %}
|
||||||
|
</article>
|
||||||
</main>
|
</main>
|
||||||
{%= relativeHyphae(relatives) %}
|
|
||||||
{%= views.BackLinksHTML(h) %}
|
|
||||||
</div>
|
</div>
|
||||||
{% endfunc %}
|
{% endfunc %}
|
338
views/readers.qtpl.go
Normal file
338
views/readers.qtpl.go
Normal file
@ -0,0 +1,338 @@
|
|||||||
|
// 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
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user