2018-12-07 12:05:01 +01:00
|
|
|
@use plume_models::users::User;
|
2024-08-16 08:02:28 +02:00
|
|
|
@use crate::templates::{base, instance::admin_header};
|
2020-01-21 07:02:03 +01:00
|
|
|
@use crate::template_utils::*;
|
|
|
|
@use crate::routes::*;
|
2018-12-06 18:54:16 +01:00
|
|
|
|
2023-03-19 17:00:17 +01:00
|
|
|
@(ctx: BaseContext, users: Vec<User>, user: Option<&str>, page: i32, n_pages: i32)
|
2018-12-06 18:54:16 +01:00
|
|
|
|
2019-02-02 15:23:50 +01:00
|
|
|
@:base(ctx, i18n!(ctx.1, "Users"), {}, {}, {
|
2024-08-16 08:02:28 +02:00
|
|
|
@:admin_header(ctx, "Users", 3))
|
2018-12-06 18:54:16 +01:00
|
|
|
|
2023-03-21 10:49:01 +01:00
|
|
|
<form method="get" action="@uri!(instance::admin_search_users: page = _, user = user.unwrap_or_default())">
|
2023-03-19 17:03:09 +01:00
|
|
|
<header>
|
2023-03-21 10:49:01 +01:00
|
|
|
<input type="search" name="user" value="@user.unwrap_or_default()">
|
2023-03-19 17:03:09 +01:00
|
|
|
<input type="submit" value="@i18n!(ctx.1, "Search users")">
|
|
|
|
</header>
|
2023-03-19 17:00:17 +01:00
|
|
|
</form>
|
|
|
|
|
2019-09-13 12:28:36 +02:00
|
|
|
<form method="post" action="@uri!(instance::edit_users)">
|
|
|
|
<header>
|
|
|
|
<select name="action">
|
|
|
|
<option value="admin">@i18n!(ctx.1, "Grant admin rights")</option>
|
|
|
|
<option value="un-admin">@i18n!(ctx.1, "Revoke admin rights")</option>
|
|
|
|
<option value="moderator">@i18n!(ctx.1, "Grant moderator rights")</option>
|
|
|
|
<option value="un-moderator">@i18n!(ctx.1, "Revoke moderator rights")</option>
|
|
|
|
<option value="ban">@i18n!(ctx.1, "Ban")</option>
|
|
|
|
</select>
|
|
|
|
<input type="submit" value="@i18n!(ctx.1, "Run on selected users")">
|
|
|
|
</header>
|
|
|
|
<div class="list">
|
|
|
|
@for user in users {
|
|
|
|
<div class="card flex compact">
|
|
|
|
<input type="checkbox" name="@user.id">
|
|
|
|
@avatar(ctx.0, &user, Size::Small, false, ctx.1)
|
|
|
|
<p class="grow">
|
|
|
|
<a href="@uri!(user::details: name = &user.fqn)">@user.name()</a>
|
|
|
|
<small>@format!("@{}", user.username)</small>
|
|
|
|
</p>
|
|
|
|
@if user.is_admin() {
|
|
|
|
<p class="badge">@i18n!(ctx.1, "Admin")</p>
|
|
|
|
} else {
|
|
|
|
@if user.is_moderator() {
|
|
|
|
<p class="badge">@i18n!(ctx.1, "Moderator")</p>
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</div>
|
|
|
|
}
|
|
|
|
</div>
|
|
|
|
</form>
|
2023-03-21 11:15:20 +01:00
|
|
|
@if user.is_some() {
|
|
|
|
@paginate_param(ctx.1, page, n_pages, Some(format!("user={}", encode_query_param(user.unwrap_or_default()))))
|
|
|
|
} else {
|
|
|
|
@paginate(ctx.1, page, n_pages)
|
|
|
|
}
|
2018-12-06 18:54:16 +01:00
|
|
|
})
|