macro_rules! register_admin_page {
($ty:ty) => { ... };
}Expand description
Register a custom admin page. The type must implement
AdminPageHandler
and Default. Mirrors the
register_page_type! / register_library_type! pattern —
drop the macro call anywhere in the crate’s source and the page
shows up at /cms-admin/x/<slug> with a sidebar entry in its
declared section.
ⓘ
use rustango_cms::register_admin_page;
use rustango_cms::admin::admin_page::{AdminPageHandler, AdminPageCtx, SidebarSection};
#[derive(Default)]
pub struct ReportsDashboard;
#[async_trait::async_trait]
impl AdminPageHandler for ReportsDashboard {
fn slug(&self) -> &'static str { "reports" }
fn label(&self) -> &'static str { "Reports" }
fn icon(&self) -> Option<&'static str> { Some("insights") }
fn section(&self) -> SidebarSection { SidebarSection::Site }
async fn render(&self, _ctx: AdminPageCtx<'_>) -> axum::response::Response {
todo!()
}
}
register_admin_page!(ReportsDashboard);