From 33b65a1a7584d08b741b3e9dc5435fec36192100 Mon Sep 17 00:00:00 2001 From: GrO2Bl Date: Thu, 4 Jul 2024 22:08:43 +0330 Subject: [PATCH] Apply requested changes --- templates/base.rs.html | 6 ++---- templates/instance/admin_header.rs.html | 20 +++++++++----------- templates/instance/emailblocklist.rs.html | 2 +- templates/instance/list.rs.html | 2 +- templates/instance/users.rs.html | 2 +- 5 files changed, 14 insertions(+), 18 deletions(-) diff --git a/templates/base.rs.html b/templates/base.rs.html index 3940bf4d..711ed238 100644 --- a/templates/base.rs.html +++ b/templates/base.rs.html @@ -87,10 +87,8 @@ @i18n!(ctx.1, "Privacy policy") @if ctx.2.clone().map(|u| u.is_admin()).unwrap_or(false) { @i18n!(ctx.1, "Administration") - } else { - @if ctx.2.clone().map(|u| u.is_moderator()).unwrap_or(false) { - @i18n!(ctx.1, "Moderation") - } + } else if ctx.2.clone().map(|u| u.is_moderator()).unwrap_or(false) { + @i18n!(ctx.1, "Moderation") }
diff --git a/templates/instance/admin_header.rs.html b/templates/instance/admin_header.rs.html index 299ef565..7794f39f 100644 --- a/templates/instance/admin_header.rs.html +++ b/templates/instance/admin_header.rs.html @@ -3,21 +3,19 @@ @(ctx: BaseContext, title: &str, selected_tab: u8) -@if ctx.2.clone().map(|u| u.is_admin()).unwrap_or(false) { -

@i18n!(ctx.1, title)

+

@i18n!(ctx.1, title)

+@if ctx.2.clone().map(|u| u.is_admin()).unwrap_or(false) { @tabs(&[ - (&uri!(instance::admin).to_string(), i18n!(ctx.1, "Configuration"), if selected_tab == 1 {true} else {false}), - (&uri!(instance::admin_instances: page = _).to_string(), i18n!(ctx.1, "Instances"), if selected_tab == 2 {true} else {false}), - (&uri!(instance::admin_users: page = _).to_string(), i18n!(ctx.1, "Users"), if selected_tab == 3 {true} else {false}), - (&uri!(instance::admin_email_blocklist: page=_).to_string(), i18n!(ctx.1, "Email blocklist"), if selected_tab == 4 {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"), selected_tab == 2), + (&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"), selected_tab == 4) ]) } else { -

@i18n!(ctx.1, "Moderation")

- @tabs(&[ - (&uri!(instance::admin_instances: page = _).to_string(), i18n!(ctx.1, "Instances"), if selected_tab == 1 {true} else {false}), - (&uri!(instance::admin_users: page = _).to_string(), i18n!(ctx.1, "Users"), if selected_tab == 2 {true} else {false}), - (&uri!(instance::admin_email_blocklist: page=_).to_string(), i18n!(ctx.1, "Email blocklist"), if selected_tab == 3 {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"), selected_tab == 3), + (&uri!(instance::admin_email_blocklist: page=_).to_string(), i18n!(ctx.1, "Email blocklist"), selected_tab == 4) ]) } diff --git a/templates/instance/emailblocklist.rs.html b/templates/instance/emailblocklist.rs.html index 32c7ea6e..7e82cea4 100644 --- a/templates/instance/emailblocklist.rs.html +++ b/templates/instance/emailblocklist.rs.html @@ -5,7 +5,7 @@ @(ctx:BaseContext, emails: Vec, page:i32, n_pages:i32) @: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)
@(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")) diff --git a/templates/instance/list.rs.html b/templates/instance/list.rs.html index af545e2c..baeb11a0 100644 --- a/templates/instance/list.rs.html +++ b/templates/instance/list.rs.html @@ -6,7 +6,7 @@ @(ctx: BaseContext, instance: Instance, instances: Vec, page: i32, n_pages: i32) @: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))
@for instance in instances { diff --git a/templates/instance/users.rs.html b/templates/instance/users.rs.html index 7de2e4cb..38299f37 100644 --- a/templates/instance/users.rs.html +++ b/templates/instance/users.rs.html @@ -6,7 +6,7 @@ @(ctx: BaseContext, users: Vec, user: Option<&str>, page: i32, n_pages: i32) @: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))