pub struct FieldAdmin {
pub visible: bool,
pub readonly: bool,
pub label: Option<String>,
pub help: Option<String>,
pub widget: Widget,
pub options: Vec<String>,
pub placeholder: Option<String>,
pub signup: Option<bool>,
pub format: ContentFormat,
}Expand description
Per-field dashboard presentation, from [fields.<name>.admin].
Fields§
§visible: boolShow this field in the dashboard at all. Hidden fields are still part of
the API (unlike Field::hidden).
readonly: boolShow the field but refuse edits.
label: Option<String>Human label. Defaults to a title-cased field name.
help: Option<String>One line of guidance shown under the input.
widget: WidgetInput to render. auto picks from the field’s type.
options: Vec<String>Allowed values, turning the input into a dropdown. Each entry may be
"value" or "value|Label".
placeholder: Option<String>Placeholder text for free-text inputs.
signup: Option<bool>Collect this field on the registration form.
Only meaningful on the user model. Unset means “decide from the field”
— see FieldAdmin::in_signup — which is what every app that never
thinks about this gets. Setting it is how a model says this is one of
the things we ask a new person for: adding name and surname to
user and marking them signup = true puts two boxes on the form
without making either of them mandatory.
format: ContentFormatWhat the stored text is, for text/string fields. Purely a
presentation hint: the dashboard highlights and previews the markup,
and the API stores and returns the same characters either way.
Implementations§
Source§impl FieldAdmin
impl FieldAdmin
Sourcepub fn in_signup(&self, field: &Field) -> bool
pub fn in_signup(&self, field: &Field) -> bool
Whether the registration form collects this field.
An explicit signup always wins. Otherwise a field is asked for exactly
when leaving it out would break the signup — i.e. when the model
requires it — which is the behaviour every app had before this
attribute existed.
Trait Implementations§
Source§impl Clone for FieldAdmin
impl Clone for FieldAdmin
Source§fn clone(&self) -> FieldAdmin
fn clone(&self) -> FieldAdmin
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more