2021-06-29 10:34:36 +00:00
|
|
|
{% import "github.com/bouncepaw/mycorrhiza/user" %}
|
|
|
|
|
|
|
|
{% func AdminUsersPanelHTML(userList []*user.User) %}
|
|
|
|
<div class="layout">
|
|
|
|
<main class="main-width">
|
|
|
|
<h1>Manage users</h1>
|
|
|
|
|
2021-06-29 15:10:48 +00:00
|
|
|
<form action="/admin/reindex-users" method="post">
|
2021-06-29 10:34:36 +00:00
|
|
|
<button class="btn btn_accent" type="submit">Reindex users</button>
|
|
|
|
</form>
|
|
|
|
|
|
|
|
<h2>Users list</h2>
|
|
|
|
|
|
|
|
<table>
|
|
|
|
<thead>
|
|
|
|
<tr>
|
|
|
|
<th>Name</th>
|
|
|
|
<th>Group</th>
|
|
|
|
<th>Registered at</th>
|
2021-06-29 15:10:48 +00:00
|
|
|
<th></th>
|
2021-06-29 10:34:36 +00:00
|
|
|
</tr>
|
|
|
|
</thead>
|
|
|
|
<tbody>
|
|
|
|
{% for _, u := range userList %}
|
|
|
|
<tr>
|
2021-06-29 15:10:48 +00:00
|
|
|
<td>{%s u.Name %}</td>
|
|
|
|
<td>{%s u.Group %}</td>
|
|
|
|
<td>{%s u.RegisteredAt.Format("2006-01-02 15:04:05-0700") %}</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 %}
|
2021-06-29 15:10:48 +00:00
|
|
|
|
|
|
|
{% func AdminUsersUserHTML(u *user.User) %}
|
|
|
|
<div class="layout">
|
|
|
|
<main class="main-width">
|
|
|
|
<h1>{%s u.Name %}</h1>
|
|
|
|
|
|
|
|
<form action="" method="post">
|
|
|
|
<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>
|
|
|
|
<br>
|
|
|
|
<br>
|
|
|
|
|
|
|
|
<button class="btn btn_accent" type="submit">Update</button>
|
|
|
|
</form>
|
|
|
|
</main>
|
|
|
|
</div>
|
|
|
|
{% endfunc %}
|