All the remaining QTPL files were spread across the codebase. The plan is to get rid of them step by step and migrate to the new l10n approach, all based on Go std templates.
106 lines
3.7 KiB
Plaintext
106 lines
3.7 KiB
Plaintext
{% import "fmt" %}
|
|
{% import "github.com/bouncepaw/mycorrhiza/l18n" %}
|
|
{% import "github.com/bouncepaw/mycorrhiza/user" %}
|
|
{% import "github.com/bouncepaw/mycorrhiza/util" %}
|
|
|
|
{% func AdminUserNew(f util.FormData, lc *l18n.Localizer) %}
|
|
<main class="main-width form-wrap">
|
|
<h1>{%s lc.Get("admin.newuser_title") %}</h1>
|
|
|
|
{% if f.HasError() %}
|
|
<div class="notice notice--error">
|
|
<strong>{%s lc.Get("ui.error") %}:</strong>
|
|
{%s f.Error() %}
|
|
</div>
|
|
{% endif %}
|
|
|
|
<form class="form--double" action="" method="post">
|
|
<div class="form-field">
|
|
<label for="name">{%s lc.Get("admin.users_name") %}:</label>
|
|
<input type="text" name="name" id="name" value="{%s f.Get("name") %}" autofocus>
|
|
</div>
|
|
|
|
<div class="form-field">
|
|
<label for="password">{%s lc.Get("admin.users_password") %}:</label>
|
|
<input type="password" name="password" id="password" value="{%s f.Get("password") %}">
|
|
</div>
|
|
|
|
<div class="form-field">
|
|
<label for="group">{%s lc.Get("admin.users_group") %}:</label>
|
|
<select id="group" name="group">
|
|
<option{% if f.Get("group") == "anon" %} selected{% endif %}>anon</option>
|
|
<option{% if f.Get("group") == "editor" %} selected{% endif %}>editor</option>
|
|
<option{% if f.Get("group") == "trusted" %} selected{% endif %}>trusted</option>
|
|
<option{% if f.Get("group") == "moderator" %} selected{% endif %}>moderator</option>
|
|
<option{% if f.Get("group") == "admin" %} selected{% endif %}>admin</option>
|
|
</select>
|
|
</div>
|
|
|
|
<div class="form-field">
|
|
<div class="form-field__input">
|
|
<button class="btn" type="submit">{%s lc.Get("admin.newuser_create") %}</button>
|
|
<a class="btn btn_weak" href="/admin/users/">{%s lc.Get("ui.cancel") %}</a>
|
|
</div>
|
|
</div>
|
|
</form>
|
|
</main>
|
|
{% endfunc %}
|
|
|
|
{% func AdminUserEdit(u *user.User, f util.FormData, lc *l18n.Localizer) %}
|
|
<main class="main-width form-wrap">
|
|
<h1>
|
|
<a href="/admin/users/">←</a>
|
|
{%s u.Name %}
|
|
</h1>
|
|
|
|
<h2>{%s lc.Get("admin.user_group_heading") %}</h2>
|
|
|
|
{% if f.HasError() %}
|
|
<div class="notice notice--error">
|
|
<strong>{%s lc.Get("ui.error") %}:</strong>
|
|
{%s f.Error() %}
|
|
</div>
|
|
{% endif %}
|
|
|
|
<form action="" method="post">
|
|
<div class="form-field">
|
|
<select id="group" name="group" aria-label="{%s lc.Get("admin.users_group") %}">
|
|
<option{% if f.Get("group") == "anon" %} selected{% endif %}>anon</option>
|
|
<option{% if f.Get("group") == "editor" %} selected{% endif %}>editor</option>
|
|
<option{% if f.Get("group") == "trusted" %} selected{% endif %}>trusted</option>
|
|
<option{% if f.Get("group") == "moderator" %} selected{% endif %}>moderator</option>
|
|
<option{% if f.Get("group") == "admin" %} selected{% endif %}>admin</option>
|
|
</select>
|
|
</div>
|
|
|
|
<div class="form-field">
|
|
<button class="btn" type="submit">{%s lc.Get("admin.user_update") %}</button>
|
|
</div>
|
|
</form>
|
|
|
|
<h2>{%s lc.Get("admin.user_delete_heading") %}</h2>
|
|
<p>{%s lc.Get("admin.user_delete_tip") %}</p>
|
|
<a class="btn btn_destructive" href="/admin/users/{%u u.Name %}/delete">{%s lc.Get("admin.user_delete") %}</a>
|
|
</main>
|
|
{% endfunc %}
|
|
|
|
{% func AdminUserDelete(u *user.User, f util.FormData, lc *l18n.Localizer) %}
|
|
<main class="main-width form-wrap">
|
|
<h1>{%s lc.Get("admin.user_delete_heading") %}</h1>
|
|
|
|
{% if f.HasError() %}
|
|
<div class="notice notice--error">
|
|
<strong>{%s lc.Get("ui.error") %}:</strong>
|
|
{%s f.Error() %}
|
|
</div>
|
|
{% endif %}
|
|
|
|
<p>{%s= lc.Get("admin.user_delete_warn", &l18n.Replacements{"name": fmt.Sprintf("<strong>%s</strong>", u.Name)}) %}</p>
|
|
|
|
<form action="" method="post">
|
|
<button class="btn btn_destructive" type="submit">{%s lc.Get("admin.user_delete") %}</button>
|
|
<a class="btn btn_weak" href="/admin/users/{%u u.Name %}/edit">{%s lc.Get("ui.cancel") %}</a>
|
|
</form>
|
|
</main>
|
|
{% endfunc %}
|