pub struct InlinePanelSpec {Show 14 fields
pub name: String,
pub label: String,
pub fields: Vec<ExtensionField>,
pub min_num: Option<usize>,
pub max_num: Option<usize>,
pub help: String,
pub icon: Option<String>,
pub widgets: Vec<Widget>,
pub tab: Option<String>,
pub row_label: String,
pub can_add: bool,
pub can_delete: bool,
pub can_order: bool,
pub per_row: bool,
}Expand description
One inline panel declaration — a 1-N relation between the page
and a child table the handler maintains. See
PageTypeHandler::inline_panels. The admin editor renders each row
as a card of widgets (any crate::Widget kind: selects, switches,
the media chooser…) with add, remove and move up / down, in the
Content tab or in a tab of its own (Self::in_tab).
Every row carries its id (when the loaded row has one) in a hidden
field, so PageTypeHandler::save_inline_panel can tell existing
rows from new ones. A loaded row’s __title key, when set, is shown
as the card’s heading.
Fields§
§name: StringStable identifier — used in form field names
(inline__<name>__<row>__<field>). Snake_case conventional.
label: StringVisible label shown above the panel.
fields: Vec<ExtensionField>Per-row field surface. Each entry renders one input per row.
min_num: Option<usize>Optional minimum row count (inclusive). When set + the editor submits fewer rows, the save handler logs a warning but doesn’t reject — handlers enforce hard rules themselves.
max_num: Option<usize>Optional maximum row count (inclusive).
help: StringOptional helptext shown beneath the panel header.
icon: Option<String>Optional material-symbols icon name.
widgets: Vec<Widget>Per-row widgets. When non-empty they replace Self::fields,
giving rows every widget kind. Names are the row keys.
tab: Option<String>Render the panel in its own editor tab with this label instead of the Content tab. Panels naming the same tab share it.
row_label: StringWhat one row is called, e.g. “Cause” (the add button reads “Add cause”).
can_add: boolEditors may add rows.
can_delete: boolEditors may remove rows.
can_order: boolEditors may reorder rows (the saved order is the row order).
per_row: boolPer-row mode: the tab lists only each row’s title; a card’s fields
load when it is opened, it saves with its own Save button, and add,
remove and reorder take effect at once. The page’s Save sends
nothing for this panel. Uses the *_inline_row* hooks instead of
PageTypeHandler::load_inline_panel / save_inline_panel. For
panels with many rows.
Implementations§
Source§impl InlinePanelSpec
impl InlinePanelSpec
Sourcepub fn new(
name: impl Into<String>,
label: impl Into<String>,
fields: Vec<ExtensionField>,
) -> Self
pub fn new( name: impl Into<String>, label: impl Into<String>, fields: Vec<ExtensionField>, ) -> Self
Smallest valid spec — (name, label, fields). Helpers below
add min / max / help / icon fluently.
Sourcepub fn per_row(self) -> Self
pub fn per_row(self) -> Self
Per-row mode — see Self::per_row.
Sourcepub fn with_widgets(
name: impl Into<String>,
label: impl Into<String>,
widgets: Vec<Widget>,
) -> Self
pub fn with_widgets( name: impl Into<String>, label: impl Into<String>, widgets: Vec<Widget>, ) -> Self
A panel whose rows are full widgets — see Self::widgets.
Sourcepub fn in_tab(self, tab: impl Into<String>) -> Self
pub fn in_tab(self, tab: impl Into<String>) -> Self
Show the panel in its own editor tab labelled tab.
Sourcepub fn with_row_label(self, label: impl Into<String>) -> Self
pub fn with_row_label(self, label: impl Into<String>) -> Self
Name one row, e.g. “Cause”.
Sourcepub fn allow(self, add: bool, delete: bool, order: bool) -> Self
pub fn allow(self, add: bool, delete: bool, order: bool) -> Self
Which row operations editors get. A panel whose rows another
system owns sets add and delete to false.
Sourcepub fn row_widgets(&self) -> Vec<Widget>
pub fn row_widgets(&self) -> Vec<Widget>
The widgets one row renders: Self::widgets, or the legacy
Self::fields converted.
pub fn with_min(self, min: usize) -> Self
pub fn with_max(self, max: usize) -> Self
pub fn with_help(self, help: impl Into<String>) -> Self
pub fn with_icon(self, icon: impl Into<String>) -> Self
Trait Implementations§
Source§impl Clone for InlinePanelSpec
impl Clone for InlinePanelSpec
Source§impl Debug for InlinePanelSpec
impl Debug for InlinePanelSpec
Source§impl<'de> Deserialize<'de> for InlinePanelSpec
impl<'de> Deserialize<'de> for InlinePanelSpec
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Auto Trait Implementations§
impl Forget for InlinePanelSpec
impl Freeze for InlinePanelSpec
impl RefUnwindSafe for InlinePanelSpec
impl Send for InlinePanelSpec
impl Sync for InlinePanelSpec
impl Unpin for InlinePanelSpec
impl UnsafeUnpin for InlinePanelSpec
impl UnwindSafe for InlinePanelSpec
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more