mirror of
https://git.joinplu.me/Plume/Plume.git
synced 2024-11-22 03:21:01 +00:00
Add admin_header template to organize tabs #1156
This commit is contained in:
parent
d004a7047b
commit
d950a34b6b
6 changed files with 34 additions and 45 deletions
|
@ -1,6 +1,6 @@
|
|||
@use plume_models::instance::Instance;
|
||||
@use validator::ValidationErrors;
|
||||
@use crate::templates::base;
|
||||
@use crate::templates::{base, instance::admin_header};
|
||||
@use crate::template_utils::*;
|
||||
@use crate::routes::instance::InstanceSettingsForm;
|
||||
@use crate::routes::*;
|
||||
|
@ -8,14 +8,7 @@
|
|||
@(ctx: BaseContext, instance: Instance, form: InstanceSettingsForm, errors: ValidationErrors)
|
||||
|
||||
@:base(ctx, i18n!(ctx.1, "Administration of {0}"; instance.name.clone()), {}, {}, {
|
||||
<h1>@i18n!(ctx.1, "Administration")</h1>
|
||||
|
||||
@tabs(&[
|
||||
(&uri!(instance::admin).to_string(), i18n!(ctx.1, "Configuration"), true),
|
||||
(&uri!(instance::admin_instances: page = _).to_string(), i18n!(ctx.1, "Instances"), false),
|
||||
(&uri!(instance::admin_users: page = _).to_string(), i18n!(ctx.1, "Users"), false),
|
||||
(&uri!(instance::admin_email_blocklist: page=_).to_string(), i18n!(ctx.1, "Email blocklist"), false)
|
||||
])
|
||||
@:admin_header(ctx, "Administration", 1)
|
||||
|
||||
<form method="post" action="@uri!(instance::update_settings)">
|
||||
@(Input::new("name", i18n!(ctx.1, "Name"))
|
||||
|
|
23
templates/instance/admin_header.rs.html
Normal file
23
templates/instance/admin_header.rs.html
Normal file
|
@ -0,0 +1,23 @@
|
|||
@use crate::template_utils::*;
|
||||
@use crate::routes::*;
|
||||
|
||||
@(ctx: BaseContext, title: &str, selectedTab: u8)
|
||||
|
||||
@if ctx.2.clone().map(|u| u.is_admin()).unwrap_or(false) {
|
||||
<h1>@i18n!(ctx.1, title)</h1>
|
||||
|
||||
@tabs(&[
|
||||
(&uri!(instance::admin).to_string(), i18n!(ctx.1, "Configuration"), if selectedTab == 1 {true} else {false}),
|
||||
(&uri!(instance::admin_instances: page = _).to_string(), i18n!(ctx.1, "Instances"), if selectedTab == 2 {true} else {false}),
|
||||
(&uri!(instance::admin_users: page = _).to_string(), i18n!(ctx.1, "Users"), if selectedTab == 3 {true} else {false}),
|
||||
(&uri!(instance::admin_email_blocklist: page=_).to_string(), i18n!(ctx.1, "Email blocklist"), if selectedTab == 4 {true} else {false})
|
||||
])
|
||||
} else {
|
||||
<h1>@i18n!(ctx.1, "Moderation")</h1>
|
||||
|
||||
@tabs(&[
|
||||
(&uri!(instance::admin_instances: page = _).to_string(), i18n!(ctx.1, "Instances"), if selectedTab == 1 {true} else {false}),
|
||||
(&uri!(instance::admin_users: page = _).to_string(), i18n!(ctx.1, "Users"), if selectedTab == 2 {true} else {false}),
|
||||
(&uri!(instance::admin_email_blocklist: page=_).to_string(), i18n!(ctx.1, "Email blocklist"), if selectedTab == 3 {true} else {false})
|
||||
])
|
||||
}
|
|
@ -1,15 +1,8 @@
|
|||
@use crate::templates::base;
|
||||
@use crate::templates::{base, instance::admin_header};
|
||||
@use crate::template_utils::*;
|
||||
@use crate::routes::*;
|
||||
|
||||
@(ctx: BaseContext)
|
||||
|
||||
@:base(ctx, i18n!(ctx.1, "Moderation"), {}, {}, {
|
||||
<h1>@i18n!(ctx.1, "Moderation")</h1>
|
||||
|
||||
@tabs(&[
|
||||
(&uri!(instance::admin).to_string(), i18n!(ctx.1, "Home"), true),
|
||||
(&uri!(instance::admin_instances: page = _).to_string(), i18n!(ctx.1, "Instances"), false),
|
||||
(&uri!(instance::admin_users: page = _).to_string(), i18n!(ctx.1, "Users"), false),
|
||||
])
|
||||
@:admin_header(ctx, "Moderation", 0)
|
||||
})
|
||||
|
|
|
@ -1,17 +1,11 @@
|
|||
@use plume_models::blocklisted_emails::BlocklistedEmail;
|
||||
@use crate::templates::base;
|
||||
@use crate::templates::{base, instance::admin_header};
|
||||
@use crate::template_utils::*;
|
||||
@use crate::routes::*;
|
||||
|
||||
@(ctx:BaseContext, emails: Vec<BlocklistedEmail>, page:i32, n_pages:i32)
|
||||
@:base(ctx, i18n!(ctx.1, "Blocklisted Emails"), {}, {}, {
|
||||
<h1>@i18n!(ctx.1,"Blocklisted Emails")</h1>
|
||||
@tabs(&[
|
||||
(&uri!(instance::admin).to_string(), i18n!(ctx.1, "Configuration"), false),
|
||||
(&uri!(instance::admin_instances: page = _).to_string(), i18n!(ctx.1, "Instances"), false),
|
||||
(&uri!(instance::admin_users: page = _).to_string(), i18n!(ctx.1, "Users"), false),
|
||||
(&uri!(instance::admin_email_blocklist:page=_).to_string(), i18n!(ctx.1, "Email blocklist"), true),
|
||||
])
|
||||
@: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}))
|
||||
<form method="post" action="@uri!(instance::add_email_blocklist)">
|
||||
@(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"))
|
||||
|
|
|
@ -1,19 +1,12 @@
|
|||
@use plume_models::instance::Instance;
|
||||
@use crate::templates::base;
|
||||
@use crate::templates::{base, instance::admin_header};
|
||||
@use crate::template_utils::*;
|
||||
@use crate::routes::*;
|
||||
|
||||
@(ctx: BaseContext, instance: Instance, instances: Vec<Instance>, page: i32, n_pages: i32)
|
||||
|
||||
@:base(ctx, i18n!(ctx.1, "Administration of {0}"; instance.name), {}, {}, {
|
||||
<h1>@i18n!(ctx.1, "Instances")</h1>
|
||||
|
||||
@tabs(&[
|
||||
(&uri!(instance::admin).to_string(), i18n!(ctx.1, "Configuration"), false),
|
||||
(&uri!(instance::admin_instances: page = _).to_string(), i18n!(ctx.1, "Instances"), true),
|
||||
(&uri!(instance::admin_users: page = _).to_string(), i18n!(ctx.1, "Users"), false),
|
||||
(&uri!(instance::admin_email_blocklist:page=_).to_string(), i18n!(ctx.1, "Email blocklist"), false),
|
||||
])
|
||||
@:admin_header(ctx, "Instances", (if ctx.2.clone().map(|u| u.is_admin()).unwrap() {2} else {1}))
|
||||
|
||||
<div class="list">
|
||||
@for instance in instances {
|
||||
|
|
|
@ -1,19 +1,12 @@
|
|||
@use plume_models::users::User;
|
||||
@use crate::templates::base;
|
||||
@use crate::templates::{base, instance::admin_header};
|
||||
@use crate::template_utils::*;
|
||||
@use crate::routes::*;
|
||||
|
||||
@(ctx: BaseContext, users: Vec<User>, user: Option<&str>, page: i32, n_pages: i32)
|
||||
|
||||
@:base(ctx, i18n!(ctx.1, "Users"), {}, {}, {
|
||||
<h1>@i18n!(ctx.1, "Users")</h1>
|
||||
|
||||
@tabs(&[
|
||||
(&uri!(instance::admin).to_string(), i18n!(ctx.1, "Configuration"), false),
|
||||
(&uri!(instance::admin_instances: page = _).to_string(), i18n!(ctx.1, "Instances"), false),
|
||||
(&uri!(instance::admin_users: page = _).to_string(), i18n!(ctx.1, "Users"), true),
|
||||
(&uri!(instance::admin_email_blocklist: page=_).to_string(), i18n!(ctx.1, "Email blocklist"), false)
|
||||
])
|
||||
@:admin_header(ctx, "Users", (if ctx.2.clone().map(|u| u.is_admin()).unwrap() {3} else {2}))
|
||||
|
||||
<form method="get" action="@uri!(instance::admin_search_users: page = _, user = user.unwrap_or_default())">
|
||||
<header>
|
||||
|
|
Loading…
Reference in a new issue