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::{FormField, 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::new(
32        BrandSetting::CODE,
33        "Branding",
34        vec![FormField::text("app_name", "Application name").help(
35            "Shown as the admin brand. Clearing it falls back to the configured application name.",
36        )],
37    )
38    .description("The application name shown across the admin.")
39    .category("System")
40    .order(10)
41    .icon("palette")
42    .permission("backend.manage_branding")
43    // The panel's own setting, belonging to no vendor.
44    .at("/settings/branding")
45}