Expand description
An admin panel for Renox apps, generated from their models (Laravel’s
Filament resources): each model is declared once, as an
AdminResource (its grid columns, its form fields, its policy), and
the panel gives it a list with search, filters, sorting, bulk actions
and exports, and create, edit, view and delete pages, on the UI kit and
renox::grid.
use renox::prelude::*;
use renox_admin::Admin;
App::new()
.module(Auth::new())
.module(
Admin::new()
.title("Back office")
.authorize(|user| user.has_role("staff")) // who may open the panel
.resource(Products),
)The panel lives at /admin (path), behind a login. Nobody gets in
until Admin::authorize (or Admin::gate) says who may; then each
page asks the resource’s AdminResource::allows, which by default
asks the model’s Policy (viewAny, view, create, update,
delete, …). Pages are built-in templates (renox-admin/*.html) that
an app replaces with files of the same name. The guide is
docs/admin.md in the Renox repository.
Re-exports§
pub use entry::Entry;pub use field::Field;pub use field::FieldKind;pub use resource::ActionContext;pub use resource::AdminAction;pub use resource::AdminResource;pub use resource::BoxFuture;pub use resource::Filter;
Modules§
- entry
- A record’s details on its view page: what
AdminResource::entriesreturns, drawn with the UI kit’sinfolistandentry. - field
- A resource’s form fields: what
AdminResource::fieldsreturns, drawn on the create and edit pages with the UI kit’s field macros. - resource
- What an app declares for each model in the panel:
AdminResource, with itsAdminActions andFilters.
Structs§
- Admin
- The admin panel module: its address, its title, who may use it and its resources.