Skip to main content

laterite_admin/settings/
brand.rs

1//! Brand settings: the application name shown across the admin.
2//!
3//! This is the settings layer over the configured application name
4//! ([`laterite_core::config::AppMeta`]). The configured name is the baseline;
5//! the value here overrides it when set, and a blank value falls back to the
6//! configured name. It mirrors how a backend brand setting overrides an
7//! `app.name` config value.
8
9use serde::{Deserialize, Serialize};
10
11use super::store::SettingsModel;
12use super::{SettingsField, SettingsItem};
13
14/// Brand settings stored under [`BrandSetting::CODE`]. An admin edits these; the
15/// values override the configured application name for display.
16#[derive(Debug, Default, Serialize, Deserialize)]
17pub struct BrandSetting {
18    /// The application name shown as the admin brand. Blank falls back to the
19    /// configured application name.
20    #[serde(default)]
21    pub app_name: String,
22}
23
24impl SettingsModel for BrandSetting {
25    const CODE: &'static str = "laterite.brand";
26}
27
28/// The settings item that surfaces [`BrandSetting`] in the admin, under a
29/// "System" category.
30pub(crate) fn settings_item() -> SettingsItem {
31    SettingsItem {
32        code: BrandSetting::CODE.to_string(),
33        label: "Branding".to_string(),
34        description: "The application name shown across the admin.".to_string(),
35        category: "System".to_string(),
36        order: 10,
37        icon: None,
38        permission: Some("backend.manage_branding".to_string()),
39        link: None,
40        fields: vec![SettingsField::text("app_name", "Application name").help(
41            "Shown as the admin brand. Clearing it falls back to the configured application name.",
42        )],
43    }
44}