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

104 lines
2.6 KiB
Plaintext
Raw Normal View History

2021-06-29 19:26:36 +00:00
{% import "github.com/bouncepaw/mycorrhiza/cfg" %}
2021-06-29 10:34:36 +00:00
{% import "github.com/bouncepaw/mycorrhiza/user" %}
{% func AdminPanelHTML() %}
<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>
{% endfunc %}
2021-06-29 10:34:36 +00:00
{% func AdminUsersPanelHTML(userList []*user.User) %}
<div class="layout">
<main class="main-width">
<h1>Manage users</h1>
<form action="/admin/reindex-users" method="post">
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>
<h2>Users list</h2>
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>
{% for _, u := range userList %}
<tr>
2021-06-30 12:56:38 +00:00
<td class="table-cell--fill">
<a href="/hypha/{%u cfg.UserHypha %}/{%u u.Name %}">{%s u.Name %}</a>
2021-06-29 19:26:36 +00:00
</td>
<td>{%s u.Group %}</td>
2021-07-01 08:29:19 +00:00
<td>
{% if u.RegisteredAt.IsZero() %}
unknown
{% else %}
{%s u.RegisteredAt.UTC().Format("2006-01-02 15:04") %}
{% endif %}
</td>
<td>
<a href="/admin/users/{%u u.Name %}/edit">Edit</a>
</td>
2021-06-29 10:34:36 +00:00
</tr>
{% endfor %}
</tbody>
</table>
</main>
</div>
{% endfunc %}
{% func AdminUsersUserHTML(u *user.User) %}
<div class="layout">
<main class="main-width">
<h1>{%s u.Name %}</h1>
<form action="" method="post">
2021-06-30 12:56:38 +00:00
<div class="form-field">
<label for="group">Group:</label>
<select id="group" name="group">
<option{% if u.Group == "anon" %} selected{% endif %}>anon</option>
<option{% if u.Group == "editor" %} selected{% endif %}>editor</option>
<option{% if u.Group == "trusted" %} selected{% endif %}>trusted</option>
<option{% if u.Group == "moderator" %} selected{% endif %}>moderator</option>
<option{% if u.Group == "admin" %} selected{% endif %}>admin</option>
</select>
</div>
2021-06-30 12:56:38 +00:00
<button class="btn" type="submit">Update</button>
<a class="btn btn_weak" href="/admin/users/">Cancel</a>
</form>
</main>
</div>
{% endfunc %}