1
0
mirror of https://github.com/osmarks/mycorrhiza.git synced 2024-12-04 18:19:54 +00:00

Move subhyphae to the bottom

This commit is contained in:
bouncepaw 2021-02-19 23:12:36 +05:00
parent 20ef0fade4
commit 2d9e3b4a54
8 changed files with 320 additions and 218 deletions

View File

@ -43,13 +43,14 @@ func handlerRevision(w http.ResponseWriter, rq *http.Request) {
if err == nil {
contents = markup.Doc(hyphaName, textContents).AsHTML()
}
treeHTML, _, _ := tree.Tree(hyphaName)
treeHTML, subhyphae, _, _ := tree.Tree(hyphaName)
page := templates.RevisionHTML(
rq,
hyphaName,
naviTitle(hyphaName),
contents,
treeHTML,
subhyphae,
revHash,
)
w.Header().Set("Content-Type", "text/html;charset=utf-8")
@ -102,7 +103,7 @@ func handlerHypha(w http.ResponseWriter, rq *http.Request) {
contents = h.BinaryHtmlBlock() + contents
}
}
treeHTML, prevHypha, nextHypha := tree.Tree(hyphaName)
treeHTML, subhyphaeHTML, prevHypha, nextHypha := tree.Tree(hyphaName)
util.HTTP200Page(w,
templates.BaseHTML(
util.BeautifulName(hyphaName),
@ -110,6 +111,7 @@ func handlerHypha(w http.ResponseWriter, rq *http.Request) {
naviTitle(hyphaName),
contents,
treeHTML,
subhyphaeHTML,
h.BackLinkEntriesHTML(),
prevHypha, nextHypha,
hasAmnt),

View File

@ -115,7 +115,7 @@ blockquote { margin-left: 0; padding-left: 1rem; }
.wikilink_mailto::before { content: url("/static/icon/mailto"); }
article { overflow-wrap: break-word; word-wrap: break-word; word-break: break-word; line-height: 150%; }
article h1, article h2, article h3, article h4, article h5, article h6 { margin: 1.5rem 0 0 0; }
main h1, main h2, main h3, main h4, main h5, main h6 { margin: 1.5rem 0 0 0; }
article p { margin: .5rem 0; }
article ul, ol { padding-left: 1.5rem; margin: .5rem 0; }
article code { padding: .1rem .3rem; border-radius: .25rem; font-size: 90%; }
@ -133,6 +133,7 @@ article pre.codeblock { padding:.5rem; white-space: pre-wrap; border-radius: .25
.binary-container_with-video video,
.binary-container_with-audio audio {width: 100%}
.subhyphae__title { padding-bottom: .5rem; }
.navi-title { padding-bottom: .5rem; margin: .25rem 0; }
.navi-title a {text-decoration:none; }
.navi-title__separator { margin: 0 .25rem; }
@ -172,18 +173,20 @@ table { border: #ddd 1px solid; border-radius: .25rem; min-width: 4rem; }
td { padding: .25rem; }
caption { caption-side: top; font-size: small; }
.subhyphae__list, .subhyphae__list ul { display: flex; padding: 0; margin: 0; flex-wrap: wrap; }
.subhyphae__entry { list-style-type: none; border: 1px solid #999; padding: 0; margin: .125rem; border-radius: .25rem; }
.subhyphae__link { display: block; padding: .25rem; text-decoration: none; }
.subhyphae__link:hover { background: #eee; }
.navitree { padding: 0; margin: 0; }
.navitree__trunk ul { padding-left: 1rem; }
.navitree > .navitree__trunk > ul { padding-left: 2rem; }
.navitree__entry { }
.navitree > .navitree__entry > a::before { display: inline-block; width: .5rem; color: #999; margin: 0 .25rem; }
.navitree > .navitree__entry_infertile > a::before { content: " "} /* nbsp, careful */
.navitree > .navitree__sibling_fertile > a::before { content: "▸"}
.navitree > .navitree__trunk_fertile > a::before { content: "▾"}
.navitree__trunk { border-left: 1px #999 solid; }
.navitree > .navitree__trunk { border-left: none; }
.navitree > .navitree__trunk > a { font-weight: bold; }
.navitree__link { text-decoration: none; display: block; padding: .25rem; }
.navitree__entry_this > span { display: block; padding: .25rem; font-weight: bold; }
.navitree__entry_this > span::before { content: " "; display: inline-block; width: 1rem; }
/* Color stuff */

View File

@ -1,4 +1,5 @@
{% import "net/http" %}
{% import "strings" %}
{% import "github.com/bouncepaw/mycorrhiza/user" %}
{% import "github.com/bouncepaw/mycorrhiza/util" %}
@ -73,3 +74,16 @@ var navEntries = []navEntry{
</nav>
</aside>
{% endfunc %}
{% func subhyphaeMatrix(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 %}

View File

@ -8,27 +8,30 @@ package templates
import "net/http"
//line templates/common.qtpl:2
import "github.com/bouncepaw/mycorrhiza/user"
import "strings"
//line templates/common.qtpl:3
import "github.com/bouncepaw/mycorrhiza/user"
//line templates/common.qtpl:4
import "github.com/bouncepaw/mycorrhiza/util"
// This is the <nav> seen on top of many pages.
//line templates/common.qtpl:6
//line templates/common.qtpl:7
import (
qtio422016 "io"
qt422016 "github.com/valyala/quicktemplate"
)
//line templates/common.qtpl:6
//line templates/common.qtpl:7
var (
_ = qtio422016.Copy
_ = qt422016.AcquireByteBuffer
)
//line templates/common.qtpl:7
//line templates/common.qtpl:8
type navEntry struct {
path string
title string
@ -44,258 +47,314 @@ var navEntries = []navEntry{
{"text", "Raw text"},
}
//line templates/common.qtpl:22
//line templates/common.qtpl:23
func streamnavHTML(qw422016 *qt422016.Writer, rq *http.Request, hyphaName, navType string, revisionHash ...string) {
//line templates/common.qtpl:22
//line templates/common.qtpl:23
qw422016.N().S(`
`)
//line templates/common.qtpl:24
//line templates/common.qtpl:25
u := user.FromRequest(rq)
//line templates/common.qtpl:25
//line templates/common.qtpl:26
qw422016.N().S(`
<nav class="hypha-tabs main-width">
<ul class="hypha-tabs__flex">
`)
//line templates/common.qtpl:28
//line templates/common.qtpl:29
for _, entry := range navEntries {
//line templates/common.qtpl:29
//line templates/common.qtpl:30
if navType == "revision" && entry.path == "revision" {
//line templates/common.qtpl:29
//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:31
//line templates/common.qtpl:32
qw422016.E().S(revisionHash[0])
//line templates/common.qtpl:31
//line templates/common.qtpl:32
qw422016.N().S(`</span>
</li>
`)
//line templates/common.qtpl:33
//line templates/common.qtpl:34
} else if navType == entry.path {
//line templates/common.qtpl:33
//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:35
//line templates/common.qtpl:36
qw422016.E().S(entry.title)
//line templates/common.qtpl:35
//line templates/common.qtpl:36
qw422016.N().S(`</span>
</li>
`)
//line templates/common.qtpl:37
//line templates/common.qtpl:38
} else if entry.path != "revision" && u.CanProceed(entry.path) {
//line templates/common.qtpl:37
//line templates/common.qtpl:38
qw422016.N().S(` <li class="hypha-tabs__tab">
<a class="hypha-tabs__link" href="/`)
//line templates/common.qtpl:39
//line templates/common.qtpl:40
qw422016.E().S(entry.path)
//line templates/common.qtpl:39
//line templates/common.qtpl:40
qw422016.N().S(`/`)
//line templates/common.qtpl:39
//line templates/common.qtpl:40
qw422016.E().S(hyphaName)
//line templates/common.qtpl:39
//line templates/common.qtpl:40
qw422016.N().S(`">`)
//line templates/common.qtpl:39
//line templates/common.qtpl:40
qw422016.E().S(entry.title)
//line templates/common.qtpl:39
//line templates/common.qtpl:40
qw422016.N().S(`</a>
</li>
`)
//line templates/common.qtpl:41
//line templates/common.qtpl:42
}
//line templates/common.qtpl:42
//line templates/common.qtpl:43
}
//line templates/common.qtpl:42
//line templates/common.qtpl:43
qw422016.N().S(` </ul>
</nav>
`)
//line templates/common.qtpl:45
//line templates/common.qtpl:46
}
//line templates/common.qtpl:45
//line templates/common.qtpl:46
func writenavHTML(qq422016 qtio422016.Writer, rq *http.Request, hyphaName, navType string, revisionHash ...string) {
//line templates/common.qtpl:45
//line templates/common.qtpl:46
qw422016 := qt422016.AcquireWriter(qq422016)
//line templates/common.qtpl:45
//line templates/common.qtpl:46
streamnavHTML(qw422016, rq, hyphaName, navType, revisionHash...)
//line templates/common.qtpl:45
//line templates/common.qtpl:46
qt422016.ReleaseWriter(qw422016)
//line templates/common.qtpl:45
//line templates/common.qtpl:46
}
//line templates/common.qtpl:45
//line templates/common.qtpl:46
func navHTML(rq *http.Request, hyphaName, navType string, revisionHash ...string) string {
//line templates/common.qtpl:45
//line templates/common.qtpl:46
qb422016 := qt422016.AcquireByteBuffer()
//line templates/common.qtpl:45
//line templates/common.qtpl:46
writenavHTML(qb422016, rq, hyphaName, navType, revisionHash...)
//line templates/common.qtpl:45
//line templates/common.qtpl:46
qs422016 := string(qb422016.B)
//line templates/common.qtpl:45
//line templates/common.qtpl:46
qt422016.ReleaseByteBuffer(qb422016)
//line templates/common.qtpl:45
//line templates/common.qtpl:46
return qs422016
//line templates/common.qtpl:45
//line templates/common.qtpl:46
}
//line templates/common.qtpl:47
//line templates/common.qtpl:48
func streamuserMenuHTML(qw422016 *qt422016.Writer, u *user.User) {
//line templates/common.qtpl:47
//line templates/common.qtpl:48
qw422016.N().S(`
`)
//line templates/common.qtpl:48
//line templates/common.qtpl:49
if user.AuthUsed {
//line templates/common.qtpl:48
//line templates/common.qtpl:49
qw422016.N().S(`
<li class="header-links__entry header-links__entry_user">
`)
//line templates/common.qtpl:50
//line templates/common.qtpl:51
if u.Group == "anon" {
//line templates/common.qtpl:50
//line templates/common.qtpl:51
qw422016.N().S(`
<a href="/login" class="header-links__link">Login</a>
`)
//line templates/common.qtpl:52
//line templates/common.qtpl:53
} else {
//line templates/common.qtpl:52
//line templates/common.qtpl:53
qw422016.N().S(`
<a href="/page/`)
//line templates/common.qtpl:53
//line templates/common.qtpl:54
qw422016.E().S(util.UserHypha)
//line templates/common.qtpl:53
//line templates/common.qtpl:54
qw422016.N().S(`/`)
//line templates/common.qtpl:53
//line templates/common.qtpl:54
qw422016.E().S(u.Name)
//line templates/common.qtpl:53
//line templates/common.qtpl:54
qw422016.N().S(`" class="header-links__link">`)
//line templates/common.qtpl:53
//line templates/common.qtpl:54
qw422016.E().S(u.Name)
//line templates/common.qtpl:53
//line templates/common.qtpl:54
qw422016.N().S(`</a>
`)
//line templates/common.qtpl:54
//line templates/common.qtpl:55
}
//line templates/common.qtpl:54
//line templates/common.qtpl:55
qw422016.N().S(`
</li>
`)
//line templates/common.qtpl:56
//line templates/common.qtpl:57
}
//line templates/common.qtpl:56
//line templates/common.qtpl:57
qw422016.N().S(`
`)
//line templates/common.qtpl:57
//line templates/common.qtpl:58
}
//line templates/common.qtpl:57
//line templates/common.qtpl:58
func writeuserMenuHTML(qq422016 qtio422016.Writer, u *user.User) {
//line templates/common.qtpl:57
//line templates/common.qtpl:58
qw422016 := qt422016.AcquireWriter(qq422016)
//line templates/common.qtpl:57
//line templates/common.qtpl:58
streamuserMenuHTML(qw422016, u)
//line templates/common.qtpl:57
//line templates/common.qtpl:58
qt422016.ReleaseWriter(qw422016)
//line templates/common.qtpl:57
//line templates/common.qtpl:58
}
//line templates/common.qtpl:57
//line templates/common.qtpl:58
func userMenuHTML(u *user.User) string {
//line templates/common.qtpl:57
//line templates/common.qtpl:58
qb422016 := qt422016.AcquireByteBuffer()
//line templates/common.qtpl:57
//line templates/common.qtpl:58
writeuserMenuHTML(qb422016, u)
//line templates/common.qtpl:57
//line templates/common.qtpl:58
qs422016 := string(qb422016.B)
//line templates/common.qtpl:57
//line templates/common.qtpl:58
qt422016.ReleaseByteBuffer(qb422016)
//line templates/common.qtpl:57
//line templates/common.qtpl:58
return qs422016
//line templates/common.qtpl:57
//line templates/common.qtpl:58
}
//line templates/common.qtpl:59
//line templates/common.qtpl:60
func streamrelativeHyphae(qw422016 *qt422016.Writer, relatives string) {
//line templates/common.qtpl:59
//line templates/common.qtpl:60
qw422016.N().S(`
<aside class="relative-hyphae layout-card">
<h2 class="relative-hyphae__title layout-card__title">Relative hyphae</h2>
`)
//line templates/common.qtpl:62
//line templates/common.qtpl:63
qw422016.N().S(relatives)
//line templates/common.qtpl:62
//line templates/common.qtpl:63
qw422016.N().S(`
</aside>
`)
//line templates/common.qtpl:64
//line templates/common.qtpl:65
}
//line templates/common.qtpl:64
//line templates/common.qtpl:65
func writerelativeHyphae(qq422016 qtio422016.Writer, relatives string) {
//line templates/common.qtpl:64
//line templates/common.qtpl:65
qw422016 := qt422016.AcquireWriter(qq422016)
//line templates/common.qtpl:64
//line templates/common.qtpl:65
streamrelativeHyphae(qw422016, relatives)
//line templates/common.qtpl:64
//line templates/common.qtpl:65
qt422016.ReleaseWriter(qw422016)
//line templates/common.qtpl:64
//line templates/common.qtpl:65
}
//line templates/common.qtpl:64
//line templates/common.qtpl:65
func relativeHyphae(relatives string) string {
//line templates/common.qtpl:64
//line templates/common.qtpl:65
qb422016 := qt422016.AcquireByteBuffer()
//line templates/common.qtpl:64
//line templates/common.qtpl:65
writerelativeHyphae(qb422016, relatives)
//line templates/common.qtpl:64
//line templates/common.qtpl:65
qs422016 := string(qb422016.B)
//line templates/common.qtpl:64
//line templates/common.qtpl:65
qt422016.ReleaseByteBuffer(qb422016)
//line templates/common.qtpl:64
//line templates/common.qtpl:65
return qs422016
//line templates/common.qtpl:64
//line templates/common.qtpl:65
}
//line templates/common.qtpl:66
//line templates/common.qtpl:67
func streambacklinks(qw422016 *qt422016.Writer, backlinkEntries string) {
//line templates/common.qtpl:66
//line templates/common.qtpl:67
qw422016.N().S(`
<aside class="backlinks layout-card">
<h2 class="backlinks__title layout-card__title">Backlinks</h2>
<nav class="backlinks__nav">
<ul class="backlinks__list">
`)
//line templates/common.qtpl:71
//line templates/common.qtpl:72
qw422016.N().S(backlinkEntries)
//line templates/common.qtpl:71
//line templates/common.qtpl:72
qw422016.N().S(`
</ul>
</nav>
</aside>
`)
//line templates/common.qtpl:75
//line templates/common.qtpl:76
}
//line templates/common.qtpl:75
//line templates/common.qtpl:76
func writebacklinks(qq422016 qtio422016.Writer, backlinkEntries string) {
//line templates/common.qtpl:75
//line templates/common.qtpl:76
qw422016 := qt422016.AcquireWriter(qq422016)
//line templates/common.qtpl:75
//line templates/common.qtpl:76
streambacklinks(qw422016, backlinkEntries)
//line templates/common.qtpl:75
//line templates/common.qtpl:76
qt422016.ReleaseWriter(qw422016)
//line templates/common.qtpl:75
//line templates/common.qtpl:76
}
//line templates/common.qtpl:75
//line templates/common.qtpl:76
func backlinks(backlinkEntries string) string {
//line templates/common.qtpl:75
//line templates/common.qtpl:76
qb422016 := qt422016.AcquireByteBuffer()
//line templates/common.qtpl:75
//line templates/common.qtpl:76
writebacklinks(qb422016, backlinkEntries)
//line templates/common.qtpl:75
//line templates/common.qtpl:76
qs422016 := string(qb422016.B)
//line templates/common.qtpl:75
//line templates/common.qtpl:76
qt422016.ReleaseByteBuffer(qb422016)
//line templates/common.qtpl:75
//line templates/common.qtpl:76
return qs422016
//line templates/common.qtpl:75
//line templates/common.qtpl:76
}
//line templates/common.qtpl:78
func streamsubhyphaeMatrix(qw422016 *qt422016.Writer, subhyphae string) {
//line templates/common.qtpl:78
qw422016.N().S(`
`)
//line templates/common.qtpl:79
if strings.TrimSpace(subhyphae) != "" {
//line templates/common.qtpl:79
qw422016.N().S(`
<section class="subhyphae">
<h2 class="subhyphae__title">Subhyphae</h2>
<nav class="subhyphae__nav">
<ul class="subhyphae__list">
`)
//line templates/common.qtpl:84
qw422016.N().S(subhyphae)
//line templates/common.qtpl:84
qw422016.N().S(`
</ul>
</nav>
</section>
`)
//line templates/common.qtpl:88
}
//line templates/common.qtpl:88
qw422016.N().S(`
`)
//line templates/common.qtpl:89
}
//line templates/common.qtpl:89
func writesubhyphaeMatrix(qq422016 qtio422016.Writer, subhyphae string) {
//line templates/common.qtpl:89
qw422016 := qt422016.AcquireWriter(qq422016)
//line templates/common.qtpl:89
streamsubhyphaeMatrix(qw422016, subhyphae)
//line templates/common.qtpl:89
qt422016.ReleaseWriter(qw422016)
//line templates/common.qtpl:89
}
//line templates/common.qtpl:89
func subhyphaeMatrix(subhyphae string) string {
//line templates/common.qtpl:89
qb422016 := qt422016.AcquireByteBuffer()
//line templates/common.qtpl:89
writesubhyphaeMatrix(qb422016, subhyphae)
//line templates/common.qtpl:89
qs422016 := string(qb422016.B)
//line templates/common.qtpl:89
qt422016.ReleaseByteBuffer(qb422016)
//line templates/common.qtpl:89
return qs422016
//line templates/common.qtpl:89
}

View File

@ -90,7 +90,7 @@ blockquote { margin-left: 0; padding-left: 1rem; }
.wikilink_mailto::before { content: url("/static/icon/mailto"); }
article { overflow-wrap: break-word; word-wrap: break-word; word-break: break-word; line-height: 150%; }
article h1, article h2, article h3, article h4, article h5, article h6 { margin: 1.5rem 0 0 0; }
main h1, main h2, main h3, main h4, main h5, main h6 { margin: 1.5rem 0 0 0; }
article p { margin: .5rem 0; }
article ul, ol { padding-left: 1.5rem; margin: .5rem 0; }
article code { padding: .1rem .3rem; border-radius: .25rem; font-size: 90%; }
@ -108,6 +108,7 @@ article pre.codeblock { padding:.5rem; white-space: pre-wrap; border-radius: .25
.binary-container_with-video video,
.binary-container_with-audio audio {width: 100%}
.subhyphae__title { padding-bottom: .5rem; }
.navi-title { padding-bottom: .5rem; margin: .25rem 0; }
.navi-title a {text-decoration:none; }
.navi-title__separator { margin: 0 .25rem; }
@ -147,18 +148,20 @@ table { border: #ddd 1px solid; border-radius: .25rem; min-width: 4rem; }
td { padding: .25rem; }
caption { caption-side: top; font-size: small; }
.subhyphae__list, .subhyphae__list ul { display: flex; padding: 0; margin: 0; flex-wrap: wrap; }
.subhyphae__entry { list-style-type: none; border: 1px solid #999; padding: 0; margin: .125rem; border-radius: .25rem; }
.subhyphae__link { display: block; padding: .25rem; text-decoration: none; }
.subhyphae__link:hover { background: #eee; }
.navitree { padding: 0; margin: 0; }
.navitree__trunk ul { padding-left: 1rem; }
.navitree > .navitree__trunk > ul { padding-left: 2rem; }
.navitree__entry { }
.navitree > .navitree__entry > a::before { display: inline-block; width: .5rem; color: #999; margin: 0 .25rem; }
.navitree > .navitree__entry_infertile > a::before { content: " "} /* nbsp, careful */
.navitree > .navitree__sibling_fertile > a::before { content: "▸"}
.navitree > .navitree__trunk_fertile > a::before { content: "▾"}
.navitree__trunk { border-left: 1px #999 solid; }
.navitree > .navitree__trunk { border-left: none; }
.navitree > .navitree__trunk > a { font-weight: bold; }
.navitree__link { text-decoration: none; display: block; padding: .25rem; }
.navitree__entry_this > span { display: block; padding: .25rem; font-weight: bold; }
.navitree__entry_this > span::before { content: " "; display: inline-block; width: 1rem; }
/* Color stuff */

View File

@ -15,7 +15,7 @@
</div>
{% endfunc %}
{% func RevisionHTML(rq *http.Request, hyphaName, naviTitle, contents, relatives, revHash string) %}
{% func RevisionHTML(rq *http.Request, hyphaName, naviTitle, contents, relatives, subhyphae, revHash string) %}
{%= navHTML(rq, hyphaName, "revision", revHash) %}
<div class="layout">
<main class="main-width">
@ -24,13 +24,14 @@
{%s= naviTitle %}
{%s= contents %}
</article>
{%= subhyphaeMatrix(subhyphae) %}
</main>
{%= relativeHyphae(relatives) %}
</div>
{% endfunc %}
If `contents` == "", a helpful message is shown instead.
{% func PageHTML(rq *http.Request, hyphaName, naviTitle, contents, relatives, backlinkEntries, prevHyphaName, nextHyphaName string, hasAmnt bool) %}
{% func PageHTML(rq *http.Request, hyphaName, naviTitle, contents, relatives, subhyphae, backlinkEntries, prevHyphaName, nextHyphaName string, hasAmnt bool) %}
{%= navHTML(rq, hyphaName, "page") %}
<div class="layout">
<main class="main-width">
@ -63,6 +64,7 @@ If `contents` == "", a helpful message is shown instead.
<input type="submit"/>
</form>
{% endif %}
{%= subhyphaeMatrix(subhyphae) %}
</main>
{%= relativeHyphae(relatives) %}
{%= backlinks(backlinkEntries) %}

View File

@ -85,7 +85,7 @@ func HistoryHTML(rq *http.Request, hyphaName, list string) string {
}
//line templates/readers.qtpl:18
func StreamRevisionHTML(qw422016 *qt422016.Writer, rq *http.Request, hyphaName, naviTitle, contents, relatives, revHash string) {
func StreamRevisionHTML(qw422016 *qt422016.Writer, rq *http.Request, hyphaName, naviTitle, contents, relatives, subhyphae, revHash string) {
//line templates/readers.qtpl:18
qw422016.N().S(`
`)
@ -108,154 +108,159 @@ func StreamRevisionHTML(qw422016 *qt422016.Writer, rq *http.Request, hyphaName,
//line templates/readers.qtpl:25
qw422016.N().S(`
</article>
`)
//line templates/readers.qtpl:27
streamsubhyphaeMatrix(qw422016, subhyphae)
//line templates/readers.qtpl:27
qw422016.N().S(`
</main>
`)
//line templates/readers.qtpl:28
//line templates/readers.qtpl:29
streamrelativeHyphae(qw422016, relatives)
//line templates/readers.qtpl:28
//line templates/readers.qtpl:29
qw422016.N().S(`
</div>
`)
//line templates/readers.qtpl:30
//line templates/readers.qtpl:31
}
//line templates/readers.qtpl:30
func WriteRevisionHTML(qq422016 qtio422016.Writer, rq *http.Request, hyphaName, naviTitle, contents, relatives, revHash string) {
//line templates/readers.qtpl:30
//line templates/readers.qtpl:31
func WriteRevisionHTML(qq422016 qtio422016.Writer, rq *http.Request, hyphaName, naviTitle, contents, relatives, subhyphae, revHash string) {
//line templates/readers.qtpl:31
qw422016 := qt422016.AcquireWriter(qq422016)
//line templates/readers.qtpl:30
StreamRevisionHTML(qw422016, rq, hyphaName, naviTitle, contents, relatives, revHash)
//line templates/readers.qtpl:30
//line templates/readers.qtpl:31
StreamRevisionHTML(qw422016, rq, hyphaName, naviTitle, contents, relatives, subhyphae, revHash)
//line templates/readers.qtpl:31
qt422016.ReleaseWriter(qw422016)
//line templates/readers.qtpl:30
//line templates/readers.qtpl:31
}
//line templates/readers.qtpl:30
func RevisionHTML(rq *http.Request, hyphaName, naviTitle, contents, relatives, revHash string) string {
//line templates/readers.qtpl:30
//line templates/readers.qtpl:31
func RevisionHTML(rq *http.Request, hyphaName, naviTitle, contents, relatives, subhyphae, revHash string) string {
//line templates/readers.qtpl:31
qb422016 := qt422016.AcquireByteBuffer()
//line templates/readers.qtpl:30
WriteRevisionHTML(qb422016, rq, hyphaName, naviTitle, contents, relatives, revHash)
//line templates/readers.qtpl:30
//line templates/readers.qtpl:31
WriteRevisionHTML(qb422016, rq, hyphaName, naviTitle, contents, relatives, subhyphae, revHash)
//line templates/readers.qtpl:31
qs422016 := string(qb422016.B)
//line templates/readers.qtpl:30
//line templates/readers.qtpl:31
qt422016.ReleaseByteBuffer(qb422016)
//line templates/readers.qtpl:30
//line templates/readers.qtpl:31
return qs422016
//line templates/readers.qtpl:30
//line templates/readers.qtpl:31
}
// If `contents` == "", a helpful message is shown instead.
//line templates/readers.qtpl:33
func StreamPageHTML(qw422016 *qt422016.Writer, rq *http.Request, hyphaName, naviTitle, contents, relatives, backlinkEntries, prevHyphaName, nextHyphaName string, hasAmnt bool) {
//line templates/readers.qtpl:33
//line templates/readers.qtpl:34
func StreamPageHTML(qw422016 *qt422016.Writer, rq *http.Request, hyphaName, naviTitle, contents, relatives, subhyphae, backlinkEntries, prevHyphaName, nextHyphaName string, hasAmnt bool) {
//line templates/readers.qtpl:34
qw422016.N().S(`
`)
//line templates/readers.qtpl:34
//line templates/readers.qtpl:35
streamnavHTML(qw422016, rq, hyphaName, "page")
//line templates/readers.qtpl:34
//line templates/readers.qtpl:35
qw422016.N().S(`
<div class="layout">
<main class="main-width">
<article>
`)
//line templates/readers.qtpl:38
//line templates/readers.qtpl:39
qw422016.N().S(naviTitle)
//line templates/readers.qtpl:38
//line templates/readers.qtpl:39
qw422016.N().S(`
`)
//line templates/readers.qtpl:39
//line templates/readers.qtpl:40
if contents == "" {
//line templates/readers.qtpl:39
//line templates/readers.qtpl:40
qw422016.N().S(`
<p>This hypha has no text. Why not <a href="/edit/`)
//line templates/readers.qtpl:40
//line templates/readers.qtpl:41
qw422016.E().S(hyphaName)
//line templates/readers.qtpl:40
//line templates/readers.qtpl:41
qw422016.N().S(`">create it</a>?</p>
`)
//line templates/readers.qtpl:41
//line templates/readers.qtpl:42
} else {
//line templates/readers.qtpl:41
//line templates/readers.qtpl:42
qw422016.N().S(`
`)
//line templates/readers.qtpl:42
//line templates/readers.qtpl:43
qw422016.N().S(contents)
//line templates/readers.qtpl:42
//line templates/readers.qtpl:43
qw422016.N().S(`
`)
//line templates/readers.qtpl:43
//line templates/readers.qtpl:44
}
//line templates/readers.qtpl:43
//line templates/readers.qtpl:44
qw422016.N().S(`
</article>
<section class="prevnext">
`)
//line templates/readers.qtpl:46
//line templates/readers.qtpl:47
if prevHyphaName != "" {
//line templates/readers.qtpl:46
//line templates/readers.qtpl:47
qw422016.N().S(`
<a class="prevnext__el prevnext__prev" href="/hypha/`)
//line templates/readers.qtpl:47
//line templates/readers.qtpl:48
qw422016.E().S(prevHyphaName)
//line templates/readers.qtpl:47
//line templates/readers.qtpl:48
qw422016.N().S(`" rel="prev">← `)
//line templates/readers.qtpl:47
//line templates/readers.qtpl:48
qw422016.E().S(util.BeautifulName(path.Base(prevHyphaName)))
//line templates/readers.qtpl:47
//line templates/readers.qtpl:48
qw422016.N().S(`</a>
`)
//line templates/readers.qtpl:48
//line templates/readers.qtpl:49
}
//line templates/readers.qtpl:48
//line templates/readers.qtpl:49
qw422016.N().S(`
`)
//line templates/readers.qtpl:49
//line templates/readers.qtpl:50
if nextHyphaName != "" {
//line templates/readers.qtpl:49
//line templates/readers.qtpl:50
qw422016.N().S(`
<a class="prevnext__el prevnext__next" href="/hypha/`)
//line templates/readers.qtpl:50
//line templates/readers.qtpl:51
qw422016.E().S(nextHyphaName)
//line templates/readers.qtpl:50
//line templates/readers.qtpl:51
qw422016.N().S(`" rel="next">`)
//line templates/readers.qtpl:50
//line templates/readers.qtpl:51
qw422016.E().S(util.BeautifulName(path.Base(nextHyphaName)))
//line templates/readers.qtpl:50
//line templates/readers.qtpl:51
qw422016.N().S(` </a>
`)
//line templates/readers.qtpl:51
//line templates/readers.qtpl:52
}
//line templates/readers.qtpl:51
//line templates/readers.qtpl:52
qw422016.N().S(`
</section>
`)
//line templates/readers.qtpl:53
//line templates/readers.qtpl:54
if u := user.FromRequest(rq); !user.AuthUsed || u.Group != "anon" {
//line templates/readers.qtpl:53
//line templates/readers.qtpl:54
qw422016.N().S(`
<form action="/upload-binary/`)
//line templates/readers.qtpl:54
//line templates/readers.qtpl:55
qw422016.E().S(hyphaName)
//line templates/readers.qtpl:54
//line templates/readers.qtpl:55
qw422016.N().S(`"
method="post" enctype="multipart/form-data"
class="upload-amnt">
`)
//line templates/readers.qtpl:57
//line templates/readers.qtpl:58
if hasAmnt {
//line templates/readers.qtpl:57
//line templates/readers.qtpl:58
qw422016.N().S(`
<a class="upload-amnt__unattach" href="/unattach-ask/`)
//line templates/readers.qtpl:58
//line templates/readers.qtpl:59
qw422016.E().S(hyphaName)
//line templates/readers.qtpl:58
//line templates/readers.qtpl:59
qw422016.N().S(`">Unattach current attachment?</a>
`)
//line templates/readers.qtpl:59
//line templates/readers.qtpl:60
}
//line templates/readers.qtpl:59
//line templates/readers.qtpl:60
qw422016.N().S(`
<label for="upload-binary__input">Upload a new attachment</label>
<br>
@ -263,48 +268,53 @@ func StreamPageHTML(qw422016 *qt422016.Writer, rq *http.Request, hyphaName, navi
<input type="submit"/>
</form>
`)
//line templates/readers.qtpl:65
//line templates/readers.qtpl:66
}
//line templates/readers.qtpl:65
//line templates/readers.qtpl:66
qw422016.N().S(`
`)
//line templates/readers.qtpl:67
streamsubhyphaeMatrix(qw422016, subhyphae)
//line templates/readers.qtpl:67
qw422016.N().S(`
</main>
`)
//line templates/readers.qtpl:67
//line templates/readers.qtpl:69
streamrelativeHyphae(qw422016, relatives)
//line templates/readers.qtpl:67
//line templates/readers.qtpl:69
qw422016.N().S(`
`)
//line templates/readers.qtpl:68
//line templates/readers.qtpl:70
streambacklinks(qw422016, backlinkEntries)
//line templates/readers.qtpl:68
//line templates/readers.qtpl:70
qw422016.N().S(`
</div>
`)
//line templates/readers.qtpl:70
//line templates/readers.qtpl:72
}
//line templates/readers.qtpl:70
func WritePageHTML(qq422016 qtio422016.Writer, rq *http.Request, hyphaName, naviTitle, contents, relatives, backlinkEntries, prevHyphaName, nextHyphaName string, hasAmnt bool) {
//line templates/readers.qtpl:70
//line templates/readers.qtpl:72
func WritePageHTML(qq422016 qtio422016.Writer, rq *http.Request, hyphaName, naviTitle, contents, relatives, subhyphae, backlinkEntries, prevHyphaName, nextHyphaName string, hasAmnt bool) {
//line templates/readers.qtpl:72
qw422016 := qt422016.AcquireWriter(qq422016)
//line templates/readers.qtpl:70
StreamPageHTML(qw422016, rq, hyphaName, naviTitle, contents, relatives, backlinkEntries, prevHyphaName, nextHyphaName, hasAmnt)
//line templates/readers.qtpl:70
//line templates/readers.qtpl:72
StreamPageHTML(qw422016, rq, hyphaName, naviTitle, contents, relatives, subhyphae, backlinkEntries, prevHyphaName, nextHyphaName, hasAmnt)
//line templates/readers.qtpl:72
qt422016.ReleaseWriter(qw422016)
//line templates/readers.qtpl:70
//line templates/readers.qtpl:72
}
//line templates/readers.qtpl:70
func PageHTML(rq *http.Request, hyphaName, naviTitle, contents, relatives, backlinkEntries, prevHyphaName, nextHyphaName string, hasAmnt bool) string {
//line templates/readers.qtpl:70
//line templates/readers.qtpl:72
func PageHTML(rq *http.Request, hyphaName, naviTitle, contents, relatives, subhyphae, backlinkEntries, prevHyphaName, nextHyphaName string, hasAmnt bool) string {
//line templates/readers.qtpl:72
qb422016 := qt422016.AcquireByteBuffer()
//line templates/readers.qtpl:70
WritePageHTML(qb422016, rq, hyphaName, naviTitle, contents, relatives, backlinkEntries, prevHyphaName, nextHyphaName, hasAmnt)
//line templates/readers.qtpl:70
//line templates/readers.qtpl:72
WritePageHTML(qb422016, rq, hyphaName, naviTitle, contents, relatives, subhyphae, backlinkEntries, prevHyphaName, nextHyphaName, hasAmnt)
//line templates/readers.qtpl:72
qs422016 := string(qb422016.B)
//line templates/readers.qtpl:70
//line templates/readers.qtpl:72
qt422016.ReleaseByteBuffer(qb422016)
//line templates/readers.qtpl:70
//line templates/readers.qtpl:72
return qs422016
//line templates/readers.qtpl:70
//line templates/readers.qtpl:72
}

View File

@ -54,12 +54,12 @@ func (m *mainFamilyMember) checkThisChild(hyphaName string) (adopted bool) {
func (m *mainFamilyMember) asHTML() string {
if len(m.children) == 0 {
return fmt.Sprintf(`<li class="navitree__entry navitree__entry_infertile navitree__trunk navitree__trunk_infertile"><a class="navitree__link" href="/hypha/%s">%s</a></li>`, m.name, util.BeautifulName(path.Base(m.name)))
return fmt.Sprintf(`<li class="subhyphae__entry"><a class="subhyphae__link" href="/hypha/%s">%s</a></li>`, m.name, util.BeautifulName(path.Base(m.name)))
}
sort.Slice(m.children, func(i, j int) bool {
return m.children[i].name < m.children[j].name
})
html := fmt.Sprintf(`<li class="navitree__entry navitree__entry_fertile navitree__trunk navitree__trunk_fertile"><a class="navitree__link" href="/hypha/%s">%s</a><ul>`, m.name, util.BeautifulName(path.Base(m.name)))
html := fmt.Sprintf(`<li class="subhyphae__entry"><a class="subhyphae__link" href="/hypha/%s">%s</a><ul>`, m.name, util.BeautifulName(path.Base(m.name)))
for _, child := range m.children {
html += child.asHTML()
}
@ -81,8 +81,20 @@ func mainFamilyFromPool(hyphaName string, subhyphaePool map[string]bool) *mainFa
return &mainFamilyMember{name: hyphaName, children: adopted}
}
func subhyphaeMatrix(hyphaName string, subhyphaePool map[string]bool) string {
var html string
children := mainFamilyFromPool(hyphaName, subhyphaePool).children
sort.Slice(children, func(i, j int) bool {
return children[i].name < children[j].name
})
for _, child := range children {
html += child.asHTML()
}
return html
}
// Tree generates a tree for `hyphaName` as html and returns next and previous hyphae if any.
func Tree(hyphaName string) (html, prev, next string) {
func Tree(hyphaName string) (relatives, subhyphae, prev, next string) {
var (
// One of the siblings is the hypha with name `hyphaName`
siblings = findSiblings(hyphaName)
@ -100,13 +112,10 @@ func Tree(hyphaName string) (html, prev, next string) {
for i, s := range siblings {
if s.name == hyphaName {
I = i
break
relatives += fmt.Sprintf(`<li class="navitree__entry navitree__entry_this"><span>%s</span></li>`, util.BeautifulName(hyphaName))
} else {
relatives += s.asHTML()
}
html += s.asHTML()
}
html += mainFamilyFromPool(hyphaName, subhyphaePool).asHTML()
for _, s := range siblings[I+1:] {
html += s.asHTML()
}
if I != 0 {
prev = siblings[I-1].name
@ -114,7 +123,7 @@ func Tree(hyphaName string) (html, prev, next string) {
if I != len(siblings)-1 {
next = siblings[I+1].name
}
return fmt.Sprintf(`<ul class="navitree">%s</ul>`, html), prev, next
return fmt.Sprintf(`<ul class="navitree">%s</ul>`, relatives), subhyphaeMatrix(hyphaName, subhyphaePool), prev, next
}
func findSiblings(hyphaName string) []*sibling {