Skip to main content

Module settings

Module settings 

Source
Expand description

Descriptor-driven settings screens, and the settings store behind them.

A module registers a SettingsItem for each settings model it wants an operator to edit: its storage code (the store::SettingsModel CODE), a category it groups under, and the fields to render. The framework mounts one index that lists every registered item grouped by category, and one generic form per item that reads and writes the model’s JSON value through the store. No per-model controller is needed, exactly as a single settings controller serves every settings model.

Values are stored as one JSON object per code. Field names are JSON keys, not SQL identifiers, and the value is written through a parameterized upsert, so nothing here builds SQL from user input.

Re-exports§

pub use brand::BrandSetting;
pub use migrations::migrations;
pub use migrations::MODULE_ID;
pub use store::get;
pub use store::get_for;
pub use store::load;
pub use store::load_for;
pub use store::save;
pub use store::save_for;
pub use store::set;
pub use store::set_for;
pub use store::PreferencesError;
pub use store::PreferencesModel;
pub use store::SettingsError;
pub use store::SettingsModel;
pub use crate::form::FormField;

Modules§

brand
Brand settings: the application name shown across the admin.
migrations
The settings schema, as a portable one-file migration.
store
The settings store: typed settings models stored as one JSON blob per code.

Structs§

SettingsItem
A settings model surfaced in the admin: a storage code, a category and order that place it in the index, and the fields to edit.
SettingsModule
The laterite.settings module: the framework’s settings store table.