pub struct Area { /* private fields */ }Expand description
A part of a panel under {prefix}/{slug} with a sidebar of its own: a settings area, an
account area. Registered with Panel::area.
Outside the area, the panel’s sidebar shows the area as one entry, which opens the first of its entries the user may open. Inside it, the sidebar shows a link back to the panel’s home and the area’s groups, each listing the entries the user may open; a group with none is left out. The topbar’s trail starts at the area.
Panel::new("app").area(
Area::new("settings")
.group("Account", |group| group.profile().two_factor())
.tenant_group(|group| group.tenant_profile().resource::<MemberResource>()),
);Implementations§
Source§impl Area
impl Area
Sourcepub fn new(slug: impl Into<String>) -> Self
pub fn new(slug: impl Into<String>) -> Self
An area at {prefix}/{slug}, with no groups yet. slug is one URL path segment, taken
from the namespace the panel’s resources and pages share.
Sourcepub fn label(self, label: impl Into<Text>) -> Self
pub fn label(self, label: impl Into<Text>) -> Self
The label of the area’s entry in the panel’s sidebar and of the first step of its trail.
Defaults to the message area-{slug} of the panel’s catalogs, else the slug in sentence
case: settings reads area-settings, else Settings.
Where the area’s entry sorts among the panel’s sidebar entries, lowest first; defaults to
0, as PageDef::navigation_order does.
The labelled sidebar group the area’s entry renders in; defaults to none, above every
group, as PageDef::navigation_group does.
Keeps the area’s entry out of the panel’s sidebar. The area stays mounted: the user menu and the tenant menu lead into it through the profile and tenant settings pages it holds, or a link of the app’s own.
Sourcepub fn group(
self,
label: impl Into<Text>,
build: impl FnOnce(AreaGroup) -> AreaGroup,
) -> Self
pub fn group( self, label: impl Into<Text>, build: impl FnOnce(AreaGroup) -> AreaGroup, ) -> Self
Adds a group headed label, after the groups already declared, holding what build
registers in it.
Sourcepub fn tenant_group(self, build: impl FnOnce(AreaGroup) -> AreaGroup) -> Self
pub fn tenant_group(self, build: impl FnOnce(AreaGroup) -> AreaGroup) -> Self
Adds a group headed by the name of the tenant the request acts for, after the groups
already declared, holding what build registers in it: the tenant’s settings, members and
billing. A request that acts for no tenant sees none of its entries.