mirror of
https://github.com/osmarks/mycorrhiza.git
synced 2024-12-12 21:40:26 +00:00
bd6b46f346
Encapsulate translations, but still use QTPL. Hmm
200 lines
4.9 KiB
Go
200 lines
4.9 KiB
Go
// Code generated by qtc from "user_list.qtpl". DO NOT EDIT.
|
|
// See https://github.com/valyala/quicktemplate for details.
|
|
|
|
//line views/user_list.qtpl:1
|
|
package views
|
|
|
|
//line views/user_list.qtpl:1
|
|
import "github.com/bouncepaw/mycorrhiza/cfg"
|
|
|
|
//line views/user_list.qtpl:2
|
|
import "github.com/bouncepaw/mycorrhiza/l18n"
|
|
|
|
//line views/user_list.qtpl:3
|
|
import "github.com/bouncepaw/mycorrhiza/user"
|
|
|
|
//line views/user_list.qtpl:4
|
|
import "sort"
|
|
|
|
//line views/user_list.qtpl:6
|
|
import (
|
|
qtio422016 "io"
|
|
|
|
qt422016 "github.com/valyala/quicktemplate"
|
|
)
|
|
|
|
//line views/user_list.qtpl:6
|
|
var (
|
|
_ = qtio422016.Copy
|
|
_ = qt422016.AcquireByteBuffer
|
|
)
|
|
|
|
//line views/user_list.qtpl:7
|
|
var hyphaListL10n = map[string]l10nEntry{
|
|
"heading": en("List of users").ru("Список пользователей"),
|
|
"administrators": en("Administrators").ru("Администраторы"),
|
|
"moderators": en("Moderators").ru("Модераторы"),
|
|
"editors": en("Editors").ru("Редакторы"),
|
|
}
|
|
|
|
//line views/user_list.qtpl:15
|
|
func StreamUserListHTML(qw422016 *qt422016.Writer, lc *l18n.Localizer) {
|
|
//line views/user_list.qtpl:15
|
|
qw422016.N().S(`
|
|
<div class="layout">
|
|
<main class="main-width user-list">
|
|
`)
|
|
//line views/user_list.qtpl:19
|
|
var get = func(key string) string {
|
|
return hyphaListL10n[key].get(lc.Locale)
|
|
}
|
|
|
|
var (
|
|
admins = make([]string, 0)
|
|
moderators = make([]string, 0)
|
|
editors = make([]string, 0)
|
|
)
|
|
for u := range user.YieldUsers() {
|
|
switch u.Group {
|
|
// What if we place the users into sorted slices?
|
|
case "admin":
|
|
admins = append(admins, u.Name)
|
|
case "moderator":
|
|
moderators = append(moderators, u.Name)
|
|
case "editor", "trusted":
|
|
editors = append(editors, u.Name)
|
|
}
|
|
}
|
|
sort.Strings(admins)
|
|
sort.Strings(moderators)
|
|
sort.Strings(editors)
|
|
|
|
//line views/user_list.qtpl:42
|
|
qw422016.N().S(`
|
|
<h1>`)
|
|
//line views/user_list.qtpl:43
|
|
qw422016.E().S(get("heading"))
|
|
//line views/user_list.qtpl:43
|
|
qw422016.N().S(`</h1>
|
|
<section>
|
|
<h2>`)
|
|
//line views/user_list.qtpl:45
|
|
qw422016.E().S(get("administrators"))
|
|
//line views/user_list.qtpl:45
|
|
qw422016.N().S(`</h2>
|
|
<ol>`)
|
|
//line views/user_list.qtpl:46
|
|
for _, name := range admins {
|
|
//line views/user_list.qtpl:46
|
|
qw422016.N().S(`
|
|
<li><a href="/hypha/`)
|
|
//line views/user_list.qtpl:47
|
|
qw422016.E().S(cfg.UserHypha)
|
|
//line views/user_list.qtpl:47
|
|
qw422016.N().S(`/`)
|
|
//line views/user_list.qtpl:47
|
|
qw422016.E().S(name)
|
|
//line views/user_list.qtpl:47
|
|
qw422016.N().S(`">`)
|
|
//line views/user_list.qtpl:47
|
|
qw422016.E().S(name)
|
|
//line views/user_list.qtpl:47
|
|
qw422016.N().S(`</a></li>
|
|
`)
|
|
//line views/user_list.qtpl:48
|
|
}
|
|
//line views/user_list.qtpl:48
|
|
qw422016.N().S(`</ol>
|
|
</section>
|
|
<section>
|
|
<h2>`)
|
|
//line views/user_list.qtpl:51
|
|
qw422016.E().S(get("moderators"))
|
|
//line views/user_list.qtpl:51
|
|
qw422016.N().S(`</h2>
|
|
<ol>`)
|
|
//line views/user_list.qtpl:52
|
|
for _, name := range moderators {
|
|
//line views/user_list.qtpl:52
|
|
qw422016.N().S(`
|
|
<li><a href="/hypha/`)
|
|
//line views/user_list.qtpl:53
|
|
qw422016.E().S(cfg.UserHypha)
|
|
//line views/user_list.qtpl:53
|
|
qw422016.N().S(`/`)
|
|
//line views/user_list.qtpl:53
|
|
qw422016.E().S(name)
|
|
//line views/user_list.qtpl:53
|
|
qw422016.N().S(`">`)
|
|
//line views/user_list.qtpl:53
|
|
qw422016.E().S(name)
|
|
//line views/user_list.qtpl:53
|
|
qw422016.N().S(`</a></li>
|
|
`)
|
|
//line views/user_list.qtpl:54
|
|
}
|
|
//line views/user_list.qtpl:54
|
|
qw422016.N().S(`</ol>
|
|
</section>
|
|
<section>
|
|
<h2>`)
|
|
//line views/user_list.qtpl:57
|
|
qw422016.E().S(get("editors"))
|
|
//line views/user_list.qtpl:57
|
|
qw422016.N().S(`</h2>
|
|
<ol>`)
|
|
//line views/user_list.qtpl:58
|
|
for _, name := range editors {
|
|
//line views/user_list.qtpl:58
|
|
qw422016.N().S(`
|
|
<li><a href="/hypha/`)
|
|
//line views/user_list.qtpl:59
|
|
qw422016.E().S(cfg.UserHypha)
|
|
//line views/user_list.qtpl:59
|
|
qw422016.N().S(`/`)
|
|
//line views/user_list.qtpl:59
|
|
qw422016.E().S(name)
|
|
//line views/user_list.qtpl:59
|
|
qw422016.N().S(`">`)
|
|
//line views/user_list.qtpl:59
|
|
qw422016.E().S(name)
|
|
//line views/user_list.qtpl:59
|
|
qw422016.N().S(`</a></li>
|
|
`)
|
|
//line views/user_list.qtpl:60
|
|
}
|
|
//line views/user_list.qtpl:60
|
|
qw422016.N().S(`</ol>
|
|
</section>
|
|
</main>
|
|
</div>
|
|
`)
|
|
//line views/user_list.qtpl:64
|
|
}
|
|
|
|
//line views/user_list.qtpl:64
|
|
func WriteUserListHTML(qq422016 qtio422016.Writer, lc *l18n.Localizer) {
|
|
//line views/user_list.qtpl:64
|
|
qw422016 := qt422016.AcquireWriter(qq422016)
|
|
//line views/user_list.qtpl:64
|
|
StreamUserListHTML(qw422016, lc)
|
|
//line views/user_list.qtpl:64
|
|
qt422016.ReleaseWriter(qw422016)
|
|
//line views/user_list.qtpl:64
|
|
}
|
|
|
|
//line views/user_list.qtpl:64
|
|
func UserListHTML(lc *l18n.Localizer) string {
|
|
//line views/user_list.qtpl:64
|
|
qb422016 := qt422016.AcquireByteBuffer()
|
|
//line views/user_list.qtpl:64
|
|
WriteUserListHTML(qb422016, lc)
|
|
//line views/user_list.qtpl:64
|
|
qs422016 := string(qb422016.B)
|
|
//line views/user_list.qtpl:64
|
|
qt422016.ReleaseByteBuffer(qb422016)
|
|
//line views/user_list.qtpl:64
|
|
return qs422016
|
|
//line views/user_list.qtpl:64
|
|
}
|