1
0
mirror of https://github.com/osmarks/mycorrhiza.git synced 2024-12-12 13:30:26 +00:00
mycorrhiza/views/admin.qtpl.go

554 lines
13 KiB
Go
Raw Normal View History

2021-06-29 10:34:36 +00:00
// Code generated by qtc from "admin.qtpl". DO NOT EDIT.
// See https://github.com/valyala/quicktemplate for details.
//line views/admin.qtpl:1
package views
//line views/admin.qtpl:1
2021-06-29 19:26:36 +00:00
import "github.com/bouncepaw/mycorrhiza/cfg"
//line views/admin.qtpl:2
2021-06-29 10:34:36 +00:00
import "github.com/bouncepaw/mycorrhiza/user"
2021-07-02 12:02:42 +00:00
//line views/admin.qtpl:3
import "github.com/bouncepaw/mycorrhiza/util"
//line views/admin.qtpl:5
2021-06-29 10:34:36 +00:00
import (
qtio422016 "io"
qt422016 "github.com/valyala/quicktemplate"
)
2021-07-02 12:02:42 +00:00
//line views/admin.qtpl:5
2021-06-29 10:34:36 +00:00
var (
_ = qtio422016.Copy
_ = qt422016.AcquireByteBuffer
)
2021-07-02 12:02:42 +00:00
//line views/admin.qtpl:5
func StreamAdminPanelHTML(qw422016 *qt422016.Writer) {
2021-07-02 12:02:42 +00:00
//line views/admin.qtpl:5
2021-06-29 10:34:36 +00:00
qw422016.N().S(`
<div class="layout">
<main class="main-width">
<h1>Administrative functions</h1>
<section>
<h2>Safe things</h2>
<ul>
<li><a href="/about">About this wiki</a></li>
<li><a href="/user-list">User list</a></li>
<li><a href="/update-header-links">Update header links</a></li>
2021-06-30 12:56:38 +00:00
<li><a href="/admin/users/">Manage users</a></li>
</ul>
</section>
<section>
<h2>Dangerous things</h2>
<form action="/admin/shutdown" method="POST" style="float:left">
<fieldset>
<legend>Shutdown wiki</legend>
<input type="submit" class="btn">
</fieldset>
</form>
<form action="/reindex" method="GET" style="float:left">
<fieldset>
<legend>Reindex hyphae</legend>
<input type="submit" class="btn">
</fieldset>
</form>
</section>
</main>
</div>
`)
2021-07-02 12:02:42 +00:00
//line views/admin.qtpl:35
}
2021-07-02 12:02:42 +00:00
//line views/admin.qtpl:35
func WriteAdminPanelHTML(qq422016 qtio422016.Writer) {
2021-07-02 12:02:42 +00:00
//line views/admin.qtpl:35
qw422016 := qt422016.AcquireWriter(qq422016)
2021-07-02 12:02:42 +00:00
//line views/admin.qtpl:35
StreamAdminPanelHTML(qw422016)
2021-07-02 12:02:42 +00:00
//line views/admin.qtpl:35
qt422016.ReleaseWriter(qw422016)
2021-07-02 12:02:42 +00:00
//line views/admin.qtpl:35
}
2021-07-02 12:02:42 +00:00
//line views/admin.qtpl:35
func AdminPanelHTML() string {
2021-07-02 12:02:42 +00:00
//line views/admin.qtpl:35
qb422016 := qt422016.AcquireByteBuffer()
2021-07-02 12:02:42 +00:00
//line views/admin.qtpl:35
WriteAdminPanelHTML(qb422016)
2021-07-02 12:02:42 +00:00
//line views/admin.qtpl:35
qs422016 := string(qb422016.B)
2021-07-02 12:02:42 +00:00
//line views/admin.qtpl:35
qt422016.ReleaseByteBuffer(qb422016)
2021-07-02 12:02:42 +00:00
//line views/admin.qtpl:35
return qs422016
2021-07-02 12:02:42 +00:00
//line views/admin.qtpl:35
}
2021-07-02 12:02:42 +00:00
//line views/admin.qtpl:37
func StreamAdminUsersPanelHTML(qw422016 *qt422016.Writer, userList []*user.User) {
2021-07-02 12:02:42 +00:00
//line views/admin.qtpl:37
qw422016.N().S(`
<div class="layout">
2021-06-29 10:34:36 +00:00
<main class="main-width">
<h1>Manage users</h1>
<form action="/admin/reindex-users" method="post">
2021-07-02 12:02:42 +00:00
<a class="btn" href="/admin/user/new">Create a new user</a>
2021-06-30 12:56:38 +00:00
<button class="btn" type="submit">Reindex users</button>
2021-06-29 10:34:36 +00:00
</form>
2021-07-02 12:02:42 +00:00
<br>
2021-06-29 10:34:36 +00:00
2021-06-30 12:56:38 +00:00
<table class="users-table">
2021-06-29 10:34:36 +00:00
<thead>
<tr>
<th>Name</th>
<th>Group</th>
<th>Registered at</th>
2021-06-30 12:56:38 +00:00
<th aria-label="Actions"></th>
2021-06-29 10:34:36 +00:00
</tr>
</thead>
<tbody>
`)
2021-07-02 12:02:42 +00:00
//line views/admin.qtpl:59
2021-06-29 10:34:36 +00:00
for _, u := range userList {
2021-07-02 12:02:42 +00:00
//line views/admin.qtpl:59
2021-06-29 10:34:36 +00:00
qw422016.N().S(`
<tr>
2021-06-30 12:56:38 +00:00
<td class="table-cell--fill">
2021-06-29 19:26:36 +00:00
<a href="/hypha/`)
2021-07-02 12:02:42 +00:00
//line views/admin.qtpl:62
2021-06-30 12:56:38 +00:00
qw422016.N().U(cfg.UserHypha)
2021-07-02 12:02:42 +00:00
//line views/admin.qtpl:62
2021-06-29 19:26:36 +00:00
qw422016.N().S(`/`)
2021-07-02 12:02:42 +00:00
//line views/admin.qtpl:62
2021-06-30 12:56:38 +00:00
qw422016.N().U(u.Name)
2021-07-02 12:02:42 +00:00
//line views/admin.qtpl:62
2021-06-29 19:26:36 +00:00
qw422016.N().S(`">`)
2021-07-02 12:02:42 +00:00
//line views/admin.qtpl:62
2021-06-29 19:26:36 +00:00
qw422016.E().S(u.Name)
2021-07-02 12:02:42 +00:00
//line views/admin.qtpl:62
2021-06-29 19:26:36 +00:00
qw422016.N().S(`</a>
</td>
2021-06-29 10:34:36 +00:00
<td>`)
2021-07-02 12:02:42 +00:00
//line views/admin.qtpl:64
qw422016.E().S(u.Group)
2021-07-02 12:02:42 +00:00
//line views/admin.qtpl:64
2021-06-29 10:34:36 +00:00
qw422016.N().S(`</td>
2021-07-01 08:29:19 +00:00
<td>
`)
2021-07-02 12:02:42 +00:00
//line views/admin.qtpl:66
2021-07-01 08:29:19 +00:00
if u.RegisteredAt.IsZero() {
2021-07-02 12:02:42 +00:00
//line views/admin.qtpl:66
2021-07-01 08:29:19 +00:00
qw422016.N().S(`
unknown
`)
2021-07-02 12:02:42 +00:00
//line views/admin.qtpl:68
2021-07-01 08:29:19 +00:00
} else {
2021-07-02 12:02:42 +00:00
//line views/admin.qtpl:68
2021-07-01 08:29:19 +00:00
qw422016.N().S(`
`)
2021-07-02 12:02:42 +00:00
//line views/admin.qtpl:69
2021-07-01 08:29:19 +00:00
qw422016.E().S(u.RegisteredAt.UTC().Format("2006-01-02 15:04"))
2021-07-02 12:02:42 +00:00
//line views/admin.qtpl:69
2021-07-01 08:29:19 +00:00
qw422016.N().S(`
`)
2021-07-02 12:02:42 +00:00
//line views/admin.qtpl:70
2021-07-01 08:29:19 +00:00
}
2021-07-02 12:02:42 +00:00
//line views/admin.qtpl:70
2021-07-01 08:29:19 +00:00
qw422016.N().S(`
</td>
<td>
<a href="/admin/users/`)
2021-07-02 12:02:42 +00:00
//line views/admin.qtpl:73
qw422016.N().U(u.Name)
2021-07-02 12:02:42 +00:00
//line views/admin.qtpl:73
qw422016.N().S(`/edit">Edit</a>
</td>
2021-06-29 10:34:36 +00:00
</tr>
`)
2021-07-02 12:02:42 +00:00
//line views/admin.qtpl:76
2021-06-29 10:34:36 +00:00
}
2021-07-02 12:02:42 +00:00
//line views/admin.qtpl:76
2021-06-29 10:34:36 +00:00
qw422016.N().S(`
</tbody>
</table>
</main>
</div>
`)
2021-07-02 12:02:42 +00:00
//line views/admin.qtpl:81
2021-06-29 10:34:36 +00:00
}
2021-07-02 12:02:42 +00:00
//line views/admin.qtpl:81
2021-06-29 10:34:36 +00:00
func WriteAdminUsersPanelHTML(qq422016 qtio422016.Writer, userList []*user.User) {
2021-07-02 12:02:42 +00:00
//line views/admin.qtpl:81
2021-06-29 10:34:36 +00:00
qw422016 := qt422016.AcquireWriter(qq422016)
2021-07-02 12:02:42 +00:00
//line views/admin.qtpl:81
2021-06-29 10:34:36 +00:00
StreamAdminUsersPanelHTML(qw422016, userList)
2021-07-02 12:02:42 +00:00
//line views/admin.qtpl:81
2021-06-29 10:34:36 +00:00
qt422016.ReleaseWriter(qw422016)
2021-07-02 12:02:42 +00:00
//line views/admin.qtpl:81
2021-06-29 10:34:36 +00:00
}
2021-07-02 12:02:42 +00:00
//line views/admin.qtpl:81
2021-06-29 10:34:36 +00:00
func AdminUsersPanelHTML(userList []*user.User) string {
2021-07-02 12:02:42 +00:00
//line views/admin.qtpl:81
2021-06-29 10:34:36 +00:00
qb422016 := qt422016.AcquireByteBuffer()
2021-07-02 12:02:42 +00:00
//line views/admin.qtpl:81
2021-06-29 10:34:36 +00:00
WriteAdminUsersPanelHTML(qb422016, userList)
2021-07-02 12:02:42 +00:00
//line views/admin.qtpl:81
qs422016 := string(qb422016.B)
2021-07-02 12:02:42 +00:00
//line views/admin.qtpl:81
qt422016.ReleaseByteBuffer(qb422016)
2021-07-02 12:02:42 +00:00
//line views/admin.qtpl:81
return qs422016
2021-07-02 12:02:42 +00:00
//line views/admin.qtpl:81
}
2021-07-02 12:02:42 +00:00
//line views/admin.qtpl:83
func StreamAdminUserNewHTML(qw422016 *qt422016.Writer, f util.FormData) {
2021-07-02 12:02:42 +00:00
//line views/admin.qtpl:83
qw422016.N().S(`
<div class="layout">
<main class="main-width form-wrap">
2021-07-02 12:02:42 +00:00
<h1>New user</h1>
`)
//line views/admin.qtpl:88
if f.HasError() {
2021-07-02 12:02:42 +00:00
//line views/admin.qtpl:88
qw422016.N().S(`
<div class="notice notice--error">
<strong>Error:</strong>
`)
//line views/admin.qtpl:91
qw422016.E().S(f.Error())
2021-07-02 12:02:42 +00:00
//line views/admin.qtpl:91
qw422016.N().S(`
</div>
`)
//line views/admin.qtpl:93
}
//line views/admin.qtpl:93
qw422016.N().S(`
<form class="form--double" action="" method="post">
2021-07-02 12:02:42 +00:00
<div class="form-field">
<label for="name">Name:</label>
<input type="text" name="name" id="name" value="`)
//line views/admin.qtpl:98
qw422016.E().S(f.Get("name"))
2021-07-02 12:02:42 +00:00
//line views/admin.qtpl:98
qw422016.N().S(`" autofocus>
2021-07-02 12:02:42 +00:00
</div>
<div class="form-field">
<label for="password">Password:</label>
<input type="password" name="password" id="password" value="`)
//line views/admin.qtpl:103
qw422016.E().S(f.Get("password"))
2021-07-02 12:02:42 +00:00
//line views/admin.qtpl:103
qw422016.N().S(`">
</div>
<div class="form-field">
<label for="group">Group:</label>
<select id="group" name="group">
<option`)
//line views/admin.qtpl:109
if f.Get("group") == "anon" {
2021-07-02 12:02:42 +00:00
//line views/admin.qtpl:109
qw422016.N().S(` selected`)
//line views/admin.qtpl:109
}
//line views/admin.qtpl:109
qw422016.N().S(`>anon</option>
<option`)
//line views/admin.qtpl:110
if f.Get("group") == "editor" {
2021-07-02 12:02:42 +00:00
//line views/admin.qtpl:110
qw422016.N().S(` selected`)
//line views/admin.qtpl:110
}
//line views/admin.qtpl:110
qw422016.N().S(`>editor</option>
<option`)
//line views/admin.qtpl:111
if f.Get("group") == "trusted" {
2021-07-02 12:02:42 +00:00
//line views/admin.qtpl:111
qw422016.N().S(` selected`)
//line views/admin.qtpl:111
}
//line views/admin.qtpl:111
qw422016.N().S(`>trusted</option>
<option`)
//line views/admin.qtpl:112
if f.Get("group") == "moderator" {
2021-07-02 12:02:42 +00:00
//line views/admin.qtpl:112
qw422016.N().S(` selected`)
//line views/admin.qtpl:112
}
//line views/admin.qtpl:112
qw422016.N().S(`>moderator</option>
<option`)
//line views/admin.qtpl:113
if f.Get("group") == "admin" {
2021-07-02 12:02:42 +00:00
//line views/admin.qtpl:113
qw422016.N().S(` selected`)
//line views/admin.qtpl:113
}
//line views/admin.qtpl:113
qw422016.N().S(`>admin</option>
</select>
</div>
<div class="form-field">
<div class="form-field__input">
<button class="btn" type="submit">Create</button>
<a class="btn btn_weak" href="/admin/users/">Cancel</a>
</div>
</div>
</form>
</main>
</div>
`)
//line views/admin.qtpl:126
}
//line views/admin.qtpl:126
func WriteAdminUserNewHTML(qq422016 qtio422016.Writer, f util.FormData) {
2021-07-02 12:02:42 +00:00
//line views/admin.qtpl:126
qw422016 := qt422016.AcquireWriter(qq422016)
//line views/admin.qtpl:126
StreamAdminUserNewHTML(qw422016, f)
2021-07-02 12:02:42 +00:00
//line views/admin.qtpl:126
qt422016.ReleaseWriter(qw422016)
//line views/admin.qtpl:126
}
//line views/admin.qtpl:126
func AdminUserNewHTML(f util.FormData) string {
2021-07-02 12:02:42 +00:00
//line views/admin.qtpl:126
qb422016 := qt422016.AcquireByteBuffer()
//line views/admin.qtpl:126
WriteAdminUserNewHTML(qb422016, f)
2021-07-02 12:02:42 +00:00
//line views/admin.qtpl:126
qs422016 := string(qb422016.B)
//line views/admin.qtpl:126
qt422016.ReleaseByteBuffer(qb422016)
//line views/admin.qtpl:126
return qs422016
//line views/admin.qtpl:126
}
//line views/admin.qtpl:128
func StreamAdminUserEditHTML(qw422016 *qt422016.Writer, u *user.User, f util.FormData) {
2021-07-02 12:02:42 +00:00
//line views/admin.qtpl:128
qw422016.N().S(`
<div class="layout">
<main class="main-width form-wrap">
<h1>
<a href="/admin/users/">&larr;</a>
`)
//line views/admin.qtpl:133
qw422016.E().S(u.Name)
//line views/admin.qtpl:133
qw422016.N().S(`
</h1>
<h2>Change group</h2>
`)
//line views/admin.qtpl:138
if f.HasError() {
//line views/admin.qtpl:138
qw422016.N().S(`
<div class="notice notice--error">
<strong>Error:</strong>
`)
//line views/admin.qtpl:141
qw422016.E().S(f.Error())
//line views/admin.qtpl:141
qw422016.N().S(`
</div>
`)
//line views/admin.qtpl:143
}
//line views/admin.qtpl:143
qw422016.N().S(`
<form action="" method="post">
2021-06-30 12:56:38 +00:00
<div class="form-field">
<select id="group" name="group" aria-label="Group">
2021-06-30 12:56:38 +00:00
<option`)
2021-07-14 21:00:35 +00:00
//line views/admin.qtpl:148
if f.Get("group") == "anon" {
//line views/admin.qtpl:148
qw422016.N().S(` selected`)
//line views/admin.qtpl:148
}
//line views/admin.qtpl:148
qw422016.N().S(`>anon</option>
<option`)
//line views/admin.qtpl:149
if f.Get("group") == "editor" {
//line views/admin.qtpl:149
qw422016.N().S(` selected`)
//line views/admin.qtpl:149
}
//line views/admin.qtpl:149
qw422016.N().S(`>editor</option>
<option`)
//line views/admin.qtpl:150
if f.Get("group") == "trusted" {
//line views/admin.qtpl:150
qw422016.N().S(` selected`)
//line views/admin.qtpl:150
}
//line views/admin.qtpl:150
qw422016.N().S(`>trusted</option>
<option`)
//line views/admin.qtpl:151
2021-07-14 21:00:35 +00:00
if f.Get("group") == "moderator" {
//line views/admin.qtpl:151
2021-07-14 21:00:35 +00:00
qw422016.N().S(` selected`)
//line views/admin.qtpl:151
2021-07-14 21:00:35 +00:00
}
//line views/admin.qtpl:151
2021-07-14 21:00:35 +00:00
qw422016.N().S(`>moderator</option>
2021-06-30 12:56:38 +00:00
<option`)
//line views/admin.qtpl:152
2021-07-14 21:00:35 +00:00
if f.Get("group") == "admin" {
//line views/admin.qtpl:152
2021-07-14 21:00:35 +00:00
qw422016.N().S(` selected`)
//line views/admin.qtpl:152
2021-07-14 21:00:35 +00:00
}
//line views/admin.qtpl:152
2021-07-14 21:00:35 +00:00
qw422016.N().S(`>admin</option>
2021-06-30 12:56:38 +00:00
</select>
</div>
<div class="form-field">
<button class="btn" type="submit">Update</button>
</div>
</form>
<h2>Delete user</h2>
<p>Remove the user from the database. Changes made by the user will
2021-07-14 20:04:52 +00:00
be preserved. It will be possible to take this username later.</p>
<a class="btn btn_destructive" href="/admin/users/`)
2021-07-14 21:00:35 +00:00
//line views/admin.qtpl:164
qw422016.N().U(u.Name)
2021-07-14 21:00:35 +00:00
//line views/admin.qtpl:164
qw422016.N().S(`/delete">Delete</a>
</main>
</div>
`)
2021-07-14 21:00:35 +00:00
//line views/admin.qtpl:167
}
2021-07-14 21:00:35 +00:00
//line views/admin.qtpl:167
func WriteAdminUserEditHTML(qq422016 qtio422016.Writer, u *user.User, f util.FormData) {
2021-07-14 21:00:35 +00:00
//line views/admin.qtpl:167
qw422016 := qt422016.AcquireWriter(qq422016)
2021-07-14 21:00:35 +00:00
//line views/admin.qtpl:167
StreamAdminUserEditHTML(qw422016, u, f)
2021-07-14 21:00:35 +00:00
//line views/admin.qtpl:167
qt422016.ReleaseWriter(qw422016)
2021-07-14 21:00:35 +00:00
//line views/admin.qtpl:167
}
2021-07-14 21:00:35 +00:00
//line views/admin.qtpl:167
func AdminUserEditHTML(u *user.User, f util.FormData) string {
2021-07-14 21:00:35 +00:00
//line views/admin.qtpl:167
qb422016 := qt422016.AcquireByteBuffer()
2021-07-14 21:00:35 +00:00
//line views/admin.qtpl:167
WriteAdminUserEditHTML(qb422016, u, f)
2021-07-14 21:00:35 +00:00
//line views/admin.qtpl:167
2021-06-29 10:34:36 +00:00
qs422016 := string(qb422016.B)
2021-07-14 21:00:35 +00:00
//line views/admin.qtpl:167
2021-06-29 10:34:36 +00:00
qt422016.ReleaseByteBuffer(qb422016)
2021-07-14 21:00:35 +00:00
//line views/admin.qtpl:167
2021-06-29 10:34:36 +00:00
return qs422016
2021-07-14 21:00:35 +00:00
//line views/admin.qtpl:167
}
2021-07-14 21:00:35 +00:00
//line views/admin.qtpl:169
func StreamAdminUserDeleteHTML(qw422016 *qt422016.Writer, u *user.User, f util.FormData) {
2021-07-14 21:00:35 +00:00
//line views/admin.qtpl:169
qw422016.N().S(`
<div class="layout">
<main class="main-width form-wrap">
<h1>Delete user</h1>
`)
2021-07-14 21:00:35 +00:00
//line views/admin.qtpl:174
if f.HasError() {
2021-07-14 21:00:35 +00:00
//line views/admin.qtpl:174
qw422016.N().S(`
<div class="notice notice--error">
<strong>Error:</strong>
`)
2021-07-14 21:00:35 +00:00
//line views/admin.qtpl:177
qw422016.E().S(f.Error())
2021-07-14 21:00:35 +00:00
//line views/admin.qtpl:177
qw422016.N().S(`
</div>
`)
2021-07-14 21:00:35 +00:00
//line views/admin.qtpl:179
}
2021-07-14 21:00:35 +00:00
//line views/admin.qtpl:179
qw422016.N().S(`
<p>Are you sure you want to delete <strong>`)
2021-07-14 21:00:35 +00:00
//line views/admin.qtpl:181
qw422016.E().S(u.Name)
2021-07-14 21:00:35 +00:00
//line views/admin.qtpl:181
qw422016.N().S(`</strong>
from the database? This action is irreversible.</p>
<form action="" method="post">
<button class="btn btn_destructive" type="submit">Delete</button>
<a class="btn btn_weak" href="/admin/users/`)
2021-07-14 21:00:35 +00:00
//line views/admin.qtpl:186
qw422016.N().U(u.Name)
2021-07-14 21:00:35 +00:00
//line views/admin.qtpl:186
qw422016.N().S(`/edit">Cancel</a>
</form>
</main>
</div>
`)
2021-07-14 21:00:35 +00:00
//line views/admin.qtpl:190
}
2021-07-14 21:00:35 +00:00
//line views/admin.qtpl:190
func WriteAdminUserDeleteHTML(qq422016 qtio422016.Writer, u *user.User, f util.FormData) {
2021-07-14 21:00:35 +00:00
//line views/admin.qtpl:190
qw422016 := qt422016.AcquireWriter(qq422016)
2021-07-14 21:00:35 +00:00
//line views/admin.qtpl:190
StreamAdminUserDeleteHTML(qw422016, u, f)
2021-07-14 21:00:35 +00:00
//line views/admin.qtpl:190
qt422016.ReleaseWriter(qw422016)
2021-07-14 21:00:35 +00:00
//line views/admin.qtpl:190
}
2021-07-14 21:00:35 +00:00
//line views/admin.qtpl:190
func AdminUserDeleteHTML(u *user.User, f util.FormData) string {
2021-07-14 21:00:35 +00:00
//line views/admin.qtpl:190
qb422016 := qt422016.AcquireByteBuffer()
2021-07-14 21:00:35 +00:00
//line views/admin.qtpl:190
WriteAdminUserDeleteHTML(qb422016, u, f)
2021-07-14 21:00:35 +00:00
//line views/admin.qtpl:190
qs422016 := string(qb422016.B)
2021-07-14 21:00:35 +00:00
//line views/admin.qtpl:190
qt422016.ReleaseByteBuffer(qb422016)
2021-07-14 21:00:35 +00:00
//line views/admin.qtpl:190
return qs422016
2021-07-14 21:00:35 +00:00
//line views/admin.qtpl:190
2021-06-29 10:34:36 +00:00
}