mirror of
https://github.com/osmarks/mycorrhiza.git
synced 2025-01-07 18:30:26 +00:00
Admin: Port /admin/ to the new template approach
This commit is contained in:
parent
19d5a9e057
commit
0a273f55f4
@ -1,14 +1,4 @@
|
|||||||
{
|
{
|
||||||
"panel_title": "Administrative functions",
|
|
||||||
"panel_safe": "Safe things",
|
|
||||||
"panel_unsafe": "Dangerous things",
|
|
||||||
"panel_about": "About this wiki",
|
|
||||||
"panel_userlist": "User list",
|
|
||||||
"panel_updateheader": "Update header links",
|
|
||||||
"panel_users": "Manage users",
|
|
||||||
"panel_shutdown": "Shutdown wiki",
|
|
||||||
"panel_reindex": "Reindex hyphae",
|
|
||||||
|
|
||||||
"users_title": "Manage users",
|
"users_title": "Manage users",
|
||||||
"users_create": "Create a new user",
|
"users_create": "Create a new user",
|
||||||
"users_reindex": "Reindex users",
|
"users_reindex": "Reindex users",
|
||||||
|
@ -1,14 +1,4 @@
|
|||||||
{
|
{
|
||||||
"panel_title": "Панель администратора",
|
|
||||||
"panel_safe": "Безопасные действия",
|
|
||||||
"panel_unsafe": "Опасные действия",
|
|
||||||
"panel_about": "Об этой вики",
|
|
||||||
"panel_userlist": "Список пользователей",
|
|
||||||
"panel_updateheader": "Обновить ссылки верхней панели",
|
|
||||||
"panel_users": "Менеджер пользователей",
|
|
||||||
"panel_shutdown": "Отключить вики",
|
|
||||||
"panel_reindex": "Переиндексировать гифы",
|
|
||||||
|
|
||||||
"users_title": "Менеджер пользователей",
|
"users_title": "Менеджер пользователей",
|
||||||
"users_create": "Создать пользователя",
|
"users_create": "Создать пользователя",
|
||||||
"users_reindex": "Переиндексировать пользователей",
|
"users_reindex": "Переиндексировать пользователей",
|
||||||
|
74
views/admin.go
Normal file
74
views/admin.go
Normal file
@ -0,0 +1,74 @@
|
|||||||
|
package views
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/bouncepaw/mycorrhiza/util"
|
||||||
|
"html/template"
|
||||||
|
"io"
|
||||||
|
"log"
|
||||||
|
"strings"
|
||||||
|
)
|
||||||
|
|
||||||
|
const adminTranslationRu = `
|
||||||
|
{{define "panel title"}}Панель админстратора{{end}}
|
||||||
|
{{define "panel safe section title"}}Безопасная секция{{end}}
|
||||||
|
{{define "panel link about"}}Об этой вики{{end}}
|
||||||
|
{{define "panel update header"}}Обновить ссылки в верхней панели{{end}}
|
||||||
|
{{define "panel link user list"}}Список пользователей{{end}}
|
||||||
|
{{define "panel users"}}Управление пользователями{{end}}
|
||||||
|
{{define "panel unsafe section title"}}Опасная секция{{end}}
|
||||||
|
{{define "panel shutdown"}}Выключить вики{{end}}
|
||||||
|
{{define "panel reindex hyphae"}}Переиндексировать гифы{{end}}
|
||||||
|
`
|
||||||
|
|
||||||
|
var (
|
||||||
|
adminTemplatesEn *template.Template
|
||||||
|
adminTemplatesRu *template.Template
|
||||||
|
)
|
||||||
|
|
||||||
|
func localizedAdminTemplates(meta Meta) *template.Template {
|
||||||
|
if meta.Lc.Locale == "ru" {
|
||||||
|
return adminTemplatesRu
|
||||||
|
}
|
||||||
|
return adminTemplatesEn
|
||||||
|
}
|
||||||
|
|
||||||
|
func templateAsString(temp *template.Template, name string, datum ...interface{}) string {
|
||||||
|
var buf strings.Builder
|
||||||
|
var err error
|
||||||
|
if len(datum) == 1 {
|
||||||
|
err = temp.ExecuteTemplate(&buf, name, datum[0])
|
||||||
|
} else {
|
||||||
|
err = temp.ExecuteTemplate(&buf, name, nil)
|
||||||
|
}
|
||||||
|
if err != nil {
|
||||||
|
log.Println(err)
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
return buf.String()
|
||||||
|
}
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
adminTemplatesEn = template.Must(
|
||||||
|
template.
|
||||||
|
New("admin").
|
||||||
|
Funcs(template.FuncMap{
|
||||||
|
"beautifulName": util.BeautifulName,
|
||||||
|
}).
|
||||||
|
ParseFS(fs, "admin.html"))
|
||||||
|
adminTemplatesRu = template.Must(
|
||||||
|
template.Must(adminTemplatesEn.Clone()).Parse(adminTranslationRu))
|
||||||
|
}
|
||||||
|
|
||||||
|
func AdminPanel(meta Meta) {
|
||||||
|
var buf strings.Builder
|
||||||
|
err := localizedAdminTemplates(meta).ExecuteTemplate(&buf, "panel", nil)
|
||||||
|
if err != nil {
|
||||||
|
log.Println(err)
|
||||||
|
}
|
||||||
|
_, err = io.WriteString(meta.W, Base(
|
||||||
|
templateAsString(localizedAdminTemplates(meta), "panel title"),
|
||||||
|
buf.String(),
|
||||||
|
meta.Lc,
|
||||||
|
meta.U,
|
||||||
|
))
|
||||||
|
}
|
34
views/admin.html
Normal file
34
views/admin.html
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
{{define "panel title"}}Administrative functions{{end}}
|
||||||
|
{{define "panel"}}
|
||||||
|
<div class="layout">
|
||||||
|
<main class="main-width">
|
||||||
|
<h1>{{template "panel title"}}</h1>
|
||||||
|
<section>
|
||||||
|
<h2>{{block "panel safe section title" .}}Safe section{{end}}</h2>
|
||||||
|
<ul>
|
||||||
|
<li><a href="/about">{{block "panel link about" .}}About this wiki{{end}}</a></li>
|
||||||
|
<li><a href="/update-header-links">{{block "panel update header" .}}Reload header links{{end}}</a></li>
|
||||||
|
<li><a href="/user-list">{{block "panel link user list" .}}User list{{end}}</a></li>
|
||||||
|
<li><a href="/admin/users/">{{block "panel users" .}}Manage users{{end}}</a></li>
|
||||||
|
</ul>
|
||||||
|
</section>
|
||||||
|
<section>
|
||||||
|
<h2>{{block "panel unsafe section title" .}}Unsafe section{{end}}</h2>
|
||||||
|
<ul>
|
||||||
|
<li>
|
||||||
|
<form action="/admin/shutdown" method="POST">
|
||||||
|
<label>{{block "panel shutdown" .}}Shutdown wiki{{end}}</label>
|
||||||
|
<input type="submit" class="btn">
|
||||||
|
</form>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<form action="/reindex" method="GET">
|
||||||
|
<label>{{block "panel reindex hyphae" .}}Reindex hyphae{{end}}</label>
|
||||||
|
<input type="submit" class="btn">
|
||||||
|
</form>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</section>
|
||||||
|
</main>
|
||||||
|
</div>
|
||||||
|
{{end}}
|
@ -4,38 +4,6 @@
|
|||||||
{% import "github.com/bouncepaw/mycorrhiza/user" %}
|
{% import "github.com/bouncepaw/mycorrhiza/user" %}
|
||||||
{% import "github.com/bouncepaw/mycorrhiza/util" %}
|
{% import "github.com/bouncepaw/mycorrhiza/util" %}
|
||||||
|
|
||||||
{% func AdminPanel(lc *l18n.Localizer) %}
|
|
||||||
<div class="layout">
|
|
||||||
<main class="main-width">
|
|
||||||
<h1>{%s lc.Get("admin.panel_title") %}</h1>
|
|
||||||
<section>
|
|
||||||
<h2>{%s lc.Get("admin.panel_safe") %}</h2>
|
|
||||||
<ul>
|
|
||||||
<li><a href="/about">{%s lc.Get("admin.panel_about") %}</a></li>
|
|
||||||
<li><a href="/user-list">{%s lc.Get("admin.panel_userlist") %}</a></li>
|
|
||||||
<li><a href="/update-header-links">{%s lc.Get("admin.panel_updateheader") %}</a></li>
|
|
||||||
<li><a href="/admin/users/">{%s lc.Get("admin.panel_users") %}</a></li>
|
|
||||||
</ul>
|
|
||||||
</section>
|
|
||||||
<section>
|
|
||||||
<h2>{%s lc.Get("admin.panel_unsafe") %}</h2>
|
|
||||||
<form action="/admin/shutdown" method="POST" style="float:left">
|
|
||||||
<fieldset>
|
|
||||||
<legend>{%s lc.Get("admin.panel_shutdown") %}</legend>
|
|
||||||
<input type="submit" class="btn">
|
|
||||||
</fieldset>
|
|
||||||
</form>
|
|
||||||
<form action="/reindex" method="GET" style="float:left">
|
|
||||||
<fieldset>
|
|
||||||
<legend>{%s lc.Get("admin.panel_reindex") %}</legend>
|
|
||||||
<input type="submit" class="btn">
|
|
||||||
</fieldset>
|
|
||||||
</form>
|
|
||||||
</section>
|
|
||||||
</main>
|
|
||||||
</div>
|
|
||||||
{% endfunc %}
|
|
||||||
|
|
||||||
{% func AdminUsersPanel(userList []*user.User, lc *l18n.Localizer) %}
|
{% func AdminUsersPanel(userList []*user.User, lc *l18n.Localizer) %}
|
||||||
<div class="layout">
|
<div class="layout">
|
||||||
<main class="main-width">
|
<main class="main-width">
|
||||||
|
@ -33,126 +33,27 @@ var (
|
|||||||
)
|
)
|
||||||
|
|
||||||
//line views/admin.qtpl:7
|
//line views/admin.qtpl:7
|
||||||
func StreamAdminPanel(qw422016 *qt422016.Writer, lc *l18n.Localizer) {
|
func StreamAdminUsersPanel(qw422016 *qt422016.Writer, userList []*user.User, lc *l18n.Localizer) {
|
||||||
//line views/admin.qtpl:7
|
//line views/admin.qtpl:7
|
||||||
qw422016.N().S(`
|
qw422016.N().S(`
|
||||||
<div class="layout">
|
<div class="layout">
|
||||||
<main class="main-width">
|
<main class="main-width">
|
||||||
<h1>`)
|
<h1>`)
|
||||||
//line views/admin.qtpl:10
|
//line views/admin.qtpl:10
|
||||||
qw422016.E().S(lc.Get("admin.panel_title"))
|
|
||||||
//line views/admin.qtpl:10
|
|
||||||
qw422016.N().S(`</h1>
|
|
||||||
<section>
|
|
||||||
<h2>`)
|
|
||||||
//line views/admin.qtpl:12
|
|
||||||
qw422016.E().S(lc.Get("admin.panel_safe"))
|
|
||||||
//line views/admin.qtpl:12
|
|
||||||
qw422016.N().S(`</h2>
|
|
||||||
<ul>
|
|
||||||
<li><a href="/about">`)
|
|
||||||
//line views/admin.qtpl:14
|
|
||||||
qw422016.E().S(lc.Get("admin.panel_about"))
|
|
||||||
//line views/admin.qtpl:14
|
|
||||||
qw422016.N().S(`</a></li>
|
|
||||||
<li><a href="/user-list">`)
|
|
||||||
//line views/admin.qtpl:15
|
|
||||||
qw422016.E().S(lc.Get("admin.panel_userlist"))
|
|
||||||
//line views/admin.qtpl:15
|
|
||||||
qw422016.N().S(`</a></li>
|
|
||||||
<li><a href="/update-header-links">`)
|
|
||||||
//line views/admin.qtpl:16
|
|
||||||
qw422016.E().S(lc.Get("admin.panel_updateheader"))
|
|
||||||
//line views/admin.qtpl:16
|
|
||||||
qw422016.N().S(`</a></li>
|
|
||||||
<li><a href="/admin/users/">`)
|
|
||||||
//line views/admin.qtpl:17
|
|
||||||
qw422016.E().S(lc.Get("admin.panel_users"))
|
|
||||||
//line views/admin.qtpl:17
|
|
||||||
qw422016.N().S(`</a></li>
|
|
||||||
</ul>
|
|
||||||
</section>
|
|
||||||
<section>
|
|
||||||
<h2>`)
|
|
||||||
//line views/admin.qtpl:21
|
|
||||||
qw422016.E().S(lc.Get("admin.panel_unsafe"))
|
|
||||||
//line views/admin.qtpl:21
|
|
||||||
qw422016.N().S(`</h2>
|
|
||||||
<form action="/admin/shutdown" method="POST" style="float:left">
|
|
||||||
<fieldset>
|
|
||||||
<legend>`)
|
|
||||||
//line views/admin.qtpl:24
|
|
||||||
qw422016.E().S(lc.Get("admin.panel_shutdown"))
|
|
||||||
//line views/admin.qtpl:24
|
|
||||||
qw422016.N().S(`</legend>
|
|
||||||
<input type="submit" class="btn">
|
|
||||||
</fieldset>
|
|
||||||
</form>
|
|
||||||
<form action="/reindex" method="GET" style="float:left">
|
|
||||||
<fieldset>
|
|
||||||
<legend>`)
|
|
||||||
//line views/admin.qtpl:30
|
|
||||||
qw422016.E().S(lc.Get("admin.panel_reindex"))
|
|
||||||
//line views/admin.qtpl:30
|
|
||||||
qw422016.N().S(`</legend>
|
|
||||||
<input type="submit" class="btn">
|
|
||||||
</fieldset>
|
|
||||||
</form>
|
|
||||||
</section>
|
|
||||||
</main>
|
|
||||||
</div>
|
|
||||||
`)
|
|
||||||
//line views/admin.qtpl:37
|
|
||||||
}
|
|
||||||
|
|
||||||
//line views/admin.qtpl:37
|
|
||||||
func WriteAdminPanel(qq422016 qtio422016.Writer, lc *l18n.Localizer) {
|
|
||||||
//line views/admin.qtpl:37
|
|
||||||
qw422016 := qt422016.AcquireWriter(qq422016)
|
|
||||||
//line views/admin.qtpl:37
|
|
||||||
StreamAdminPanel(qw422016, lc)
|
|
||||||
//line views/admin.qtpl:37
|
|
||||||
qt422016.ReleaseWriter(qw422016)
|
|
||||||
//line views/admin.qtpl:37
|
|
||||||
}
|
|
||||||
|
|
||||||
//line views/admin.qtpl:37
|
|
||||||
func AdminPanel(lc *l18n.Localizer) string {
|
|
||||||
//line views/admin.qtpl:37
|
|
||||||
qb422016 := qt422016.AcquireByteBuffer()
|
|
||||||
//line views/admin.qtpl:37
|
|
||||||
WriteAdminPanel(qb422016, lc)
|
|
||||||
//line views/admin.qtpl:37
|
|
||||||
qs422016 := string(qb422016.B)
|
|
||||||
//line views/admin.qtpl:37
|
|
||||||
qt422016.ReleaseByteBuffer(qb422016)
|
|
||||||
//line views/admin.qtpl:37
|
|
||||||
return qs422016
|
|
||||||
//line views/admin.qtpl:37
|
|
||||||
}
|
|
||||||
|
|
||||||
//line views/admin.qtpl:39
|
|
||||||
func StreamAdminUsersPanel(qw422016 *qt422016.Writer, userList []*user.User, lc *l18n.Localizer) {
|
|
||||||
//line views/admin.qtpl:39
|
|
||||||
qw422016.N().S(`
|
|
||||||
<div class="layout">
|
|
||||||
<main class="main-width">
|
|
||||||
<h1>`)
|
|
||||||
//line views/admin.qtpl:42
|
|
||||||
qw422016.E().S(lc.Get("admin.users_title"))
|
qw422016.E().S(lc.Get("admin.users_title"))
|
||||||
//line views/admin.qtpl:42
|
//line views/admin.qtpl:10
|
||||||
qw422016.N().S(`</h1>
|
qw422016.N().S(`</h1>
|
||||||
|
|
||||||
<form action="/admin/reindex-users" method="post">
|
<form action="/admin/reindex-users" method="post">
|
||||||
<a class="btn" href="/admin/new-user">`)
|
<a class="btn" href="/admin/new-user">`)
|
||||||
//line views/admin.qtpl:45
|
//line views/admin.qtpl:13
|
||||||
qw422016.E().S(lc.Get("admin.users_create"))
|
qw422016.E().S(lc.Get("admin.users_create"))
|
||||||
//line views/admin.qtpl:45
|
//line views/admin.qtpl:13
|
||||||
qw422016.N().S(`</a>
|
qw422016.N().S(`</a>
|
||||||
<button class="btn" type="submit">`)
|
<button class="btn" type="submit">`)
|
||||||
//line views/admin.qtpl:46
|
//line views/admin.qtpl:14
|
||||||
qw422016.E().S(lc.Get("admin.users_reindex"))
|
qw422016.E().S(lc.Get("admin.users_reindex"))
|
||||||
//line views/admin.qtpl:46
|
//line views/admin.qtpl:14
|
||||||
qw422016.N().S(`</button>
|
qw422016.N().S(`</button>
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
@ -162,245 +63,245 @@ func StreamAdminUsersPanel(qw422016 *qt422016.Writer, userList []*user.User, lc
|
|||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th>`)
|
<th>`)
|
||||||
//line views/admin.qtpl:54
|
//line views/admin.qtpl:22
|
||||||
qw422016.E().S(lc.Get("admin.users_name"))
|
qw422016.E().S(lc.Get("admin.users_name"))
|
||||||
//line views/admin.qtpl:54
|
//line views/admin.qtpl:22
|
||||||
qw422016.N().S(`</th>
|
qw422016.N().S(`</th>
|
||||||
<th>`)
|
<th>`)
|
||||||
//line views/admin.qtpl:55
|
//line views/admin.qtpl:23
|
||||||
qw422016.E().S(lc.Get("admin.users_group"))
|
qw422016.E().S(lc.Get("admin.users_group"))
|
||||||
//line views/admin.qtpl:55
|
//line views/admin.qtpl:23
|
||||||
qw422016.N().S(`</th>
|
qw422016.N().S(`</th>
|
||||||
<th>`)
|
<th>`)
|
||||||
//line views/admin.qtpl:56
|
//line views/admin.qtpl:24
|
||||||
qw422016.E().S(lc.Get("admin.users_registered"))
|
qw422016.E().S(lc.Get("admin.users_registered"))
|
||||||
//line views/admin.qtpl:56
|
//line views/admin.qtpl:24
|
||||||
qw422016.N().S(`</th>
|
qw422016.N().S(`</th>
|
||||||
<th aria-label="`)
|
<th aria-label="`)
|
||||||
//line views/admin.qtpl:57
|
//line views/admin.qtpl:25
|
||||||
qw422016.E().S(lc.Get("admin.users_actions"))
|
qw422016.E().S(lc.Get("admin.users_actions"))
|
||||||
//line views/admin.qtpl:57
|
//line views/admin.qtpl:25
|
||||||
qw422016.N().S(`"></th>
|
qw422016.N().S(`"></th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
`)
|
`)
|
||||||
//line views/admin.qtpl:61
|
//line views/admin.qtpl:29
|
||||||
for _, u := range userList {
|
for _, u := range userList {
|
||||||
//line views/admin.qtpl:61
|
//line views/admin.qtpl:29
|
||||||
qw422016.N().S(`
|
qw422016.N().S(`
|
||||||
<tr>
|
<tr>
|
||||||
<td class="table-cell--fill">
|
<td class="table-cell--fill">
|
||||||
<a href="/hypha/`)
|
<a href="/hypha/`)
|
||||||
//line views/admin.qtpl:64
|
//line views/admin.qtpl:32
|
||||||
qw422016.N().U(cfg.UserHypha)
|
qw422016.N().U(cfg.UserHypha)
|
||||||
//line views/admin.qtpl:64
|
//line views/admin.qtpl:32
|
||||||
qw422016.N().S(`/`)
|
qw422016.N().S(`/`)
|
||||||
//line views/admin.qtpl:64
|
//line views/admin.qtpl:32
|
||||||
qw422016.N().U(u.Name)
|
qw422016.N().U(u.Name)
|
||||||
//line views/admin.qtpl:64
|
//line views/admin.qtpl:32
|
||||||
qw422016.N().S(`">`)
|
qw422016.N().S(`">`)
|
||||||
//line views/admin.qtpl:64
|
//line views/admin.qtpl:32
|
||||||
qw422016.E().S(u.Name)
|
qw422016.E().S(u.Name)
|
||||||
//line views/admin.qtpl:64
|
//line views/admin.qtpl:32
|
||||||
qw422016.N().S(`</a>
|
qw422016.N().S(`</a>
|
||||||
</td>
|
</td>
|
||||||
<td>`)
|
<td>`)
|
||||||
//line views/admin.qtpl:66
|
//line views/admin.qtpl:34
|
||||||
qw422016.E().S(u.Group)
|
qw422016.E().S(u.Group)
|
||||||
//line views/admin.qtpl:66
|
//line views/admin.qtpl:34
|
||||||
qw422016.N().S(`</td>
|
qw422016.N().S(`</td>
|
||||||
<td>
|
<td>
|
||||||
`)
|
`)
|
||||||
//line views/admin.qtpl:68
|
//line views/admin.qtpl:36
|
||||||
if u.RegisteredAt.IsZero() {
|
if u.RegisteredAt.IsZero() {
|
||||||
//line views/admin.qtpl:68
|
//line views/admin.qtpl:36
|
||||||
qw422016.N().S(`
|
qw422016.N().S(`
|
||||||
`)
|
`)
|
||||||
//line views/admin.qtpl:69
|
//line views/admin.qtpl:37
|
||||||
qw422016.E().S(lc.Get("admin.users_notime"))
|
qw422016.E().S(lc.Get("admin.users_notime"))
|
||||||
//line views/admin.qtpl:69
|
//line views/admin.qtpl:37
|
||||||
qw422016.N().S(`
|
qw422016.N().S(`
|
||||||
`)
|
`)
|
||||||
//line views/admin.qtpl:70
|
//line views/admin.qtpl:38
|
||||||
} else {
|
} else {
|
||||||
//line views/admin.qtpl:70
|
//line views/admin.qtpl:38
|
||||||
qw422016.N().S(`
|
qw422016.N().S(`
|
||||||
`)
|
`)
|
||||||
//line views/admin.qtpl:71
|
//line views/admin.qtpl:39
|
||||||
qw422016.E().S(u.RegisteredAt.UTC().Format("2006-01-02 15:04"))
|
qw422016.E().S(u.RegisteredAt.UTC().Format("2006-01-02 15:04"))
|
||||||
//line views/admin.qtpl:71
|
//line views/admin.qtpl:39
|
||||||
qw422016.N().S(`
|
qw422016.N().S(`
|
||||||
`)
|
`)
|
||||||
//line views/admin.qtpl:72
|
//line views/admin.qtpl:40
|
||||||
}
|
}
|
||||||
//line views/admin.qtpl:72
|
//line views/admin.qtpl:40
|
||||||
qw422016.N().S(`
|
qw422016.N().S(`
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<a href="/admin/users/`)
|
<a href="/admin/users/`)
|
||||||
//line views/admin.qtpl:75
|
//line views/admin.qtpl:43
|
||||||
qw422016.N().U(u.Name)
|
qw422016.N().U(u.Name)
|
||||||
//line views/admin.qtpl:75
|
//line views/admin.qtpl:43
|
||||||
qw422016.N().S(`/edit">`)
|
qw422016.N().S(`/edit">`)
|
||||||
//line views/admin.qtpl:75
|
//line views/admin.qtpl:43
|
||||||
qw422016.E().S(lc.Get("admin.users_edit"))
|
qw422016.E().S(lc.Get("admin.users_edit"))
|
||||||
//line views/admin.qtpl:75
|
//line views/admin.qtpl:43
|
||||||
qw422016.N().S(`</a>
|
qw422016.N().S(`</a>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
`)
|
`)
|
||||||
//line views/admin.qtpl:78
|
//line views/admin.qtpl:46
|
||||||
}
|
}
|
||||||
//line views/admin.qtpl:78
|
//line views/admin.qtpl:46
|
||||||
qw422016.N().S(`
|
qw422016.N().S(`
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
</main>
|
</main>
|
||||||
</div>
|
</div>
|
||||||
`)
|
`)
|
||||||
//line views/admin.qtpl:83
|
//line views/admin.qtpl:51
|
||||||
}
|
}
|
||||||
|
|
||||||
//line views/admin.qtpl:83
|
//line views/admin.qtpl:51
|
||||||
func WriteAdminUsersPanel(qq422016 qtio422016.Writer, userList []*user.User, lc *l18n.Localizer) {
|
func WriteAdminUsersPanel(qq422016 qtio422016.Writer, userList []*user.User, lc *l18n.Localizer) {
|
||||||
//line views/admin.qtpl:83
|
//line views/admin.qtpl:51
|
||||||
qw422016 := qt422016.AcquireWriter(qq422016)
|
qw422016 := qt422016.AcquireWriter(qq422016)
|
||||||
//line views/admin.qtpl:83
|
//line views/admin.qtpl:51
|
||||||
StreamAdminUsersPanel(qw422016, userList, lc)
|
StreamAdminUsersPanel(qw422016, userList, lc)
|
||||||
//line views/admin.qtpl:83
|
//line views/admin.qtpl:51
|
||||||
qt422016.ReleaseWriter(qw422016)
|
qt422016.ReleaseWriter(qw422016)
|
||||||
//line views/admin.qtpl:83
|
//line views/admin.qtpl:51
|
||||||
}
|
}
|
||||||
|
|
||||||
//line views/admin.qtpl:83
|
//line views/admin.qtpl:51
|
||||||
func AdminUsersPanel(userList []*user.User, lc *l18n.Localizer) string {
|
func AdminUsersPanel(userList []*user.User, lc *l18n.Localizer) string {
|
||||||
//line views/admin.qtpl:83
|
//line views/admin.qtpl:51
|
||||||
qb422016 := qt422016.AcquireByteBuffer()
|
qb422016 := qt422016.AcquireByteBuffer()
|
||||||
//line views/admin.qtpl:83
|
//line views/admin.qtpl:51
|
||||||
WriteAdminUsersPanel(qb422016, userList, lc)
|
WriteAdminUsersPanel(qb422016, userList, lc)
|
||||||
//line views/admin.qtpl:83
|
//line views/admin.qtpl:51
|
||||||
qs422016 := string(qb422016.B)
|
qs422016 := string(qb422016.B)
|
||||||
//line views/admin.qtpl:83
|
//line views/admin.qtpl:51
|
||||||
qt422016.ReleaseByteBuffer(qb422016)
|
qt422016.ReleaseByteBuffer(qb422016)
|
||||||
//line views/admin.qtpl:83
|
//line views/admin.qtpl:51
|
||||||
return qs422016
|
return qs422016
|
||||||
//line views/admin.qtpl:83
|
//line views/admin.qtpl:51
|
||||||
}
|
}
|
||||||
|
|
||||||
//line views/admin.qtpl:85
|
//line views/admin.qtpl:53
|
||||||
func StreamAdminUserNew(qw422016 *qt422016.Writer, f util.FormData, lc *l18n.Localizer) {
|
func StreamAdminUserNew(qw422016 *qt422016.Writer, f util.FormData, lc *l18n.Localizer) {
|
||||||
//line views/admin.qtpl:85
|
//line views/admin.qtpl:53
|
||||||
qw422016.N().S(`
|
qw422016.N().S(`
|
||||||
<div class="layout">
|
<div class="layout">
|
||||||
<main class="main-width form-wrap">
|
<main class="main-width form-wrap">
|
||||||
<h1>`)
|
<h1>`)
|
||||||
//line views/admin.qtpl:88
|
//line views/admin.qtpl:56
|
||||||
qw422016.E().S(lc.Get("admin.newuser_title"))
|
qw422016.E().S(lc.Get("admin.newuser_title"))
|
||||||
//line views/admin.qtpl:88
|
//line views/admin.qtpl:56
|
||||||
qw422016.N().S(`</h1>
|
qw422016.N().S(`</h1>
|
||||||
|
|
||||||
`)
|
`)
|
||||||
//line views/admin.qtpl:90
|
//line views/admin.qtpl:58
|
||||||
if f.HasError() {
|
if f.HasError() {
|
||||||
//line views/admin.qtpl:90
|
//line views/admin.qtpl:58
|
||||||
qw422016.N().S(`
|
qw422016.N().S(`
|
||||||
<div class="notice notice--error">
|
<div class="notice notice--error">
|
||||||
<strong>`)
|
<strong>`)
|
||||||
//line views/admin.qtpl:92
|
//line views/admin.qtpl:60
|
||||||
qw422016.E().S(lc.Get("ui.error"))
|
qw422016.E().S(lc.Get("ui.error"))
|
||||||
//line views/admin.qtpl:92
|
//line views/admin.qtpl:60
|
||||||
qw422016.N().S(`:</strong>
|
qw422016.N().S(`:</strong>
|
||||||
`)
|
`)
|
||||||
//line views/admin.qtpl:93
|
//line views/admin.qtpl:61
|
||||||
qw422016.E().S(f.Error())
|
qw422016.E().S(f.Error())
|
||||||
//line views/admin.qtpl:93
|
//line views/admin.qtpl:61
|
||||||
qw422016.N().S(`
|
qw422016.N().S(`
|
||||||
</div>
|
</div>
|
||||||
`)
|
`)
|
||||||
//line views/admin.qtpl:95
|
//line views/admin.qtpl:63
|
||||||
}
|
}
|
||||||
//line views/admin.qtpl:95
|
//line views/admin.qtpl:63
|
||||||
qw422016.N().S(`
|
qw422016.N().S(`
|
||||||
|
|
||||||
<form class="form--double" action="" method="post">
|
<form class="form--double" action="" method="post">
|
||||||
<div class="form-field">
|
<div class="form-field">
|
||||||
<label for="name">`)
|
<label for="name">`)
|
||||||
//line views/admin.qtpl:99
|
//line views/admin.qtpl:67
|
||||||
qw422016.E().S(lc.Get("admin.users_name"))
|
qw422016.E().S(lc.Get("admin.users_name"))
|
||||||
//line views/admin.qtpl:99
|
//line views/admin.qtpl:67
|
||||||
qw422016.N().S(`:</label>
|
qw422016.N().S(`:</label>
|
||||||
<input type="text" name="name" id="name" value="`)
|
<input type="text" name="name" id="name" value="`)
|
||||||
//line views/admin.qtpl:100
|
//line views/admin.qtpl:68
|
||||||
qw422016.E().S(f.Get("name"))
|
qw422016.E().S(f.Get("name"))
|
||||||
//line views/admin.qtpl:100
|
//line views/admin.qtpl:68
|
||||||
qw422016.N().S(`" autofocus>
|
qw422016.N().S(`" autofocus>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-field">
|
<div class="form-field">
|
||||||
<label for="password">`)
|
<label for="password">`)
|
||||||
//line views/admin.qtpl:104
|
//line views/admin.qtpl:72
|
||||||
qw422016.E().S(lc.Get("admin.users_password"))
|
qw422016.E().S(lc.Get("admin.users_password"))
|
||||||
//line views/admin.qtpl:104
|
//line views/admin.qtpl:72
|
||||||
qw422016.N().S(`:</label>
|
qw422016.N().S(`:</label>
|
||||||
<input type="password" name="password" id="password" value="`)
|
<input type="password" name="password" id="password" value="`)
|
||||||
//line views/admin.qtpl:105
|
//line views/admin.qtpl:73
|
||||||
qw422016.E().S(f.Get("password"))
|
qw422016.E().S(f.Get("password"))
|
||||||
//line views/admin.qtpl:105
|
//line views/admin.qtpl:73
|
||||||
qw422016.N().S(`">
|
qw422016.N().S(`">
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-field">
|
<div class="form-field">
|
||||||
<label for="group">`)
|
<label for="group">`)
|
||||||
//line views/admin.qtpl:109
|
//line views/admin.qtpl:77
|
||||||
qw422016.E().S(lc.Get("admin.users_group"))
|
qw422016.E().S(lc.Get("admin.users_group"))
|
||||||
//line views/admin.qtpl:109
|
//line views/admin.qtpl:77
|
||||||
qw422016.N().S(`:</label>
|
qw422016.N().S(`:</label>
|
||||||
<select id="group" name="group">
|
<select id="group" name="group">
|
||||||
<option`)
|
<option`)
|
||||||
//line views/admin.qtpl:111
|
//line views/admin.qtpl:79
|
||||||
if f.Get("group") == "anon" {
|
if f.Get("group") == "anon" {
|
||||||
//line views/admin.qtpl:111
|
//line views/admin.qtpl:79
|
||||||
qw422016.N().S(` selected`)
|
qw422016.N().S(` selected`)
|
||||||
//line views/admin.qtpl:111
|
//line views/admin.qtpl:79
|
||||||
}
|
}
|
||||||
//line views/admin.qtpl:111
|
//line views/admin.qtpl:79
|
||||||
qw422016.N().S(`>anon</option>
|
qw422016.N().S(`>anon</option>
|
||||||
<option`)
|
<option`)
|
||||||
//line views/admin.qtpl:112
|
//line views/admin.qtpl:80
|
||||||
if f.Get("group") == "editor" {
|
if f.Get("group") == "editor" {
|
||||||
//line views/admin.qtpl:112
|
//line views/admin.qtpl:80
|
||||||
qw422016.N().S(` selected`)
|
qw422016.N().S(` selected`)
|
||||||
//line views/admin.qtpl:112
|
//line views/admin.qtpl:80
|
||||||
}
|
}
|
||||||
//line views/admin.qtpl:112
|
//line views/admin.qtpl:80
|
||||||
qw422016.N().S(`>editor</option>
|
qw422016.N().S(`>editor</option>
|
||||||
<option`)
|
<option`)
|
||||||
//line views/admin.qtpl:113
|
//line views/admin.qtpl:81
|
||||||
if f.Get("group") == "trusted" {
|
if f.Get("group") == "trusted" {
|
||||||
//line views/admin.qtpl:113
|
//line views/admin.qtpl:81
|
||||||
qw422016.N().S(` selected`)
|
qw422016.N().S(` selected`)
|
||||||
//line views/admin.qtpl:113
|
//line views/admin.qtpl:81
|
||||||
}
|
}
|
||||||
//line views/admin.qtpl:113
|
//line views/admin.qtpl:81
|
||||||
qw422016.N().S(`>trusted</option>
|
qw422016.N().S(`>trusted</option>
|
||||||
<option`)
|
<option`)
|
||||||
//line views/admin.qtpl:114
|
//line views/admin.qtpl:82
|
||||||
if f.Get("group") == "moderator" {
|
if f.Get("group") == "moderator" {
|
||||||
//line views/admin.qtpl:114
|
//line views/admin.qtpl:82
|
||||||
qw422016.N().S(` selected`)
|
qw422016.N().S(` selected`)
|
||||||
//line views/admin.qtpl:114
|
//line views/admin.qtpl:82
|
||||||
}
|
}
|
||||||
//line views/admin.qtpl:114
|
//line views/admin.qtpl:82
|
||||||
qw422016.N().S(`>moderator</option>
|
qw422016.N().S(`>moderator</option>
|
||||||
<option`)
|
<option`)
|
||||||
//line views/admin.qtpl:115
|
//line views/admin.qtpl:83
|
||||||
if f.Get("group") == "admin" {
|
if f.Get("group") == "admin" {
|
||||||
//line views/admin.qtpl:115
|
//line views/admin.qtpl:83
|
||||||
qw422016.N().S(` selected`)
|
qw422016.N().S(` selected`)
|
||||||
//line views/admin.qtpl:115
|
//line views/admin.qtpl:83
|
||||||
}
|
}
|
||||||
//line views/admin.qtpl:115
|
//line views/admin.qtpl:83
|
||||||
qw422016.N().S(`>admin</option>
|
qw422016.N().S(`>admin</option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
@ -408,14 +309,14 @@ func StreamAdminUserNew(qw422016 *qt422016.Writer, f util.FormData, lc *l18n.Loc
|
|||||||
<div class="form-field">
|
<div class="form-field">
|
||||||
<div class="form-field__input">
|
<div class="form-field__input">
|
||||||
<button class="btn" type="submit">`)
|
<button class="btn" type="submit">`)
|
||||||
//line views/admin.qtpl:121
|
//line views/admin.qtpl:89
|
||||||
qw422016.E().S(lc.Get("admin.newuser_create"))
|
qw422016.E().S(lc.Get("admin.newuser_create"))
|
||||||
//line views/admin.qtpl:121
|
//line views/admin.qtpl:89
|
||||||
qw422016.N().S(`</button>
|
qw422016.N().S(`</button>
|
||||||
<a class="btn btn_weak" href="/admin/users/">`)
|
<a class="btn btn_weak" href="/admin/users/">`)
|
||||||
//line views/admin.qtpl:122
|
//line views/admin.qtpl:90
|
||||||
qw422016.E().S(lc.Get("ui.cancel"))
|
qw422016.E().S(lc.Get("ui.cancel"))
|
||||||
//line views/admin.qtpl:122
|
//line views/admin.qtpl:90
|
||||||
qw422016.N().S(`</a>
|
qw422016.N().S(`</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -423,279 +324,279 @@ func StreamAdminUserNew(qw422016 *qt422016.Writer, f util.FormData, lc *l18n.Loc
|
|||||||
</main>
|
</main>
|
||||||
</div>
|
</div>
|
||||||
`)
|
`)
|
||||||
//line views/admin.qtpl:128
|
//line views/admin.qtpl:96
|
||||||
}
|
}
|
||||||
|
|
||||||
//line views/admin.qtpl:128
|
//line views/admin.qtpl:96
|
||||||
func WriteAdminUserNew(qq422016 qtio422016.Writer, f util.FormData, lc *l18n.Localizer) {
|
func WriteAdminUserNew(qq422016 qtio422016.Writer, f util.FormData, lc *l18n.Localizer) {
|
||||||
//line views/admin.qtpl:128
|
//line views/admin.qtpl:96
|
||||||
qw422016 := qt422016.AcquireWriter(qq422016)
|
qw422016 := qt422016.AcquireWriter(qq422016)
|
||||||
//line views/admin.qtpl:128
|
//line views/admin.qtpl:96
|
||||||
StreamAdminUserNew(qw422016, f, lc)
|
StreamAdminUserNew(qw422016, f, lc)
|
||||||
//line views/admin.qtpl:128
|
//line views/admin.qtpl:96
|
||||||
qt422016.ReleaseWriter(qw422016)
|
qt422016.ReleaseWriter(qw422016)
|
||||||
//line views/admin.qtpl:128
|
//line views/admin.qtpl:96
|
||||||
}
|
}
|
||||||
|
|
||||||
//line views/admin.qtpl:128
|
//line views/admin.qtpl:96
|
||||||
func AdminUserNew(f util.FormData, lc *l18n.Localizer) string {
|
func AdminUserNew(f util.FormData, lc *l18n.Localizer) string {
|
||||||
//line views/admin.qtpl:128
|
//line views/admin.qtpl:96
|
||||||
qb422016 := qt422016.AcquireByteBuffer()
|
qb422016 := qt422016.AcquireByteBuffer()
|
||||||
//line views/admin.qtpl:128
|
//line views/admin.qtpl:96
|
||||||
WriteAdminUserNew(qb422016, f, lc)
|
WriteAdminUserNew(qb422016, f, lc)
|
||||||
//line views/admin.qtpl:128
|
//line views/admin.qtpl:96
|
||||||
qs422016 := string(qb422016.B)
|
qs422016 := string(qb422016.B)
|
||||||
//line views/admin.qtpl:128
|
//line views/admin.qtpl:96
|
||||||
qt422016.ReleaseByteBuffer(qb422016)
|
qt422016.ReleaseByteBuffer(qb422016)
|
||||||
//line views/admin.qtpl:128
|
//line views/admin.qtpl:96
|
||||||
return qs422016
|
return qs422016
|
||||||
//line views/admin.qtpl:128
|
//line views/admin.qtpl:96
|
||||||
}
|
}
|
||||||
|
|
||||||
//line views/admin.qtpl:130
|
//line views/admin.qtpl:98
|
||||||
func StreamAdminUserEdit(qw422016 *qt422016.Writer, u *user.User, f util.FormData, lc *l18n.Localizer) {
|
func StreamAdminUserEdit(qw422016 *qt422016.Writer, u *user.User, f util.FormData, lc *l18n.Localizer) {
|
||||||
//line views/admin.qtpl:130
|
//line views/admin.qtpl:98
|
||||||
qw422016.N().S(`
|
qw422016.N().S(`
|
||||||
<div class="layout">
|
<div class="layout">
|
||||||
<main class="main-width form-wrap">
|
<main class="main-width form-wrap">
|
||||||
<h1>
|
<h1>
|
||||||
<a href="/admin/users/">←</a>
|
<a href="/admin/users/">←</a>
|
||||||
`)
|
`)
|
||||||
//line views/admin.qtpl:135
|
//line views/admin.qtpl:103
|
||||||
qw422016.E().S(u.Name)
|
qw422016.E().S(u.Name)
|
||||||
//line views/admin.qtpl:135
|
//line views/admin.qtpl:103
|
||||||
qw422016.N().S(`
|
qw422016.N().S(`
|
||||||
</h1>
|
</h1>
|
||||||
|
|
||||||
<h2>`)
|
<h2>`)
|
||||||
//line views/admin.qtpl:138
|
//line views/admin.qtpl:106
|
||||||
qw422016.E().S(lc.Get("admin.user_group_heading"))
|
qw422016.E().S(lc.Get("admin.user_group_heading"))
|
||||||
//line views/admin.qtpl:138
|
//line views/admin.qtpl:106
|
||||||
qw422016.N().S(`</h2>
|
qw422016.N().S(`</h2>
|
||||||
|
|
||||||
`)
|
`)
|
||||||
//line views/admin.qtpl:140
|
//line views/admin.qtpl:108
|
||||||
if f.HasError() {
|
if f.HasError() {
|
||||||
//line views/admin.qtpl:140
|
//line views/admin.qtpl:108
|
||||||
qw422016.N().S(`
|
qw422016.N().S(`
|
||||||
<div class="notice notice--error">
|
<div class="notice notice--error">
|
||||||
<strong>`)
|
<strong>`)
|
||||||
//line views/admin.qtpl:142
|
//line views/admin.qtpl:110
|
||||||
qw422016.E().S(lc.Get("ui.error"))
|
qw422016.E().S(lc.Get("ui.error"))
|
||||||
//line views/admin.qtpl:142
|
//line views/admin.qtpl:110
|
||||||
qw422016.N().S(`:</strong>
|
qw422016.N().S(`:</strong>
|
||||||
`)
|
`)
|
||||||
//line views/admin.qtpl:143
|
//line views/admin.qtpl:111
|
||||||
qw422016.E().S(f.Error())
|
qw422016.E().S(f.Error())
|
||||||
//line views/admin.qtpl:143
|
//line views/admin.qtpl:111
|
||||||
qw422016.N().S(`
|
qw422016.N().S(`
|
||||||
</div>
|
</div>
|
||||||
`)
|
`)
|
||||||
//line views/admin.qtpl:145
|
//line views/admin.qtpl:113
|
||||||
}
|
}
|
||||||
//line views/admin.qtpl:145
|
//line views/admin.qtpl:113
|
||||||
qw422016.N().S(`
|
qw422016.N().S(`
|
||||||
|
|
||||||
<form action="" method="post">
|
<form action="" method="post">
|
||||||
<div class="form-field">
|
<div class="form-field">
|
||||||
<select id="group" name="group" aria-label="`)
|
<select id="group" name="group" aria-label="`)
|
||||||
//line views/admin.qtpl:149
|
//line views/admin.qtpl:117
|
||||||
qw422016.E().S(lc.Get("admin.users_group"))
|
qw422016.E().S(lc.Get("admin.users_group"))
|
||||||
//line views/admin.qtpl:149
|
//line views/admin.qtpl:117
|
||||||
qw422016.N().S(`">
|
qw422016.N().S(`">
|
||||||
<option`)
|
<option`)
|
||||||
//line views/admin.qtpl:150
|
//line views/admin.qtpl:118
|
||||||
if f.Get("group") == "anon" {
|
if f.Get("group") == "anon" {
|
||||||
//line views/admin.qtpl:150
|
//line views/admin.qtpl:118
|
||||||
qw422016.N().S(` selected`)
|
qw422016.N().S(` selected`)
|
||||||
//line views/admin.qtpl:150
|
//line views/admin.qtpl:118
|
||||||
}
|
}
|
||||||
//line views/admin.qtpl:150
|
//line views/admin.qtpl:118
|
||||||
qw422016.N().S(`>anon</option>
|
qw422016.N().S(`>anon</option>
|
||||||
<option`)
|
<option`)
|
||||||
//line views/admin.qtpl:151
|
//line views/admin.qtpl:119
|
||||||
if f.Get("group") == "editor" {
|
if f.Get("group") == "editor" {
|
||||||
//line views/admin.qtpl:151
|
//line views/admin.qtpl:119
|
||||||
qw422016.N().S(` selected`)
|
qw422016.N().S(` selected`)
|
||||||
//line views/admin.qtpl:151
|
//line views/admin.qtpl:119
|
||||||
}
|
}
|
||||||
//line views/admin.qtpl:151
|
//line views/admin.qtpl:119
|
||||||
qw422016.N().S(`>editor</option>
|
qw422016.N().S(`>editor</option>
|
||||||
<option`)
|
<option`)
|
||||||
//line views/admin.qtpl:152
|
//line views/admin.qtpl:120
|
||||||
if f.Get("group") == "trusted" {
|
if f.Get("group") == "trusted" {
|
||||||
//line views/admin.qtpl:152
|
//line views/admin.qtpl:120
|
||||||
qw422016.N().S(` selected`)
|
qw422016.N().S(` selected`)
|
||||||
//line views/admin.qtpl:152
|
//line views/admin.qtpl:120
|
||||||
}
|
}
|
||||||
//line views/admin.qtpl:152
|
//line views/admin.qtpl:120
|
||||||
qw422016.N().S(`>trusted</option>
|
qw422016.N().S(`>trusted</option>
|
||||||
<option`)
|
<option`)
|
||||||
//line views/admin.qtpl:153
|
//line views/admin.qtpl:121
|
||||||
if f.Get("group") == "moderator" {
|
if f.Get("group") == "moderator" {
|
||||||
//line views/admin.qtpl:153
|
//line views/admin.qtpl:121
|
||||||
qw422016.N().S(` selected`)
|
qw422016.N().S(` selected`)
|
||||||
//line views/admin.qtpl:153
|
//line views/admin.qtpl:121
|
||||||
}
|
}
|
||||||
//line views/admin.qtpl:153
|
//line views/admin.qtpl:121
|
||||||
qw422016.N().S(`>moderator</option>
|
qw422016.N().S(`>moderator</option>
|
||||||
<option`)
|
<option`)
|
||||||
//line views/admin.qtpl:154
|
//line views/admin.qtpl:122
|
||||||
if f.Get("group") == "admin" {
|
if f.Get("group") == "admin" {
|
||||||
//line views/admin.qtpl:154
|
//line views/admin.qtpl:122
|
||||||
qw422016.N().S(` selected`)
|
qw422016.N().S(` selected`)
|
||||||
//line views/admin.qtpl:154
|
//line views/admin.qtpl:122
|
||||||
}
|
}
|
||||||
//line views/admin.qtpl:154
|
//line views/admin.qtpl:122
|
||||||
qw422016.N().S(`>admin</option>
|
qw422016.N().S(`>admin</option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-field">
|
<div class="form-field">
|
||||||
<button class="btn" type="submit">`)
|
<button class="btn" type="submit">`)
|
||||||
//line views/admin.qtpl:159
|
//line views/admin.qtpl:127
|
||||||
qw422016.E().S(lc.Get("admin.user_update"))
|
qw422016.E().S(lc.Get("admin.user_update"))
|
||||||
//line views/admin.qtpl:159
|
//line views/admin.qtpl:127
|
||||||
qw422016.N().S(`</button>
|
qw422016.N().S(`</button>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
<h2>`)
|
<h2>`)
|
||||||
//line views/admin.qtpl:163
|
//line views/admin.qtpl:131
|
||||||
qw422016.E().S(lc.Get("admin.user_delete_heading"))
|
qw422016.E().S(lc.Get("admin.user_delete_heading"))
|
||||||
//line views/admin.qtpl:163
|
//line views/admin.qtpl:131
|
||||||
qw422016.N().S(`</h2>
|
qw422016.N().S(`</h2>
|
||||||
<p>`)
|
<p>`)
|
||||||
//line views/admin.qtpl:164
|
//line views/admin.qtpl:132
|
||||||
qw422016.E().S(lc.Get("admin.user_delete_tip"))
|
qw422016.E().S(lc.Get("admin.user_delete_tip"))
|
||||||
//line views/admin.qtpl:164
|
//line views/admin.qtpl:132
|
||||||
qw422016.N().S(`</p>
|
qw422016.N().S(`</p>
|
||||||
<a class="btn btn_destructive" href="/admin/users/`)
|
<a class="btn btn_destructive" href="/admin/users/`)
|
||||||
//line views/admin.qtpl:165
|
//line views/admin.qtpl:133
|
||||||
qw422016.N().U(u.Name)
|
qw422016.N().U(u.Name)
|
||||||
//line views/admin.qtpl:165
|
//line views/admin.qtpl:133
|
||||||
qw422016.N().S(`/delete">`)
|
qw422016.N().S(`/delete">`)
|
||||||
//line views/admin.qtpl:165
|
//line views/admin.qtpl:133
|
||||||
qw422016.E().S(lc.Get("admin.user_delete"))
|
qw422016.E().S(lc.Get("admin.user_delete"))
|
||||||
//line views/admin.qtpl:165
|
//line views/admin.qtpl:133
|
||||||
qw422016.N().S(`</a>
|
qw422016.N().S(`</a>
|
||||||
</main>
|
</main>
|
||||||
</div>
|
</div>
|
||||||
`)
|
`)
|
||||||
//line views/admin.qtpl:168
|
//line views/admin.qtpl:136
|
||||||
}
|
}
|
||||||
|
|
||||||
//line views/admin.qtpl:168
|
//line views/admin.qtpl:136
|
||||||
func WriteAdminUserEdit(qq422016 qtio422016.Writer, u *user.User, f util.FormData, lc *l18n.Localizer) {
|
func WriteAdminUserEdit(qq422016 qtio422016.Writer, u *user.User, f util.FormData, lc *l18n.Localizer) {
|
||||||
//line views/admin.qtpl:168
|
//line views/admin.qtpl:136
|
||||||
qw422016 := qt422016.AcquireWriter(qq422016)
|
qw422016 := qt422016.AcquireWriter(qq422016)
|
||||||
//line views/admin.qtpl:168
|
//line views/admin.qtpl:136
|
||||||
StreamAdminUserEdit(qw422016, u, f, lc)
|
StreamAdminUserEdit(qw422016, u, f, lc)
|
||||||
//line views/admin.qtpl:168
|
//line views/admin.qtpl:136
|
||||||
qt422016.ReleaseWriter(qw422016)
|
qt422016.ReleaseWriter(qw422016)
|
||||||
//line views/admin.qtpl:168
|
//line views/admin.qtpl:136
|
||||||
}
|
}
|
||||||
|
|
||||||
//line views/admin.qtpl:168
|
//line views/admin.qtpl:136
|
||||||
func AdminUserEdit(u *user.User, f util.FormData, lc *l18n.Localizer) string {
|
func AdminUserEdit(u *user.User, f util.FormData, lc *l18n.Localizer) string {
|
||||||
//line views/admin.qtpl:168
|
//line views/admin.qtpl:136
|
||||||
qb422016 := qt422016.AcquireByteBuffer()
|
qb422016 := qt422016.AcquireByteBuffer()
|
||||||
//line views/admin.qtpl:168
|
//line views/admin.qtpl:136
|
||||||
WriteAdminUserEdit(qb422016, u, f, lc)
|
WriteAdminUserEdit(qb422016, u, f, lc)
|
||||||
//line views/admin.qtpl:168
|
//line views/admin.qtpl:136
|
||||||
qs422016 := string(qb422016.B)
|
qs422016 := string(qb422016.B)
|
||||||
//line views/admin.qtpl:168
|
//line views/admin.qtpl:136
|
||||||
qt422016.ReleaseByteBuffer(qb422016)
|
qt422016.ReleaseByteBuffer(qb422016)
|
||||||
//line views/admin.qtpl:168
|
//line views/admin.qtpl:136
|
||||||
return qs422016
|
return qs422016
|
||||||
//line views/admin.qtpl:168
|
//line views/admin.qtpl:136
|
||||||
}
|
}
|
||||||
|
|
||||||
//line views/admin.qtpl:170
|
//line views/admin.qtpl:138
|
||||||
func StreamAdminUserDelete(qw422016 *qt422016.Writer, u *user.User, f util.FormData, lc *l18n.Localizer) {
|
func StreamAdminUserDelete(qw422016 *qt422016.Writer, u *user.User, f util.FormData, lc *l18n.Localizer) {
|
||||||
//line views/admin.qtpl:170
|
//line views/admin.qtpl:138
|
||||||
qw422016.N().S(`
|
qw422016.N().S(`
|
||||||
<div class="layout">
|
<div class="layout">
|
||||||
<main class="main-width form-wrap">
|
<main class="main-width form-wrap">
|
||||||
<h1>`)
|
<h1>`)
|
||||||
//line views/admin.qtpl:173
|
//line views/admin.qtpl:141
|
||||||
qw422016.E().S(lc.Get("admin.user_delete_heading"))
|
qw422016.E().S(lc.Get("admin.user_delete_heading"))
|
||||||
//line views/admin.qtpl:173
|
//line views/admin.qtpl:141
|
||||||
qw422016.N().S(`</h1>
|
qw422016.N().S(`</h1>
|
||||||
|
|
||||||
`)
|
`)
|
||||||
//line views/admin.qtpl:175
|
//line views/admin.qtpl:143
|
||||||
if f.HasError() {
|
if f.HasError() {
|
||||||
//line views/admin.qtpl:175
|
//line views/admin.qtpl:143
|
||||||
qw422016.N().S(`
|
qw422016.N().S(`
|
||||||
<div class="notice notice--error">
|
<div class="notice notice--error">
|
||||||
<strong>`)
|
<strong>`)
|
||||||
//line views/admin.qtpl:177
|
//line views/admin.qtpl:145
|
||||||
qw422016.E().S(lc.Get("ui.error"))
|
qw422016.E().S(lc.Get("ui.error"))
|
||||||
//line views/admin.qtpl:177
|
//line views/admin.qtpl:145
|
||||||
qw422016.N().S(`:</strong>
|
qw422016.N().S(`:</strong>
|
||||||
`)
|
`)
|
||||||
//line views/admin.qtpl:178
|
//line views/admin.qtpl:146
|
||||||
qw422016.E().S(f.Error())
|
qw422016.E().S(f.Error())
|
||||||
//line views/admin.qtpl:178
|
//line views/admin.qtpl:146
|
||||||
qw422016.N().S(`
|
qw422016.N().S(`
|
||||||
</div>
|
</div>
|
||||||
`)
|
`)
|
||||||
//line views/admin.qtpl:180
|
//line views/admin.qtpl:148
|
||||||
}
|
}
|
||||||
//line views/admin.qtpl:180
|
//line views/admin.qtpl:148
|
||||||
qw422016.N().S(`
|
qw422016.N().S(`
|
||||||
|
|
||||||
<p>`)
|
<p>`)
|
||||||
//line views/admin.qtpl:182
|
//line views/admin.qtpl:150
|
||||||
qw422016.N().S(lc.Get("admin.user_delete_warn", &l18n.Replacements{"name": fmt.Sprintf("<strong>%s</strong>", u.Name)}))
|
qw422016.N().S(lc.Get("admin.user_delete_warn", &l18n.Replacements{"name": fmt.Sprintf("<strong>%s</strong>", u.Name)}))
|
||||||
//line views/admin.qtpl:182
|
//line views/admin.qtpl:150
|
||||||
qw422016.N().S(`</p>
|
qw422016.N().S(`</p>
|
||||||
|
|
||||||
<form action="" method="post">
|
<form action="" method="post">
|
||||||
<button class="btn btn_destructive" type="submit">`)
|
<button class="btn btn_destructive" type="submit">`)
|
||||||
//line views/admin.qtpl:185
|
//line views/admin.qtpl:153
|
||||||
qw422016.E().S(lc.Get("admin.user_delete"))
|
qw422016.E().S(lc.Get("admin.user_delete"))
|
||||||
//line views/admin.qtpl:185
|
//line views/admin.qtpl:153
|
||||||
qw422016.N().S(`</button>
|
qw422016.N().S(`</button>
|
||||||
<a class="btn btn_weak" href="/admin/users/`)
|
<a class="btn btn_weak" href="/admin/users/`)
|
||||||
//line views/admin.qtpl:186
|
//line views/admin.qtpl:154
|
||||||
qw422016.N().U(u.Name)
|
qw422016.N().U(u.Name)
|
||||||
//line views/admin.qtpl:186
|
//line views/admin.qtpl:154
|
||||||
qw422016.N().S(`/edit">`)
|
qw422016.N().S(`/edit">`)
|
||||||
//line views/admin.qtpl:186
|
//line views/admin.qtpl:154
|
||||||
qw422016.E().S(lc.Get("ui.cancel"))
|
qw422016.E().S(lc.Get("ui.cancel"))
|
||||||
//line views/admin.qtpl:186
|
//line views/admin.qtpl:154
|
||||||
qw422016.N().S(`</a>
|
qw422016.N().S(`</a>
|
||||||
</form>
|
</form>
|
||||||
</main>
|
</main>
|
||||||
</div>
|
</div>
|
||||||
`)
|
`)
|
||||||
//line views/admin.qtpl:190
|
//line views/admin.qtpl:158
|
||||||
}
|
}
|
||||||
|
|
||||||
//line views/admin.qtpl:190
|
//line views/admin.qtpl:158
|
||||||
func WriteAdminUserDelete(qq422016 qtio422016.Writer, u *user.User, f util.FormData, lc *l18n.Localizer) {
|
func WriteAdminUserDelete(qq422016 qtio422016.Writer, u *user.User, f util.FormData, lc *l18n.Localizer) {
|
||||||
//line views/admin.qtpl:190
|
//line views/admin.qtpl:158
|
||||||
qw422016 := qt422016.AcquireWriter(qq422016)
|
qw422016 := qt422016.AcquireWriter(qq422016)
|
||||||
//line views/admin.qtpl:190
|
//line views/admin.qtpl:158
|
||||||
StreamAdminUserDelete(qw422016, u, f, lc)
|
StreamAdminUserDelete(qw422016, u, f, lc)
|
||||||
//line views/admin.qtpl:190
|
//line views/admin.qtpl:158
|
||||||
qt422016.ReleaseWriter(qw422016)
|
qt422016.ReleaseWriter(qw422016)
|
||||||
//line views/admin.qtpl:190
|
//line views/admin.qtpl:158
|
||||||
}
|
}
|
||||||
|
|
||||||
//line views/admin.qtpl:190
|
//line views/admin.qtpl:158
|
||||||
func AdminUserDelete(u *user.User, f util.FormData, lc *l18n.Localizer) string {
|
func AdminUserDelete(u *user.User, f util.FormData, lc *l18n.Localizer) string {
|
||||||
//line views/admin.qtpl:190
|
//line views/admin.qtpl:158
|
||||||
qb422016 := qt422016.AcquireByteBuffer()
|
qb422016 := qt422016.AcquireByteBuffer()
|
||||||
//line views/admin.qtpl:190
|
//line views/admin.qtpl:158
|
||||||
WriteAdminUserDelete(qb422016, u, f, lc)
|
WriteAdminUserDelete(qb422016, u, f, lc)
|
||||||
//line views/admin.qtpl:190
|
//line views/admin.qtpl:158
|
||||||
qs422016 := string(qb422016.B)
|
qs422016 := string(qb422016.B)
|
||||||
//line views/admin.qtpl:190
|
//line views/admin.qtpl:158
|
||||||
qt422016.ReleaseByteBuffer(qb422016)
|
qt422016.ReleaseByteBuffer(qb422016)
|
||||||
//line views/admin.qtpl:190
|
//line views/admin.qtpl:158
|
||||||
return qs422016
|
return qs422016
|
||||||
//line views/admin.qtpl:190
|
//line views/admin.qtpl:158
|
||||||
}
|
}
|
||||||
|
@ -39,20 +39,20 @@ func init() {
|
|||||||
categoryTemplatesRu = template.Must(template.Must(categoryTemplatesEn.Clone()).Parse(categoriesRu))
|
categoryTemplatesRu = template.Must(template.Must(categoryTemplatesEn.Clone()).Parse(categoriesRu))
|
||||||
}
|
}
|
||||||
|
|
||||||
func localizedTemplates(meta Meta) *template.Template {
|
func localizedCatTemplates(meta Meta) *template.Template {
|
||||||
if meta.Lc.Locale == "ru" {
|
if meta.Lc.Locale == "ru" {
|
||||||
return categoryTemplatesRu
|
return categoryTemplatesRu
|
||||||
}
|
}
|
||||||
return categoryTemplatesEn
|
return categoryTemplatesEn
|
||||||
}
|
}
|
||||||
|
|
||||||
func localizedTemplateAsString(meta Meta, name string, datum ...interface{}) string {
|
func localizedCatTemplateAsString(meta Meta, name string, datum ...interface{}) string {
|
||||||
var buf strings.Builder
|
var buf strings.Builder
|
||||||
var err error
|
var err error
|
||||||
if len(datum) == 1 {
|
if len(datum) == 1 {
|
||||||
err = localizedTemplates(meta).ExecuteTemplate(&buf, name, datum[0])
|
err = localizedCatTemplates(meta).ExecuteTemplate(&buf, name, datum[0])
|
||||||
} else {
|
} else {
|
||||||
err = localizedTemplates(meta).ExecuteTemplate(&buf, name, nil)
|
err = localizedCatTemplates(meta).ExecuteTemplate(&buf, name, nil)
|
||||||
}
|
}
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Println(err)
|
log.Println(err)
|
||||||
@ -63,7 +63,7 @@ func localizedTemplateAsString(meta Meta, name string, datum ...interface{}) str
|
|||||||
|
|
||||||
func categoryCard(meta Meta, hyphaName string) string {
|
func categoryCard(meta Meta, hyphaName string) string {
|
||||||
var buf strings.Builder
|
var buf strings.Builder
|
||||||
err := localizedTemplates(meta).ExecuteTemplate(&buf, "category card", struct {
|
err := localizedCatTemplates(meta).ExecuteTemplate(&buf, "category card", struct {
|
||||||
HyphaName string
|
HyphaName string
|
||||||
Categories []string
|
Categories []string
|
||||||
}{
|
}{
|
||||||
@ -78,7 +78,7 @@ func categoryCard(meta Meta, hyphaName string) string {
|
|||||||
|
|
||||||
func CategoryPage(meta Meta, catName string) {
|
func CategoryPage(meta Meta, catName string) {
|
||||||
var buf strings.Builder
|
var buf strings.Builder
|
||||||
err := localizedTemplates(meta).ExecuteTemplate(&buf, "category page", struct {
|
err := localizedCatTemplates(meta).ExecuteTemplate(&buf, "category page", struct {
|
||||||
CatName string
|
CatName string
|
||||||
Hyphae []string
|
Hyphae []string
|
||||||
}{
|
}{
|
||||||
@ -89,7 +89,7 @@ func CategoryPage(meta Meta, catName string) {
|
|||||||
log.Println(err)
|
log.Println(err)
|
||||||
}
|
}
|
||||||
_, err = io.WriteString(meta.W, Base(
|
_, err = io.WriteString(meta.W, Base(
|
||||||
localizedTemplateAsString(meta, "category x", catName),
|
localizedCatTemplateAsString(meta, "category x", catName),
|
||||||
buf.String(),
|
buf.String(),
|
||||||
meta.Lc,
|
meta.Lc,
|
||||||
meta.U,
|
meta.U,
|
||||||
@ -101,7 +101,7 @@ func CategoryPage(meta Meta, catName string) {
|
|||||||
|
|
||||||
func CategoryList(meta Meta) {
|
func CategoryList(meta Meta) {
|
||||||
var buf strings.Builder
|
var buf strings.Builder
|
||||||
err := localizedTemplates(meta).ExecuteTemplate(&buf, "category list", struct {
|
err := localizedCatTemplates(meta).ExecuteTemplate(&buf, "category list", struct {
|
||||||
Categories []string
|
Categories []string
|
||||||
}{
|
}{
|
||||||
categories.List(),
|
categories.List(),
|
||||||
@ -110,7 +110,7 @@ func CategoryList(meta Meta) {
|
|||||||
log.Println(err)
|
log.Println(err)
|
||||||
}
|
}
|
||||||
_, err = io.WriteString(meta.W, Base(
|
_, err = io.WriteString(meta.W, Base(
|
||||||
localizedTemplateAsString(meta, "category list heading"),
|
localizedCatTemplateAsString(meta, "category list heading"),
|
||||||
buf.String(),
|
buf.String(),
|
||||||
meta.Lc,
|
meta.Lc,
|
||||||
meta.U,
|
meta.U,
|
||||||
|
@ -33,10 +33,9 @@ func initAdmin(r *mux.Router) {
|
|||||||
|
|
||||||
// handlerAdmin provides the admin panel.
|
// handlerAdmin provides the admin panel.
|
||||||
func handlerAdmin(w http.ResponseWriter, rq *http.Request) {
|
func handlerAdmin(w http.ResponseWriter, rq *http.Request) {
|
||||||
var lc = l18n.FromRequest(rq)
|
|
||||||
w.Header().Set("Content-Type", "text/html;charset=utf-8")
|
w.Header().Set("Content-Type", "text/html;charset=utf-8")
|
||||||
w.WriteHeader(http.StatusOK)
|
w.WriteHeader(http.StatusOK)
|
||||||
io.WriteString(w, views.Base(lc.Get("admin.panel_title"), views.AdminPanel(lc), lc, user.FromRequest(rq)))
|
views.AdminPanel(views.MetaFrom(w, rq))
|
||||||
}
|
}
|
||||||
|
|
||||||
// handlerAdminShutdown kills the wiki.
|
// handlerAdminShutdown kills the wiki.
|
||||||
|
Loading…
Reference in New Issue
Block a user