Apply requested changes

This commit is contained in:
GrO2Bl 2024-07-04 22:08:43 +03:30
parent 0dd6377967
commit 33b65a1a75
5 changed files with 14 additions and 18 deletions

View file

@ -87,11 +87,9 @@
<a href="@uri!(instance::privacy)">@i18n!(ctx.1, "Privacy policy")</a> <a href="@uri!(instance::privacy)">@i18n!(ctx.1, "Privacy policy")</a>
@if ctx.2.clone().map(|u| u.is_admin()).unwrap_or(false) { @if ctx.2.clone().map(|u| u.is_admin()).unwrap_or(false) {
<a href="@uri!(instance::admin)">@i18n!(ctx.1, "Administration")</a> <a href="@uri!(instance::admin)">@i18n!(ctx.1, "Administration")</a>
} else { } else if ctx.2.clone().map(|u| u.is_moderator()).unwrap_or(false) {
@if ctx.2.clone().map(|u| u.is_moderator()).unwrap_or(false) {
<a href="@uri!(instance::admin_mod)">@i18n!(ctx.1, "Moderation")</a> <a href="@uri!(instance::admin_mod)">@i18n!(ctx.1, "Moderation")</a>
} }
}
</div> </div>
<div> <div>
<h3>@concat!("Plume ", env!("CARGO_PKG_VERSION"))</h3> <h3>@concat!("Plume ", env!("CARGO_PKG_VERSION"))</h3>

View file

@ -3,21 +3,19 @@
@(ctx: BaseContext, title: &str, selected_tab: u8) @(ctx: BaseContext, title: &str, selected_tab: u8)
@if ctx.2.clone().map(|u| u.is_admin()).unwrap_or(false) { <h1>@i18n!(ctx.1, title)</h1>
<h1>@i18n!(ctx.1, title)</h1>
@if ctx.2.clone().map(|u| u.is_admin()).unwrap_or(false) {
@tabs(&[ @tabs(&[
(&uri!(instance::admin).to_string(), i18n!(ctx.1, "Configuration"), if selected_tab == 1 {true} else {false}), (&uri!(instance::admin).to_string(), i18n!(ctx.1, "Configuration"), selected_tab == 1),
(&uri!(instance::admin_instances: page = _).to_string(), i18n!(ctx.1, "Instances"), if selected_tab == 2 {true} else {false}), (&uri!(instance::admin_instances: page = _).to_string(), i18n!(ctx.1, "Instances"), selected_tab == 2),
(&uri!(instance::admin_users: page = _).to_string(), i18n!(ctx.1, "Users"), if selected_tab == 3 {true} else {false}), (&uri!(instance::admin_users: page = _).to_string(), i18n!(ctx.1, "Users"), selected_tab == 3),
(&uri!(instance::admin_email_blocklist: page=_).to_string(), i18n!(ctx.1, "Email blocklist"), if selected_tab == 4 {true} else {false}) (&uri!(instance::admin_email_blocklist: page=_).to_string(), i18n!(ctx.1, "Email blocklist"), selected_tab == 4)
]) ])
} else { } else {
<h1>@i18n!(ctx.1, "Moderation")</h1>
@tabs(&[ @tabs(&[
(&uri!(instance::admin_instances: page = _).to_string(), i18n!(ctx.1, "Instances"), if selected_tab == 1 {true} else {false}), (&uri!(instance::admin_instances: page = _).to_string(), i18n!(ctx.1, "Instances"), selected_tab == 2),
(&uri!(instance::admin_users: page = _).to_string(), i18n!(ctx.1, "Users"), if selected_tab == 2 {true} else {false}), (&uri!(instance::admin_users: page = _).to_string(), i18n!(ctx.1, "Users"), selected_tab == 3),
(&uri!(instance::admin_email_blocklist: page=_).to_string(), i18n!(ctx.1, "Email blocklist"), if selected_tab == 3 {true} else {false}) (&uri!(instance::admin_email_blocklist: page=_).to_string(), i18n!(ctx.1, "Email blocklist"), selected_tab == 4)
]) ])
} }

View file

@ -5,7 +5,7 @@
@(ctx:BaseContext, emails: Vec<BlocklistedEmail>, page:i32, n_pages:i32) @(ctx:BaseContext, emails: Vec<BlocklistedEmail>, page:i32, n_pages:i32)
@:base(ctx, i18n!(ctx.1, "Blocklisted Emails"), {}, {}, { @:base(ctx, i18n!(ctx.1, "Blocklisted Emails"), {}, {}, {
@:admin_header(ctx, "Blocklisted Emails", (if ctx.2.clone().map(|u| u.is_admin()).unwrap() {4} else {3})) @:admin_header(ctx, "Blocklisted Emails", 4)
<form method="post" action="@uri!(instance::add_email_blocklist)"> <form method="post" action="@uri!(instance::add_email_blocklist)">
@(Input::new("email_address", i18n!(ctx.1, "Email address")) @(Input::new("email_address", i18n!(ctx.1, "Email address"))
.details(i18n!(ctx.1, "The email address you wish to block. In order to block domains, you can use globbing syntax, for example '*@example.com' blocks all addresses from example.com")) .details(i18n!(ctx.1, "The email address you wish to block. In order to block domains, you can use globbing syntax, for example '*@example.com' blocks all addresses from example.com"))

View file

@ -6,7 +6,7 @@
@(ctx: BaseContext, instance: Instance, instances: Vec<Instance>, page: i32, n_pages: i32) @(ctx: BaseContext, instance: Instance, instances: Vec<Instance>, page: i32, n_pages: i32)
@:base(ctx, i18n!(ctx.1, "Administration of {0}"; instance.name), {}, {}, { @:base(ctx, i18n!(ctx.1, "Administration of {0}"; instance.name), {}, {}, {
@:admin_header(ctx, "Instances", (if ctx.2.clone().map(|u| u.is_admin()).unwrap() {2} else {1})) @:admin_header(ctx, "Instances", 2))
<div class="list"> <div class="list">
@for instance in instances { @for instance in instances {

View file

@ -6,7 +6,7 @@
@(ctx: BaseContext, users: Vec<User>, user: Option<&str>, page: i32, n_pages: i32) @(ctx: BaseContext, users: Vec<User>, user: Option<&str>, page: i32, n_pages: i32)
@:base(ctx, i18n!(ctx.1, "Users"), {}, {}, { @:base(ctx, i18n!(ctx.1, "Users"), {}, {}, {
@:admin_header(ctx, "Users", (if ctx.2.clone().map(|u| u.is_admin()).unwrap() {3} else {2})) @:admin_header(ctx, "Users", 3))
<form method="get" action="@uri!(instance::admin_search_users: page = _, user = user.unwrap_or_default())"> <form method="get" action="@uri!(instance::admin_search_users: page = _, user = user.unwrap_or_default())">
<header> <header>