1
0
mirror of https://github.com/osmarks/mycorrhiza.git synced 2025-02-10 08:00:12 +00:00

Categories: Localize the categories card

This commit is contained in:
Timur Ismagilov 2022-03-22 16:57:25 +03:00
parent 81c075bfb4
commit 4d56657938
7 changed files with 164 additions and 154 deletions

View File

@ -14,6 +14,10 @@ const categoriesRu = `
{{define "add hypha"}}Добавить в категорию{{end}} {{define "add hypha"}}Добавить в категорию{{end}}
{{define "cat"}}Категория{{end}} {{define "cat"}}Категория{{end}}
{{define "hypha name"}}Имя гифы{{end}} {{define "hypha name"}}Имя гифы{{end}}
{{define "categories"}}Категории{{end}}
{{define "placeholder"}}Имя категории{{end}}
{{define "remove from category title"}}Убрать гифу из этой категории{{end}}
{{define "add to category"}}Добавить гифу в эту категорию{{end}}
` `
var ( var (
@ -30,13 +34,20 @@ func init() {
ParseFS(fs, "categories.html")) ParseFS(fs, "categories.html"))
} }
func categoryCard(hyphaName string) string { func categoryCard(meta Meta, hyphaName string) string {
var buf strings.Builder var buf strings.Builder
t, err := categoryT.Clone() t, err := categoryT.Clone()
if err != nil { if err != nil {
log.Println(err) log.Println(err)
return "" return ""
} }
if meta.Lc.Locale == "ru" {
_, err = t.Parse(categoriesRu)
if err != nil {
log.Println(err)
return ""
}
}
err = t.ExecuteTemplate(&buf, "category card", struct { err = t.ExecuteTemplate(&buf, "category card", struct {
HyphaName string HyphaName string
Categories []string Categories []string

View File

@ -1,7 +1,7 @@
{{define "category card"}} {{define "category card"}}
{{$hyphaName := .HyphaName}} {{$hyphaName := .HyphaName}}
<aside class="layout-card categories-card"> <aside class="layout-card categories-card">
<h2 class="layout-card__title">Categories</h2> <h2 class="layout-card__title">{{block `categories` .}}Categories{{end}}</h2>
<ul class="categories-card__entries"> <ul class="categories-card__entries">
{{range .Categories}} {{range .Categories}}
<li class="categories-card__entry"> <li class="categories-card__entry">
@ -10,16 +10,19 @@
<input type="hidden" name="cat" value="{{.}}"> <input type="hidden" name="cat" value="{{.}}">
<input type="hidden" name="hypha" value="{{$hyphaName}}"> <input type="hidden" name="hypha" value="{{$hyphaName}}">
<input type="hidden" name="redirect-to" value="/hypha/{{$hyphaName}}"> <input type="hidden" name="redirect-to" value="/hypha/{{$hyphaName}}">
<input type="submit" value="x" class="btn categories-card__btn"> <input type="submit" value="x" class="btn categories-card__btn"
title="{{block `remove from category title` .}}Remove the hypha from this category{{end}}">
</form> </form>
</li> </li>
{{end}} {{end}}
<li class="categories-card__entry categories-card__add-to-cat"> <li class="categories-card__entry categories-card__add-to-cat">
<form method="POST" action="/add-to-category" class="categories-card__add-form"> <form method="POST" action="/add-to-category" class="categories-card__add-form">
<input type="text" name="cat" id="_cat-name" placeholder="Category name..."> <input type="text" name="cat" id="_cat-name"
placeholder="{{block `placeholder` .}}Category name...{{end}}">
<input type="hidden" name="hypha" value="{{$hyphaName}}"> <input type="hidden" name="hypha" value="{{$hyphaName}}">
<input type="hidden" name="redirect-to" value="/hypha/{{$hyphaName}}"> <input type="hidden" name="redirect-to" value="/hypha/{{$hyphaName}}">
<input type="submit" class="btn categories-card__btn" value="+"> <input type="submit" class="btn categories-card__btn" value="+"
title="{{block `add to category` .}}Add the hypha to this category{{end}}">
</form> </form>
</li> </li>
</ul> </ul>

View File

@ -1,4 +1,3 @@
{% import "net/http" %}
{% import "strings" %} {% import "strings" %}
{% import "github.com/bouncepaw/mycorrhiza/cfg" %} {% import "github.com/bouncepaw/mycorrhiza/cfg" %}
{% import "github.com/bouncepaw/mycorrhiza/hyphae/backlinks" %} {% import "github.com/bouncepaw/mycorrhiza/hyphae/backlinks" %}
@ -14,10 +13,10 @@
{% endif %} {% endif %}
{% endfunc %} {% endfunc %}
{% func hyphaInfo(rq *http.Request, h hyphae.Hypha) %} {% func hyphaInfo(meta Meta, h hyphae.Hypha) %}
{% code {% code
u := user.FromRequest(rq) u := meta.U
lc := l18n.FromRequest(rq) lc := meta.Lc
backs := backlinks.BacklinksCount(h) backs := backlinks.BacklinksCount(h)
%} %}
<nav class="hypha-info"> <nav class="hypha-info">

View File

@ -5,290 +5,287 @@
package views package views
//line views/nav.qtpl:1 //line views/nav.qtpl:1
import "net/http"
//line views/nav.qtpl:2
import "strings" import "strings"
//line views/nav.qtpl:3 //line views/nav.qtpl:2
import "github.com/bouncepaw/mycorrhiza/cfg" import "github.com/bouncepaw/mycorrhiza/cfg"
//line views/nav.qtpl:4 //line views/nav.qtpl:3
import "github.com/bouncepaw/mycorrhiza/hyphae/backlinks" import "github.com/bouncepaw/mycorrhiza/hyphae/backlinks"
//line views/nav.qtpl:5 //line views/nav.qtpl:4
import "github.com/bouncepaw/mycorrhiza/l18n" import "github.com/bouncepaw/mycorrhiza/l18n"
//line views/nav.qtpl:6 //line views/nav.qtpl:5
import "github.com/bouncepaw/mycorrhiza/user" import "github.com/bouncepaw/mycorrhiza/user"
//line views/nav.qtpl:7 //line views/nav.qtpl:6
import "github.com/bouncepaw/mycorrhiza/hyphae" import "github.com/bouncepaw/mycorrhiza/hyphae"
//line views/nav.qtpl:9 //line views/nav.qtpl:8
import ( import (
qtio422016 "io" qtio422016 "io"
qt422016 "github.com/valyala/quicktemplate" qt422016 "github.com/valyala/quicktemplate"
) )
//line views/nav.qtpl:9 //line views/nav.qtpl:8
var ( var (
_ = qtio422016.Copy _ = qtio422016.Copy
_ = qt422016.AcquireByteBuffer _ = qt422016.AcquireByteBuffer
) )
//line views/nav.qtpl:9 //line views/nav.qtpl:8
func streamhyphaInfoEntry(qw422016 *qt422016.Writer, h hyphae.Hypha, u *user.User, action, displayText string) { func streamhyphaInfoEntry(qw422016 *qt422016.Writer, h hyphae.Hypha, u *user.User, action, displayText string) {
//line views/nav.qtpl:9 //line views/nav.qtpl:8
qw422016.N().S(` qw422016.N().S(`
`) `)
//line views/nav.qtpl:10 //line views/nav.qtpl:9
if u.CanProceed(action) { if u.CanProceed(action) {
//line views/nav.qtpl:10 //line views/nav.qtpl:9
qw422016.N().S(` qw422016.N().S(`
<li class="hypha-info__entry hypha-info__entry_`) <li class="hypha-info__entry hypha-info__entry_`)
//line views/nav.qtpl:11 //line views/nav.qtpl:10
qw422016.E().S(action) qw422016.E().S(action)
//line views/nav.qtpl:11 //line views/nav.qtpl:10
qw422016.N().S(`"> qw422016.N().S(`">
<a class="hypha-info__link" href="/`) <a class="hypha-info__link" href="/`)
//line views/nav.qtpl:12 //line views/nav.qtpl:11
qw422016.E().S(action) qw422016.E().S(action)
//line views/nav.qtpl:12 //line views/nav.qtpl:11
qw422016.N().S(`/`) qw422016.N().S(`/`)
//line views/nav.qtpl:12 //line views/nav.qtpl:11
qw422016.E().S(h.CanonicalName()) qw422016.E().S(h.CanonicalName())
//line views/nav.qtpl:12 //line views/nav.qtpl:11
qw422016.N().S(`">`) qw422016.N().S(`">`)
//line views/nav.qtpl:12 //line views/nav.qtpl:11
qw422016.E().S(displayText) qw422016.E().S(displayText)
//line views/nav.qtpl:12 //line views/nav.qtpl:11
qw422016.N().S(`</a> qw422016.N().S(`</a>
</li> </li>
`) `)
//line views/nav.qtpl:14 //line views/nav.qtpl:13
} }
//line views/nav.qtpl:13
qw422016.N().S(`
`)
//line views/nav.qtpl:14 //line views/nav.qtpl:14
qw422016.N().S(`
`)
//line views/nav.qtpl:15
} }
//line views/nav.qtpl:15 //line views/nav.qtpl:14
func writehyphaInfoEntry(qq422016 qtio422016.Writer, h hyphae.Hypha, u *user.User, action, displayText string) { func writehyphaInfoEntry(qq422016 qtio422016.Writer, h hyphae.Hypha, u *user.User, action, displayText string) {
//line views/nav.qtpl:15 //line views/nav.qtpl:14
qw422016 := qt422016.AcquireWriter(qq422016) qw422016 := qt422016.AcquireWriter(qq422016)
//line views/nav.qtpl:15 //line views/nav.qtpl:14
streamhyphaInfoEntry(qw422016, h, u, action, displayText) streamhyphaInfoEntry(qw422016, h, u, action, displayText)
//line views/nav.qtpl:15 //line views/nav.qtpl:14
qt422016.ReleaseWriter(qw422016) qt422016.ReleaseWriter(qw422016)
//line views/nav.qtpl:15 //line views/nav.qtpl:14
} }
//line views/nav.qtpl:15 //line views/nav.qtpl:14
func hyphaInfoEntry(h hyphae.Hypha, u *user.User, action, displayText string) string { func hyphaInfoEntry(h hyphae.Hypha, u *user.User, action, displayText string) string {
//line views/nav.qtpl:15 //line views/nav.qtpl:14
qb422016 := qt422016.AcquireByteBuffer() qb422016 := qt422016.AcquireByteBuffer()
//line views/nav.qtpl:15 //line views/nav.qtpl:14
writehyphaInfoEntry(qb422016, h, u, action, displayText) writehyphaInfoEntry(qb422016, h, u, action, displayText)
//line views/nav.qtpl:15 //line views/nav.qtpl:14
qs422016 := string(qb422016.B) qs422016 := string(qb422016.B)
//line views/nav.qtpl:15 //line views/nav.qtpl:14
qt422016.ReleaseByteBuffer(qb422016) qt422016.ReleaseByteBuffer(qb422016)
//line views/nav.qtpl:15 //line views/nav.qtpl:14
return qs422016 return qs422016
//line views/nav.qtpl:15 //line views/nav.qtpl:14
} }
//line views/nav.qtpl:17 //line views/nav.qtpl:16
func streamhyphaInfo(qw422016 *qt422016.Writer, rq *http.Request, h hyphae.Hypha) { func streamhyphaInfo(qw422016 *qt422016.Writer, meta Meta, h hyphae.Hypha) {
//line views/nav.qtpl:17 //line views/nav.qtpl:16
qw422016.N().S(` qw422016.N().S(`
`) `)
//line views/nav.qtpl:19 //line views/nav.qtpl:18
u := user.FromRequest(rq) u := meta.U
lc := l18n.FromRequest(rq) lc := meta.Lc
backs := backlinks.BacklinksCount(h) backs := backlinks.BacklinksCount(h)
//line views/nav.qtpl:22 //line views/nav.qtpl:21
qw422016.N().S(` qw422016.N().S(`
<nav class="hypha-info"> <nav class="hypha-info">
<ul class="hypha-info__list"> <ul class="hypha-info__list">
`) `)
//line views/nav.qtpl:25 //line views/nav.qtpl:24
streamhyphaInfoEntry(qw422016, h, u, "history", lc.Get("ui.history_link")) streamhyphaInfoEntry(qw422016, h, u, "history", lc.Get("ui.history_link"))
//line views/nav.qtpl:24
qw422016.N().S(`
`)
//line views/nav.qtpl:25
streamhyphaInfoEntry(qw422016, h, u, "rename", lc.Get("ui.rename_link"))
//line views/nav.qtpl:25 //line views/nav.qtpl:25
qw422016.N().S(` qw422016.N().S(`
`) `)
//line views/nav.qtpl:26 //line views/nav.qtpl:26
streamhyphaInfoEntry(qw422016, h, u, "rename", lc.Get("ui.rename_link")) streamhyphaInfoEntry(qw422016, h, u, "delete", lc.Get("ui.delete_link"))
//line views/nav.qtpl:26 //line views/nav.qtpl:26
qw422016.N().S(` qw422016.N().S(`
`) `)
//line views/nav.qtpl:27 //line views/nav.qtpl:27
streamhyphaInfoEntry(qw422016, h, u, "delete", lc.Get("ui.delete_link")) streamhyphaInfoEntry(qw422016, h, u, "text", lc.Get("ui.text_link"))
//line views/nav.qtpl:27 //line views/nav.qtpl:27
qw422016.N().S(` qw422016.N().S(`
`) `)
//line views/nav.qtpl:28 //line views/nav.qtpl:28
streamhyphaInfoEntry(qw422016, h, u, "text", lc.Get("ui.text_link")) streamhyphaInfoEntry(qw422016, h, u, "media", lc.Get("ui.media_link"))
//line views/nav.qtpl:28 //line views/nav.qtpl:28
qw422016.N().S(` qw422016.N().S(`
`) `)
//line views/nav.qtpl:29 //line views/nav.qtpl:29
streamhyphaInfoEntry(qw422016, h, u, "media", lc.Get("ui.media_link"))
//line views/nav.qtpl:29
qw422016.N().S(`
`)
//line views/nav.qtpl:30
streamhyphaInfoEntry(qw422016, h, u, "backlinks", lc.GetPlural("ui.backlinks_link", backs)) streamhyphaInfoEntry(qw422016, h, u, "backlinks", lc.GetPlural("ui.backlinks_link", backs))
//line views/nav.qtpl:30 //line views/nav.qtpl:29
qw422016.N().S(` qw422016.N().S(`
</ul> </ul>
</nav> </nav>
`) `)
//line views/nav.qtpl:33 //line views/nav.qtpl:32
} }
//line views/nav.qtpl:33 //line views/nav.qtpl:32
func writehyphaInfo(qq422016 qtio422016.Writer, rq *http.Request, h hyphae.Hypha) { func writehyphaInfo(qq422016 qtio422016.Writer, meta Meta, h hyphae.Hypha) {
//line views/nav.qtpl:33 //line views/nav.qtpl:32
qw422016 := qt422016.AcquireWriter(qq422016) qw422016 := qt422016.AcquireWriter(qq422016)
//line views/nav.qtpl:33 //line views/nav.qtpl:32
streamhyphaInfo(qw422016, rq, h) streamhyphaInfo(qw422016, meta, h)
//line views/nav.qtpl:33 //line views/nav.qtpl:32
qt422016.ReleaseWriter(qw422016) qt422016.ReleaseWriter(qw422016)
//line views/nav.qtpl:33 //line views/nav.qtpl:32
} }
//line views/nav.qtpl:33 //line views/nav.qtpl:32
func hyphaInfo(rq *http.Request, h hyphae.Hypha) string { func hyphaInfo(meta Meta, h hyphae.Hypha) string {
//line views/nav.qtpl:33 //line views/nav.qtpl:32
qb422016 := qt422016.AcquireByteBuffer() qb422016 := qt422016.AcquireByteBuffer()
//line views/nav.qtpl:33 //line views/nav.qtpl:32
writehyphaInfo(qb422016, rq, h) writehyphaInfo(qb422016, meta, h)
//line views/nav.qtpl:33 //line views/nav.qtpl:32
qs422016 := string(qb422016.B) qs422016 := string(qb422016.B)
//line views/nav.qtpl:33 //line views/nav.qtpl:32
qt422016.ReleaseByteBuffer(qb422016) qt422016.ReleaseByteBuffer(qb422016)
//line views/nav.qtpl:33 //line views/nav.qtpl:32
return qs422016 return qs422016
//line views/nav.qtpl:33 //line views/nav.qtpl:32
} }
//line views/nav.qtpl:35 //line views/nav.qtpl:34
func streamsiblingHyphae(qw422016 *qt422016.Writer, siblings string, lc *l18n.Localizer) { func streamsiblingHyphae(qw422016 *qt422016.Writer, siblings string, lc *l18n.Localizer) {
//line views/nav.qtpl:35 //line views/nav.qtpl:34
qw422016.N().S(` qw422016.N().S(`
`) `)
//line views/nav.qtpl:36 //line views/nav.qtpl:35
if cfg.UseSiblingHyphaeSidebar { if cfg.UseSiblingHyphaeSidebar {
//line views/nav.qtpl:36 //line views/nav.qtpl:35
qw422016.N().S(` qw422016.N().S(`
<aside class="sibling-hyphae layout-card"> <aside class="sibling-hyphae layout-card">
<h2 class="sibling-hyphae__title layout-card__title">`) <h2 class="sibling-hyphae__title layout-card__title">`)
//line views/nav.qtpl:38 //line views/nav.qtpl:37
qw422016.E().S(lc.Get("ui.sibling_hyphae")) qw422016.E().S(lc.Get("ui.sibling_hyphae"))
//line views/nav.qtpl:38 //line views/nav.qtpl:37
qw422016.N().S(`</h2> qw422016.N().S(`</h2>
`) `)
//line views/nav.qtpl:39 //line views/nav.qtpl:38
qw422016.N().S(siblings) qw422016.N().S(siblings)
//line views/nav.qtpl:39 //line views/nav.qtpl:38
qw422016.N().S(` qw422016.N().S(`
</aside> </aside>
`) `)
//line views/nav.qtpl:41 //line views/nav.qtpl:40
} }
//line views/nav.qtpl:40
qw422016.N().S(`
`)
//line views/nav.qtpl:41 //line views/nav.qtpl:41
qw422016.N().S(`
`)
//line views/nav.qtpl:42
} }
//line views/nav.qtpl:42 //line views/nav.qtpl:41
func writesiblingHyphae(qq422016 qtio422016.Writer, siblings string, lc *l18n.Localizer) { func writesiblingHyphae(qq422016 qtio422016.Writer, siblings string, lc *l18n.Localizer) {
//line views/nav.qtpl:42 //line views/nav.qtpl:41
qw422016 := qt422016.AcquireWriter(qq422016) qw422016 := qt422016.AcquireWriter(qq422016)
//line views/nav.qtpl:42 //line views/nav.qtpl:41
streamsiblingHyphae(qw422016, siblings, lc) streamsiblingHyphae(qw422016, siblings, lc)
//line views/nav.qtpl:42 //line views/nav.qtpl:41
qt422016.ReleaseWriter(qw422016) qt422016.ReleaseWriter(qw422016)
//line views/nav.qtpl:42 //line views/nav.qtpl:41
} }
//line views/nav.qtpl:42 //line views/nav.qtpl:41
func siblingHyphae(siblings string, lc *l18n.Localizer) string { func siblingHyphae(siblings string, lc *l18n.Localizer) string {
//line views/nav.qtpl:42 //line views/nav.qtpl:41
qb422016 := qt422016.AcquireByteBuffer() qb422016 := qt422016.AcquireByteBuffer()
//line views/nav.qtpl:42 //line views/nav.qtpl:41
writesiblingHyphae(qb422016, siblings, lc) writesiblingHyphae(qb422016, siblings, lc)
//line views/nav.qtpl:42 //line views/nav.qtpl:41
qs422016 := string(qb422016.B) qs422016 := string(qb422016.B)
//line views/nav.qtpl:42 //line views/nav.qtpl:41
qt422016.ReleaseByteBuffer(qb422016) qt422016.ReleaseByteBuffer(qb422016)
//line views/nav.qtpl:42 //line views/nav.qtpl:41
return qs422016 return qs422016
//line views/nav.qtpl:42 //line views/nav.qtpl:41
} }
//line views/nav.qtpl:44 //line views/nav.qtpl:43
func StreamSubhyphae(qw422016 *qt422016.Writer, subhyphae string, lc *l18n.Localizer) { func StreamSubhyphae(qw422016 *qt422016.Writer, subhyphae string, lc *l18n.Localizer) {
//line views/nav.qtpl:44 //line views/nav.qtpl:43
qw422016.N().S(` qw422016.N().S(`
`) `)
//line views/nav.qtpl:45 //line views/nav.qtpl:44
if strings.TrimSpace(subhyphae) != "" { if strings.TrimSpace(subhyphae) != "" {
//line views/nav.qtpl:45 //line views/nav.qtpl:44
qw422016.N().S(` qw422016.N().S(`
<section class="subhyphae"> <section class="subhyphae">
<h2 class="subhyphae__title">`) <h2 class="subhyphae__title">`)
//line views/nav.qtpl:47 //line views/nav.qtpl:46
qw422016.E().S(lc.Get("ui.subhyphae")) qw422016.E().S(lc.Get("ui.subhyphae"))
//line views/nav.qtpl:47 //line views/nav.qtpl:46
qw422016.N().S(`</h2> qw422016.N().S(`</h2>
<nav class="subhyphae__nav"> <nav class="subhyphae__nav">
<ul class="subhyphae__list"> <ul class="subhyphae__list">
`) `)
//line views/nav.qtpl:50 //line views/nav.qtpl:49
qw422016.N().S(subhyphae) qw422016.N().S(subhyphae)
//line views/nav.qtpl:50 //line views/nav.qtpl:49
qw422016.N().S(` qw422016.N().S(`
</ul> </ul>
</nav> </nav>
</section> </section>
`) `)
//line views/nav.qtpl:54 //line views/nav.qtpl:53
} }
//line views/nav.qtpl:54 //line views/nav.qtpl:53
qw422016.N().S(` qw422016.N().S(`
`) `)
//line views/nav.qtpl:55 //line views/nav.qtpl:54
} }
//line views/nav.qtpl:55 //line views/nav.qtpl:54
func WriteSubhyphae(qq422016 qtio422016.Writer, subhyphae string, lc *l18n.Localizer) { func WriteSubhyphae(qq422016 qtio422016.Writer, subhyphae string, lc *l18n.Localizer) {
//line views/nav.qtpl:55 //line views/nav.qtpl:54
qw422016 := qt422016.AcquireWriter(qq422016) qw422016 := qt422016.AcquireWriter(qq422016)
//line views/nav.qtpl:55 //line views/nav.qtpl:54
StreamSubhyphae(qw422016, subhyphae, lc) StreamSubhyphae(qw422016, subhyphae, lc)
//line views/nav.qtpl:55 //line views/nav.qtpl:54
qt422016.ReleaseWriter(qw422016) qt422016.ReleaseWriter(qw422016)
//line views/nav.qtpl:55 //line views/nav.qtpl:54
} }
//line views/nav.qtpl:55 //line views/nav.qtpl:54
func Subhyphae(subhyphae string, lc *l18n.Localizer) string { func Subhyphae(subhyphae string, lc *l18n.Localizer) string {
//line views/nav.qtpl:55 //line views/nav.qtpl:54
qb422016 := qt422016.AcquireByteBuffer() qb422016 := qt422016.AcquireByteBuffer()
//line views/nav.qtpl:55 //line views/nav.qtpl:54
WriteSubhyphae(qb422016, subhyphae, lc) WriteSubhyphae(qb422016, subhyphae, lc)
//line views/nav.qtpl:55 //line views/nav.qtpl:54
qs422016 := string(qb422016.B) qs422016 := string(qb422016.B)
//line views/nav.qtpl:55 //line views/nav.qtpl:54
qt422016.ReleaseByteBuffer(qb422016) qt422016.ReleaseByteBuffer(qb422016)
//line views/nav.qtpl:55 //line views/nav.qtpl:54
return qs422016 return qs422016
//line views/nav.qtpl:55 //line views/nav.qtpl:54
} }

View File

@ -85,25 +85,25 @@
If `contents` == "", a helpful message is shown instead. If `contents` == "", a helpful message is shown instead.
If you rename .prevnext, change the docs too. If you rename .prevnext, change the docs too.
{% func Hypha(rq *http.Request, lc *l18n.Localizer, h hyphae.Hypha, contents string) %} {% func Hypha(meta Meta, h hyphae.Hypha, contents string) %}
{% code {% code
siblings, subhyphae, prevHyphaName, nextHyphaName := tree.Tree(h.CanonicalName()) siblings, subhyphae, prevHyphaName, nextHyphaName := tree.Tree(h.CanonicalName())
u := user.FromRequest(rq) lc := meta.Lc
%} %}
<div class="layout"> <div class="layout">
<main class="main-width"> <main class="main-width">
<section id="hypha"> <section id="hypha">
{% if u.CanProceed("edit") %} {% if meta.U.CanProceed("edit") %}
<div class="btn btn_navititle"> <div class="btn btn_navititle">
<a class="btn__link_navititle" href="/edit/{%s h.CanonicalName() %}">{%s lc.Get("ui.edit_link") %}</a> <a class="btn__link_navititle" href="/edit/{%s h.CanonicalName() %}">{%s lc.Get("ui.edit_link") %}</a>
</div> </div>
{% endif %} {% endif %}
{% if cfg.UseAuth && util.IsProfileName(h.CanonicalName()) && u.Name == strings.TrimPrefix(h.CanonicalName(), cfg.UserHypha + "/") %} {% if cfg.UseAuth && util.IsProfileName(h.CanonicalName()) && meta.U.Name == strings.TrimPrefix(h.CanonicalName(), cfg.UserHypha + "/") %}
<div class="btn btn_navititle"> <div class="btn btn_navititle">
<a class="btn__link_navititle" href="/logout">{%s lc.Get("ui.logout_link") %}</a> <a class="btn__link_navititle" href="/logout">{%s lc.Get("ui.logout_link") %}</a>
</div> </div>
{% if u.Group == "admin" %} {% if meta.U.Group == "admin" %}
<div class="btn btn_navititle"> <div class="btn btn_navititle">
<a class="btn__link_navititle" href="/admin">{%s lc.Get("ui.admin_panel") %}<a> <a class="btn__link_navititle" href="/admin">{%s lc.Get("ui.admin_panel") %}<a>
</div> </div>
@ -113,7 +113,7 @@ If you rename .prevnext, change the docs too.
{%s= NaviTitle(h) %} {%s= NaviTitle(h) %}
{% switch h.(type) %} {% switch h.(type) %}
{% case *hyphae.EmptyHypha %} {% case *hyphae.EmptyHypha %}
{%= nonExistentHyphaNotice(h, u, lc) %} {%= nonExistentHyphaNotice(h, meta.U, meta.Lc) %}
{% default %} {% default %}
{%s= contents %} {%s= contents %}
{% endswitch %} {% endswitch %}
@ -126,13 +126,13 @@ If you rename .prevnext, change the docs too.
<a class="prevnext__el prevnext__next" href="/hypha/{%s nextHyphaName %}" rel="next">{%s util.BeautifulName(path.Base(nextHyphaName)) %} →</a> <a class="prevnext__el prevnext__next" href="/hypha/{%s nextHyphaName %}" rel="next">{%s util.BeautifulName(path.Base(nextHyphaName)) %} →</a>
{% endif %} {% endif %}
</section> </section>
{%= Subhyphae(subhyphae, lc) %} {%= Subhyphae(subhyphae, meta.Lc) %}
<section id="hypha-bottom"> <section id="hypha-bottom">
{%= hyphaInfo(rq, h) %} {%= hyphaInfo(meta, h) %}
</section> </section>
</main> </main>
{%s= categoryCard(h.CanonicalName()) %} {%s= categoryCard(meta, h.CanonicalName()) %}
{%= siblingHyphae(siblings, lc) %} {%= siblingHyphae(siblings, meta.Lc) %}
</div> </div>
{%= viewScripts() %} {%= viewScripts() %}
{% endfunc %} {% endfunc %}

View File

@ -311,13 +311,13 @@ func MediaMenu(rq *http.Request, h hyphae.Hypha, u *user.User) string {
// If you rename .prevnext, change the docs too. // If you rename .prevnext, change the docs too.
//line views/readers.qtpl:88 //line views/readers.qtpl:88
func StreamHypha(qw422016 *qt422016.Writer, rq *http.Request, lc *l18n.Localizer, h hyphae.Hypha, contents string) { func StreamHypha(qw422016 *qt422016.Writer, meta Meta, h hyphae.Hypha, contents string) {
//line views/readers.qtpl:88 //line views/readers.qtpl:88
qw422016.N().S(` qw422016.N().S(`
`) `)
//line views/readers.qtpl:90 //line views/readers.qtpl:90
siblings, subhyphae, prevHyphaName, nextHyphaName := tree.Tree(h.CanonicalName()) siblings, subhyphae, prevHyphaName, nextHyphaName := tree.Tree(h.CanonicalName())
u := user.FromRequest(rq) lc := meta.Lc
//line views/readers.qtpl:92 //line views/readers.qtpl:92
qw422016.N().S(` qw422016.N().S(`
@ -326,7 +326,7 @@ func StreamHypha(qw422016 *qt422016.Writer, rq *http.Request, lc *l18n.Localizer
<section id="hypha"> <section id="hypha">
`) `)
//line views/readers.qtpl:96 //line views/readers.qtpl:96
if u.CanProceed("edit") { if meta.U.CanProceed("edit") {
//line views/readers.qtpl:96 //line views/readers.qtpl:96
qw422016.N().S(` qw422016.N().S(`
<div class="btn btn_navititle"> <div class="btn btn_navititle">
@ -348,7 +348,7 @@ func StreamHypha(qw422016 *qt422016.Writer, rq *http.Request, lc *l18n.Localizer
`) `)
//line views/readers.qtpl:102 //line views/readers.qtpl:102
if cfg.UseAuth && util.IsProfileName(h.CanonicalName()) && u.Name == strings.TrimPrefix(h.CanonicalName(), cfg.UserHypha+"/") { if cfg.UseAuth && util.IsProfileName(h.CanonicalName()) && meta.U.Name == strings.TrimPrefix(h.CanonicalName(), cfg.UserHypha+"/") {
//line views/readers.qtpl:102 //line views/readers.qtpl:102
qw422016.N().S(` qw422016.N().S(`
<div class="btn btn_navititle"> <div class="btn btn_navititle">
@ -360,7 +360,7 @@ func StreamHypha(qw422016 *qt422016.Writer, rq *http.Request, lc *l18n.Localizer
</div> </div>
`) `)
//line views/readers.qtpl:106 //line views/readers.qtpl:106
if u.Group == "admin" { if meta.U.Group == "admin" {
//line views/readers.qtpl:106 //line views/readers.qtpl:106
qw422016.N().S(` qw422016.N().S(`
<div class="btn btn_navititle"> <div class="btn btn_navititle">
@ -395,7 +395,7 @@ func StreamHypha(qw422016 *qt422016.Writer, rq *http.Request, lc *l18n.Localizer
qw422016.N().S(` qw422016.N().S(`
`) `)
//line views/readers.qtpl:116 //line views/readers.qtpl:116
streamnonExistentHyphaNotice(qw422016, h, u, lc) streamnonExistentHyphaNotice(qw422016, h, meta.U, meta.Lc)
//line views/readers.qtpl:116 //line views/readers.qtpl:116
qw422016.N().S(` qw422016.N().S(`
`) `)
@ -456,25 +456,25 @@ func StreamHypha(qw422016 *qt422016.Writer, rq *http.Request, lc *l18n.Localizer
</section> </section>
`) `)
//line views/readers.qtpl:129 //line views/readers.qtpl:129
StreamSubhyphae(qw422016, subhyphae, lc) StreamSubhyphae(qw422016, subhyphae, meta.Lc)
//line views/readers.qtpl:129 //line views/readers.qtpl:129
qw422016.N().S(` qw422016.N().S(`
<section id="hypha-bottom"> <section id="hypha-bottom">
`) `)
//line views/readers.qtpl:131 //line views/readers.qtpl:131
streamhyphaInfo(qw422016, rq, h) streamhyphaInfo(qw422016, meta, h)
//line views/readers.qtpl:131 //line views/readers.qtpl:131
qw422016.N().S(` qw422016.N().S(`
</section> </section>
</main> </main>
`) `)
//line views/readers.qtpl:134 //line views/readers.qtpl:134
qw422016.N().S(categoryCard(h.CanonicalName())) qw422016.N().S(categoryCard(meta, h.CanonicalName()))
//line views/readers.qtpl:134 //line views/readers.qtpl:134
qw422016.N().S(` qw422016.N().S(`
`) `)
//line views/readers.qtpl:135 //line views/readers.qtpl:135
streamsiblingHyphae(qw422016, siblings, lc) streamsiblingHyphae(qw422016, siblings, meta.Lc)
//line views/readers.qtpl:135 //line views/readers.qtpl:135
qw422016.N().S(` qw422016.N().S(`
</div> </div>
@ -488,22 +488,22 @@ func StreamHypha(qw422016 *qt422016.Writer, rq *http.Request, lc *l18n.Localizer
} }
//line views/readers.qtpl:138 //line views/readers.qtpl:138
func WriteHypha(qq422016 qtio422016.Writer, rq *http.Request, lc *l18n.Localizer, h hyphae.Hypha, contents string) { func WriteHypha(qq422016 qtio422016.Writer, meta Meta, h hyphae.Hypha, contents string) {
//line views/readers.qtpl:138 //line views/readers.qtpl:138
qw422016 := qt422016.AcquireWriter(qq422016) qw422016 := qt422016.AcquireWriter(qq422016)
//line views/readers.qtpl:138 //line views/readers.qtpl:138
StreamHypha(qw422016, rq, lc, h, contents) StreamHypha(qw422016, meta, h, contents)
//line views/readers.qtpl:138 //line views/readers.qtpl:138
qt422016.ReleaseWriter(qw422016) qt422016.ReleaseWriter(qw422016)
//line views/readers.qtpl:138 //line views/readers.qtpl:138
} }
//line views/readers.qtpl:138 //line views/readers.qtpl:138
func Hypha(rq *http.Request, lc *l18n.Localizer, h hyphae.Hypha, contents string) string { func Hypha(meta Meta, h hyphae.Hypha, contents string) string {
//line views/readers.qtpl:138 //line views/readers.qtpl:138
qb422016 := qt422016.AcquireByteBuffer() qb422016 := qt422016.AcquireByteBuffer()
//line views/readers.qtpl:138 //line views/readers.qtpl:138
WriteHypha(qb422016, rq, lc, h, contents) WriteHypha(qb422016, meta, h, contents)
//line views/readers.qtpl:138 //line views/readers.qtpl:138
qs422016 := string(qb422016.B) qs422016 := string(qb422016.B)
//line views/readers.qtpl:138 //line views/readers.qtpl:138

View File

@ -200,7 +200,7 @@ func handlerHypha(w http.ResponseWriter, rq *http.Request) {
util.HTTP404Page(w, util.HTTP404Page(w,
views.Base( views.Base(
util.BeautifulName(hyphaName), util.BeautifulName(hyphaName),
views.Hypha(rq, lc, h, contents), views.Hypha(views.MetaFrom(w, rq), h, contents),
lc, lc,
u, u,
openGraph)) openGraph))
@ -222,7 +222,7 @@ func handlerHypha(w http.ResponseWriter, rq *http.Request) {
util.HTTP200Page(w, util.HTTP200Page(w,
views.Base( views.Base(
util.BeautifulName(hyphaName), util.BeautifulName(hyphaName),
views.Hypha(rq, lc, h, contents), views.Hypha(views.MetaFrom(w, rq), h, contents),
lc, lc,
u, u,
openGraph)) openGraph))