pub struct CmsAdminPage<T>(/* private fields */);Expand description
The admin page serving model T. #[derive(CmsAdmin)] registers it;
register it by hand with register_admin_page!(CmsAdminPage<T>) only
when implementing CmsAdmin yourself.
Trait Implementations§
Source§impl<T: CmsAdmin> AdminPageHandler for CmsAdminPage<T>
impl<T: CmsAdmin> AdminPageHandler for CmsAdminPage<T>
Source§fn slug(&self) -> &'static str
fn slug(&self) -> &'static str
URL slug. The page mounts at
/cms-admin/x/<slug>. Must
stay stable; bookmarks / links reference this value.Source§fn icon(&self) -> Option<&'static str>
fn icon(&self) -> Option<&'static str>
Optional Material-symbols icon name (e.g.
"insights",
"bug_report").Source§fn section(&self) -> SidebarSection
fn section(&self) -> SidebarSection
Which sidebar section the entry lives under. Defaults to a
generic
Custom("Tools") bucket so out-of-the-box behaviour
keeps third-party pages visually separated from built-ins.Source§fn sort_order(&self) -> i32
fn sort_order(&self) -> i32
Sibling order within the section (ascending). Defaults to 100
so most third-party pages slot in between built-ins (which use
lower numbers) without needing to think about ordering.
Source§fn permission_resource(&self) -> Option<&'static str>
fn permission_resource(&self) -> Option<&'static str>
Codename prefix to surface this page in the role permissions
matrix. Returning
Some("acme_reports") adds a
“Custom admin pages → <label>” row with view + edit
columns, granting / revoking codenames acme_reports.view
and acme_reports.edit. Default None means the page is
not access-controlled by the matrix — hosts can still gate
inside render() manually.Source§fn permission_actions(&self) -> &'static [Action]
fn permission_actions(&self) -> &'static [Action]
The matrix columns for
Self::permission_resource, and so the
codenames the dispatcher checks. The default, view + edit, gates
GET on <resource>.view and every POST on <resource>.edit.
Including Action::Add or Action::Delete makes a POST to
the new or delete action need .add or .delete instead.Source§fn render<'life0, 'life1, 'async_trait>(
&'life0 self,
ctx: AdminPageCtx<'life1>,
) -> Pin<Box<dyn Future<Output = Response> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn render<'life0, 'life1, 'async_trait>(
&'life0 self,
ctx: AdminPageCtx<'life1>,
) -> Pin<Box<dyn Future<Output = Response> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Render the page. The implementation owns its template + form
dispatch (handlers usually render via Tera with the bundled
chrome by extending
rcms_admin/_base.html).Source§fn post<'life0, 'life1, 'async_trait>(
&'life0 self,
ctx: AdminPageCtx<'life1>,
form: AdminForm,
) -> Pin<Box<dyn Future<Output = Response> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn post<'life0, 'life1, 'async_trait>(
&'life0 self,
ctx: AdminPageCtx<'life1>,
form: AdminForm,
) -> Pin<Box<dyn Future<Output = Response> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Handle a form posted to
/cms-admin/x/<slug> or
/cms-admin/x/<slug>/<action> (see AdminPageCtx::action).
The dispatcher has already checked the login, the CSRF token and
the codename (see Self::permission_actions). The usual reply
is AdminPageCtx::redirect. The default answers
405 Method Not Allowed.Auto Trait Implementations§
impl<T> Forget for CmsAdminPage<T>
impl<T> Freeze for CmsAdminPage<T>
impl<T> RefUnwindSafe for CmsAdminPage<T>
impl<T> Send for CmsAdminPage<T>
impl<T> Sync for CmsAdminPage<T>
impl<T> Unpin for CmsAdminPage<T>
impl<T> UnsafeUnpin for CmsAdminPage<T>
impl<T> UnwindSafe for CmsAdminPage<T>
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
Mutably borrows from an owned value. Read more
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> ⓘ
Converts
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> ⓘ
Converts
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 moreCreates a shared type from an unshared type.