mirror of
https://github.com/osmarks/mycorrhiza.git
synced 2025-02-09 07:30:11 +00:00
Categories: Localize the categories card
This commit is contained in:
parent
81c075bfb4
commit
4d56657938
@ -14,6 +14,10 @@ const categoriesRu = `
|
||||
{{define "add hypha"}}Добавить в категорию{{end}}
|
||||
{{define "cat"}}Категория{{end}}
|
||||
{{define "hypha name"}}Имя гифы{{end}}
|
||||
{{define "categories"}}Категории{{end}}
|
||||
{{define "placeholder"}}Имя категории{{end}}
|
||||
{{define "remove from category title"}}Убрать гифу из этой категории{{end}}
|
||||
{{define "add to category"}}Добавить гифу в эту категорию{{end}}
|
||||
`
|
||||
|
||||
var (
|
||||
@ -30,13 +34,20 @@ func init() {
|
||||
ParseFS(fs, "categories.html"))
|
||||
}
|
||||
|
||||
func categoryCard(hyphaName string) string {
|
||||
func categoryCard(meta Meta, hyphaName string) string {
|
||||
var buf strings.Builder
|
||||
t, err := categoryT.Clone()
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
return ""
|
||||
}
|
||||
if meta.Lc.Locale == "ru" {
|
||||
_, err = t.Parse(categoriesRu)
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
return ""
|
||||
}
|
||||
}
|
||||
err = t.ExecuteTemplate(&buf, "category card", struct {
|
||||
HyphaName string
|
||||
Categories []string
|
||||
|
@ -1,7 +1,7 @@
|
||||
{{define "category card"}}
|
||||
{{$hyphaName := .HyphaName}}
|
||||
<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">
|
||||
{{range .Categories}}
|
||||
<li class="categories-card__entry">
|
||||
@ -10,16 +10,19 @@
|
||||
<input type="hidden" name="cat" value="{{.}}">
|
||||
<input type="hidden" name="hypha" value="{{$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>
|
||||
</li>
|
||||
{{end}}
|
||||
<li class="categories-card__entry categories-card__add-to-cat">
|
||||
<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="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>
|
||||
</li>
|
||||
</ul>
|
||||
|
@ -1,4 +1,3 @@
|
||||
{% import "net/http" %}
|
||||
{% import "strings" %}
|
||||
{% import "github.com/bouncepaw/mycorrhiza/cfg" %}
|
||||
{% import "github.com/bouncepaw/mycorrhiza/hyphae/backlinks" %}
|
||||
@ -14,10 +13,10 @@
|
||||
{% endif %}
|
||||
{% endfunc %}
|
||||
|
||||
{% func hyphaInfo(rq *http.Request, h hyphae.Hypha) %}
|
||||
{% func hyphaInfo(meta Meta, h hyphae.Hypha) %}
|
||||
{% code
|
||||
u := user.FromRequest(rq)
|
||||
lc := l18n.FromRequest(rq)
|
||||
u := meta.U
|
||||
lc := meta.Lc
|
||||
backs := backlinks.BacklinksCount(h)
|
||||
%}
|
||||
<nav class="hypha-info">
|
||||
|
@ -5,290 +5,287 @@
|
||||
package views
|
||||
|
||||
//line views/nav.qtpl:1
|
||||
import "net/http"
|
||||
|
||||
//line views/nav.qtpl:2
|
||||
import "strings"
|
||||
|
||||
//line views/nav.qtpl:3
|
||||
//line views/nav.qtpl:2
|
||||
import "github.com/bouncepaw/mycorrhiza/cfg"
|
||||
|
||||
//line views/nav.qtpl:4
|
||||
//line views/nav.qtpl:3
|
||||
import "github.com/bouncepaw/mycorrhiza/hyphae/backlinks"
|
||||
|
||||
//line views/nav.qtpl:5
|
||||
//line views/nav.qtpl:4
|
||||
import "github.com/bouncepaw/mycorrhiza/l18n"
|
||||
|
||||
//line views/nav.qtpl:6
|
||||
//line views/nav.qtpl:5
|
||||
import "github.com/bouncepaw/mycorrhiza/user"
|
||||
|
||||
//line views/nav.qtpl:7
|
||||
//line views/nav.qtpl:6
|
||||
import "github.com/bouncepaw/mycorrhiza/hyphae"
|
||||
|
||||
//line views/nav.qtpl:9
|
||||
//line views/nav.qtpl:8
|
||||
import (
|
||||
qtio422016 "io"
|
||||
|
||||
qt422016 "github.com/valyala/quicktemplate"
|
||||
)
|
||||
|
||||
//line views/nav.qtpl:9
|
||||
//line views/nav.qtpl:8
|
||||
var (
|
||||
_ = qtio422016.Copy
|
||||
_ = 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) {
|
||||
//line views/nav.qtpl:9
|
||||
//line views/nav.qtpl:8
|
||||
qw422016.N().S(`
|
||||
`)
|
||||
//line views/nav.qtpl:10
|
||||
//line views/nav.qtpl:9
|
||||
if u.CanProceed(action) {
|
||||
//line views/nav.qtpl:10
|
||||
//line views/nav.qtpl:9
|
||||
qw422016.N().S(`
|
||||
<li class="hypha-info__entry hypha-info__entry_`)
|
||||
//line views/nav.qtpl:11
|
||||
//line views/nav.qtpl:10
|
||||
qw422016.E().S(action)
|
||||
//line views/nav.qtpl:11
|
||||
//line views/nav.qtpl:10
|
||||
qw422016.N().S(`">
|
||||
<a class="hypha-info__link" href="/`)
|
||||
//line views/nav.qtpl:12
|
||||
//line views/nav.qtpl:11
|
||||
qw422016.E().S(action)
|
||||
//line views/nav.qtpl:12
|
||||
//line views/nav.qtpl:11
|
||||
qw422016.N().S(`/`)
|
||||
//line views/nav.qtpl:12
|
||||
//line views/nav.qtpl:11
|
||||
qw422016.E().S(h.CanonicalName())
|
||||
//line views/nav.qtpl:12
|
||||
//line views/nav.qtpl:11
|
||||
qw422016.N().S(`">`)
|
||||
//line views/nav.qtpl:12
|
||||
//line views/nav.qtpl:11
|
||||
qw422016.E().S(displayText)
|
||||
//line views/nav.qtpl:12
|
||||
//line views/nav.qtpl:11
|
||||
qw422016.N().S(`</a>
|
||||
</li>
|
||||
`)
|
||||
//line views/nav.qtpl:14
|
||||
//line views/nav.qtpl:13
|
||||
}
|
||||
//line views/nav.qtpl:13
|
||||
qw422016.N().S(`
|
||||
`)
|
||||
//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) {
|
||||
//line views/nav.qtpl:15
|
||||
//line views/nav.qtpl:14
|
||||
qw422016 := qt422016.AcquireWriter(qq422016)
|
||||
//line views/nav.qtpl:15
|
||||
//line views/nav.qtpl:14
|
||||
streamhyphaInfoEntry(qw422016, h, u, action, displayText)
|
||||
//line views/nav.qtpl:15
|
||||
//line views/nav.qtpl:14
|
||||
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 {
|
||||
//line views/nav.qtpl:15
|
||||
//line views/nav.qtpl:14
|
||||
qb422016 := qt422016.AcquireByteBuffer()
|
||||
//line views/nav.qtpl:15
|
||||
//line views/nav.qtpl:14
|
||||
writehyphaInfoEntry(qb422016, h, u, action, displayText)
|
||||
//line views/nav.qtpl:15
|
||||
//line views/nav.qtpl:14
|
||||
qs422016 := string(qb422016.B)
|
||||
//line views/nav.qtpl:15
|
||||
//line views/nav.qtpl:14
|
||||
qt422016.ReleaseByteBuffer(qb422016)
|
||||
//line views/nav.qtpl:15
|
||||
//line views/nav.qtpl:14
|
||||
return qs422016
|
||||
//line views/nav.qtpl:15
|
||||
//line views/nav.qtpl:14
|
||||
}
|
||||
|
||||
//line views/nav.qtpl:17
|
||||
func streamhyphaInfo(qw422016 *qt422016.Writer, rq *http.Request, h hyphae.Hypha) {
|
||||
//line views/nav.qtpl:17
|
||||
//line views/nav.qtpl:16
|
||||
func streamhyphaInfo(qw422016 *qt422016.Writer, meta Meta, h hyphae.Hypha) {
|
||||
//line views/nav.qtpl:16
|
||||
qw422016.N().S(`
|
||||
`)
|
||||
//line views/nav.qtpl:19
|
||||
u := user.FromRequest(rq)
|
||||
lc := l18n.FromRequest(rq)
|
||||
//line views/nav.qtpl:18
|
||||
u := meta.U
|
||||
lc := meta.Lc
|
||||
backs := backlinks.BacklinksCount(h)
|
||||
|
||||
//line views/nav.qtpl:22
|
||||
//line views/nav.qtpl:21
|
||||
qw422016.N().S(`
|
||||
<nav class="hypha-info">
|
||||
<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"))
|
||||
//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
|
||||
qw422016.N().S(`
|
||||
`)
|
||||
//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
|
||||
qw422016.N().S(`
|
||||
`)
|
||||
//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
|
||||
qw422016.N().S(`
|
||||
`)
|
||||
//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
|
||||
qw422016.N().S(`
|
||||
`)
|
||||
//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))
|
||||
//line views/nav.qtpl:30
|
||||
//line views/nav.qtpl:29
|
||||
qw422016.N().S(`
|
||||
</ul>
|
||||
</nav>
|
||||
`)
|
||||
//line views/nav.qtpl:33
|
||||
//line views/nav.qtpl:32
|
||||
}
|
||||
|
||||
//line views/nav.qtpl:33
|
||||
func writehyphaInfo(qq422016 qtio422016.Writer, rq *http.Request, h hyphae.Hypha) {
|
||||
//line views/nav.qtpl:33
|
||||
//line views/nav.qtpl:32
|
||||
func writehyphaInfo(qq422016 qtio422016.Writer, meta Meta, h hyphae.Hypha) {
|
||||
//line views/nav.qtpl:32
|
||||
qw422016 := qt422016.AcquireWriter(qq422016)
|
||||
//line views/nav.qtpl:33
|
||||
streamhyphaInfo(qw422016, rq, h)
|
||||
//line views/nav.qtpl:33
|
||||
//line views/nav.qtpl:32
|
||||
streamhyphaInfo(qw422016, meta, h)
|
||||
//line views/nav.qtpl:32
|
||||
qt422016.ReleaseWriter(qw422016)
|
||||
//line views/nav.qtpl:33
|
||||
//line views/nav.qtpl:32
|
||||
}
|
||||
|
||||
//line views/nav.qtpl:33
|
||||
func hyphaInfo(rq *http.Request, h hyphae.Hypha) string {
|
||||
//line views/nav.qtpl:33
|
||||
//line views/nav.qtpl:32
|
||||
func hyphaInfo(meta Meta, h hyphae.Hypha) string {
|
||||
//line views/nav.qtpl:32
|
||||
qb422016 := qt422016.AcquireByteBuffer()
|
||||
//line views/nav.qtpl:33
|
||||
writehyphaInfo(qb422016, rq, h)
|
||||
//line views/nav.qtpl:33
|
||||
//line views/nav.qtpl:32
|
||||
writehyphaInfo(qb422016, meta, h)
|
||||
//line views/nav.qtpl:32
|
||||
qs422016 := string(qb422016.B)
|
||||
//line views/nav.qtpl:33
|
||||
//line views/nav.qtpl:32
|
||||
qt422016.ReleaseByteBuffer(qb422016)
|
||||
//line views/nav.qtpl:33
|
||||
//line views/nav.qtpl:32
|
||||
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) {
|
||||
//line views/nav.qtpl:35
|
||||
//line views/nav.qtpl:34
|
||||
qw422016.N().S(`
|
||||
`)
|
||||
//line views/nav.qtpl:36
|
||||
//line views/nav.qtpl:35
|
||||
if cfg.UseSiblingHyphaeSidebar {
|
||||
//line views/nav.qtpl:36
|
||||
//line views/nav.qtpl:35
|
||||
qw422016.N().S(`
|
||||
<aside class="sibling-hyphae layout-card">
|
||||
<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"))
|
||||
//line views/nav.qtpl:38
|
||||
//line views/nav.qtpl:37
|
||||
qw422016.N().S(`</h2>
|
||||
`)
|
||||
//line views/nav.qtpl:39
|
||||
//line views/nav.qtpl:38
|
||||
qw422016.N().S(siblings)
|
||||
//line views/nav.qtpl:39
|
||||
//line views/nav.qtpl:38
|
||||
qw422016.N().S(`
|
||||
</aside>
|
||||
`)
|
||||
//line views/nav.qtpl:41
|
||||
//line views/nav.qtpl:40
|
||||
}
|
||||
//line views/nav.qtpl:40
|
||||
qw422016.N().S(`
|
||||
`)
|
||||
//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) {
|
||||
//line views/nav.qtpl:42
|
||||
//line views/nav.qtpl:41
|
||||
qw422016 := qt422016.AcquireWriter(qq422016)
|
||||
//line views/nav.qtpl:42
|
||||
//line views/nav.qtpl:41
|
||||
streamsiblingHyphae(qw422016, siblings, lc)
|
||||
//line views/nav.qtpl:42
|
||||
//line views/nav.qtpl:41
|
||||
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 {
|
||||
//line views/nav.qtpl:42
|
||||
//line views/nav.qtpl:41
|
||||
qb422016 := qt422016.AcquireByteBuffer()
|
||||
//line views/nav.qtpl:42
|
||||
//line views/nav.qtpl:41
|
||||
writesiblingHyphae(qb422016, siblings, lc)
|
||||
//line views/nav.qtpl:42
|
||||
//line views/nav.qtpl:41
|
||||
qs422016 := string(qb422016.B)
|
||||
//line views/nav.qtpl:42
|
||||
//line views/nav.qtpl:41
|
||||
qt422016.ReleaseByteBuffer(qb422016)
|
||||
//line views/nav.qtpl:42
|
||||
//line views/nav.qtpl:41
|
||||
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) {
|
||||
//line views/nav.qtpl:44
|
||||
//line views/nav.qtpl:43
|
||||
qw422016.N().S(`
|
||||
`)
|
||||
//line views/nav.qtpl:45
|
||||
//line views/nav.qtpl:44
|
||||
if strings.TrimSpace(subhyphae) != "" {
|
||||
//line views/nav.qtpl:45
|
||||
//line views/nav.qtpl:44
|
||||
qw422016.N().S(`
|
||||
<section class="subhyphae">
|
||||
<h2 class="subhyphae__title">`)
|
||||
//line views/nav.qtpl:47
|
||||
//line views/nav.qtpl:46
|
||||
qw422016.E().S(lc.Get("ui.subhyphae"))
|
||||
//line views/nav.qtpl:47
|
||||
//line views/nav.qtpl:46
|
||||
qw422016.N().S(`</h2>
|
||||
<nav class="subhyphae__nav">
|
||||
<ul class="subhyphae__list">
|
||||
`)
|
||||
//line views/nav.qtpl:50
|
||||
//line views/nav.qtpl:49
|
||||
qw422016.N().S(subhyphae)
|
||||
//line views/nav.qtpl:50
|
||||
//line views/nav.qtpl:49
|
||||
qw422016.N().S(`
|
||||
</ul>
|
||||
</nav>
|
||||
</section>
|
||||
`)
|
||||
//line views/nav.qtpl:54
|
||||
//line views/nav.qtpl:53
|
||||
}
|
||||
//line views/nav.qtpl:54
|
||||
//line views/nav.qtpl:53
|
||||
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) {
|
||||
//line views/nav.qtpl:55
|
||||
//line views/nav.qtpl:54
|
||||
qw422016 := qt422016.AcquireWriter(qq422016)
|
||||
//line views/nav.qtpl:55
|
||||
//line views/nav.qtpl:54
|
||||
StreamSubhyphae(qw422016, subhyphae, lc)
|
||||
//line views/nav.qtpl:55
|
||||
//line views/nav.qtpl:54
|
||||
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 {
|
||||
//line views/nav.qtpl:55
|
||||
//line views/nav.qtpl:54
|
||||
qb422016 := qt422016.AcquireByteBuffer()
|
||||
//line views/nav.qtpl:55
|
||||
//line views/nav.qtpl:54
|
||||
WriteSubhyphae(qb422016, subhyphae, lc)
|
||||
//line views/nav.qtpl:55
|
||||
//line views/nav.qtpl:54
|
||||
qs422016 := string(qb422016.B)
|
||||
//line views/nav.qtpl:55
|
||||
//line views/nav.qtpl:54
|
||||
qt422016.ReleaseByteBuffer(qb422016)
|
||||
//line views/nav.qtpl:55
|
||||
//line views/nav.qtpl:54
|
||||
return qs422016
|
||||
//line views/nav.qtpl:55
|
||||
//line views/nav.qtpl:54
|
||||
}
|
||||
|
@ -85,25 +85,25 @@
|
||||
If `contents` == "", a helpful message is shown instead.
|
||||
|
||||
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
|
||||
siblings, subhyphae, prevHyphaName, nextHyphaName := tree.Tree(h.CanonicalName())
|
||||
u := user.FromRequest(rq)
|
||||
lc := meta.Lc
|
||||
%}
|
||||
<div class="layout">
|
||||
<main class="main-width">
|
||||
<section id="hypha">
|
||||
{% if u.CanProceed("edit") %}
|
||||
{% if meta.U.CanProceed("edit") %}
|
||||
<div class="btn btn_navititle">
|
||||
<a class="btn__link_navititle" href="/edit/{%s h.CanonicalName() %}">{%s lc.Get("ui.edit_link") %}</a>
|
||||
</div>
|
||||
{% 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">
|
||||
<a class="btn__link_navititle" href="/logout">{%s lc.Get("ui.logout_link") %}</a>
|
||||
</div>
|
||||
{% if u.Group == "admin" %}
|
||||
{% if meta.U.Group == "admin" %}
|
||||
<div class="btn btn_navititle">
|
||||
<a class="btn__link_navititle" href="/admin">{%s lc.Get("ui.admin_panel") %}<a>
|
||||
</div>
|
||||
@ -113,7 +113,7 @@ If you rename .prevnext, change the docs too.
|
||||
{%s= NaviTitle(h) %}
|
||||
{% switch h.(type) %}
|
||||
{% case *hyphae.EmptyHypha %}
|
||||
{%= nonExistentHyphaNotice(h, u, lc) %}
|
||||
{%= nonExistentHyphaNotice(h, meta.U, meta.Lc) %}
|
||||
{% default %}
|
||||
{%s= contents %}
|
||||
{% 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>
|
||||
{% endif %}
|
||||
</section>
|
||||
{%= Subhyphae(subhyphae, lc) %}
|
||||
{%= Subhyphae(subhyphae, meta.Lc) %}
|
||||
<section id="hypha-bottom">
|
||||
{%= hyphaInfo(rq, h) %}
|
||||
{%= hyphaInfo(meta, h) %}
|
||||
</section>
|
||||
</main>
|
||||
{%s= categoryCard(h.CanonicalName()) %}
|
||||
{%= siblingHyphae(siblings, lc) %}
|
||||
{%s= categoryCard(meta, h.CanonicalName()) %}
|
||||
{%= siblingHyphae(siblings, meta.Lc) %}
|
||||
</div>
|
||||
{%= viewScripts() %}
|
||||
{% endfunc %}
|
||||
|
@ -311,13 +311,13 @@ func MediaMenu(rq *http.Request, h hyphae.Hypha, u *user.User) string {
|
||||
// If you rename .prevnext, change the docs too.
|
||||
|
||||
//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
|
||||
qw422016.N().S(`
|
||||
`)
|
||||
//line views/readers.qtpl:90
|
||||
siblings, subhyphae, prevHyphaName, nextHyphaName := tree.Tree(h.CanonicalName())
|
||||
u := user.FromRequest(rq)
|
||||
lc := meta.Lc
|
||||
|
||||
//line views/readers.qtpl:92
|
||||
qw422016.N().S(`
|
||||
@ -326,7 +326,7 @@ func StreamHypha(qw422016 *qt422016.Writer, rq *http.Request, lc *l18n.Localizer
|
||||
<section id="hypha">
|
||||
`)
|
||||
//line views/readers.qtpl:96
|
||||
if u.CanProceed("edit") {
|
||||
if meta.U.CanProceed("edit") {
|
||||
//line views/readers.qtpl:96
|
||||
qw422016.N().S(`
|
||||
<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
|
||||
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
|
||||
qw422016.N().S(`
|
||||
<div class="btn btn_navititle">
|
||||
@ -360,7 +360,7 @@ func StreamHypha(qw422016 *qt422016.Writer, rq *http.Request, lc *l18n.Localizer
|
||||
</div>
|
||||
`)
|
||||
//line views/readers.qtpl:106
|
||||
if u.Group == "admin" {
|
||||
if meta.U.Group == "admin" {
|
||||
//line views/readers.qtpl:106
|
||||
qw422016.N().S(`
|
||||
<div class="btn btn_navititle">
|
||||
@ -395,7 +395,7 @@ func StreamHypha(qw422016 *qt422016.Writer, rq *http.Request, lc *l18n.Localizer
|
||||
qw422016.N().S(`
|
||||
`)
|
||||
//line views/readers.qtpl:116
|
||||
streamnonExistentHyphaNotice(qw422016, h, u, lc)
|
||||
streamnonExistentHyphaNotice(qw422016, h, meta.U, meta.Lc)
|
||||
//line views/readers.qtpl:116
|
||||
qw422016.N().S(`
|
||||
`)
|
||||
@ -456,25 +456,25 @@ func StreamHypha(qw422016 *qt422016.Writer, rq *http.Request, lc *l18n.Localizer
|
||||
</section>
|
||||
`)
|
||||
//line views/readers.qtpl:129
|
||||
StreamSubhyphae(qw422016, subhyphae, lc)
|
||||
StreamSubhyphae(qw422016, subhyphae, meta.Lc)
|
||||
//line views/readers.qtpl:129
|
||||
qw422016.N().S(`
|
||||
<section id="hypha-bottom">
|
||||
`)
|
||||
//line views/readers.qtpl:131
|
||||
streamhyphaInfo(qw422016, rq, h)
|
||||
streamhyphaInfo(qw422016, meta, h)
|
||||
//line views/readers.qtpl:131
|
||||
qw422016.N().S(`
|
||||
</section>
|
||||
</main>
|
||||
`)
|
||||
//line views/readers.qtpl:134
|
||||
qw422016.N().S(categoryCard(h.CanonicalName()))
|
||||
qw422016.N().S(categoryCard(meta, h.CanonicalName()))
|
||||
//line views/readers.qtpl:134
|
||||
qw422016.N().S(`
|
||||
`)
|
||||
//line views/readers.qtpl:135
|
||||
streamsiblingHyphae(qw422016, siblings, lc)
|
||||
streamsiblingHyphae(qw422016, siblings, meta.Lc)
|
||||
//line views/readers.qtpl:135
|
||||
qw422016.N().S(`
|
||||
</div>
|
||||
@ -488,22 +488,22 @@ func StreamHypha(qw422016 *qt422016.Writer, rq *http.Request, lc *l18n.Localizer
|
||||
}
|
||||
|
||||
//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
|
||||
qw422016 := qt422016.AcquireWriter(qq422016)
|
||||
//line views/readers.qtpl:138
|
||||
StreamHypha(qw422016, rq, lc, h, contents)
|
||||
StreamHypha(qw422016, meta, h, contents)
|
||||
//line views/readers.qtpl:138
|
||||
qt422016.ReleaseWriter(qw422016)
|
||||
//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
|
||||
qb422016 := qt422016.AcquireByteBuffer()
|
||||
//line views/readers.qtpl:138
|
||||
WriteHypha(qb422016, rq, lc, h, contents)
|
||||
WriteHypha(qb422016, meta, h, contents)
|
||||
//line views/readers.qtpl:138
|
||||
qs422016 := string(qb422016.B)
|
||||
//line views/readers.qtpl:138
|
||||
|
@ -200,7 +200,7 @@ func handlerHypha(w http.ResponseWriter, rq *http.Request) {
|
||||
util.HTTP404Page(w,
|
||||
views.Base(
|
||||
util.BeautifulName(hyphaName),
|
||||
views.Hypha(rq, lc, h, contents),
|
||||
views.Hypha(views.MetaFrom(w, rq), h, contents),
|
||||
lc,
|
||||
u,
|
||||
openGraph))
|
||||
@ -222,7 +222,7 @@ func handlerHypha(w http.ResponseWriter, rq *http.Request) {
|
||||
util.HTTP200Page(w,
|
||||
views.Base(
|
||||
util.BeautifulName(hyphaName),
|
||||
views.Hypha(rq, lc, h, contents),
|
||||
views.Hypha(views.MetaFrom(w, rq), h, contents),
|
||||
lc,
|
||||
u,
|
||||
openGraph))
|
||||
|
Loading…
x
Reference in New Issue
Block a user