pub struct RecordPageDef<M> { /* private fields */ }Expand description
What a RecordPage declares: its slug, label, icon and access. Every setting has a default.
Implementations§
Source§impl<M> RecordPageDef<M>
impl<M> RecordPageDef<M>
Sourcepub fn new() -> Self
pub fn new() -> Self
A def with every default: the slug and label from the page’s type name, and access for whoever may view the record.
Sourcepub fn slug(self, slug: impl Into<String>) -> Self
pub fn slug(self, slug: impl Into<String>) -> Self
The URL segment after the record’s key: "history" serves the page at
{list}/{key}/history.
Defaults to the page type’s name without a trailing Page, kebab-cased:
OrderHistoryPage → order-history. Mounting refuses a slug that is not one URL path
segment, edit, delete, -, or one another record page of the resource takes.
Sourcepub fn label(self, label: impl Into<Text>) -> Self
pub fn label(self, label: impl Into<Text>) -> Self
The label of the page’s tab in the record’s navigation, and of its breadcrumb.
Defaults to the message page-{name} of the panel’s catalogs, else the page type’s name
without a trailing Page, in sentence case: OrderHistoryPage reads page-order-history,
else Order history.
Sourcepub fn icon(self, icon: IconData) -> Self
pub fn icon(self, icon: IconData) -> Self
The icon of the page’s tab in the record’s navigation.
Sourcepub fn access(
self,
access: impl Fn(&Cx, &M) -> bool + Send + Sync + 'static,
) -> Self
pub fn access( self, access: impl Fn(&Cx, &M) -> bool + Send + Sync + 'static, ) -> Self
Whether the request’s user may open the page for record, asked once the policy allows
Ability::View of it. The panel answers 403 and links no page it
answers false for. Defaults to true.
Read no relation of record: each page asking loads the record with relations of its own,
the record page with none.