Installation¶
Add MVC::Keayl::Admin to your application's dependencies and install it. It
brings the vendored Bootstrap and HTMX assets with it.
Install the admin¶
The generators ship as a keayl-admin command. From your application root:
1 | |
This:
- mounts the engine in
config/routes.raku(mount MVC::Keayl::Admin.endpoint, at => '/admin'), - writes
config/initializers/admin.rakuwith aconfigurecall for the site title and mount path, - writes an
app/admin/dashboard.rakudashboard block stub, - writes a
config/initializers/admin_authentication.rakuauthentication stub, - generates parallel
t/andspecs/coverage that the admin engine mounts.
The mount is idempotent: running install again does not duplicate it.
Generate an admin for a model¶
1 | |
The generator loads the named model from the conventional app/models directory
(with app/models/concerns on the search path for its dependencies), introspects
its schema at generate time, and emits an explicit registration at
app/admin/post.raku with a column, field, and filter for each column, and
a permit of the editable attributes (the primary key and timestamps are left
out of the editable set). Field and filter types follow the column types. If the
model cannot be loaded, the generator reports the error and exits non-zero without
writing anything. Because the file is explicit, edit it freely afterward. Parallel
t/ and specs/ coverage is generated alongside it.
Mounting by hand¶
If you prefer to wire things up yourself, mounting is a single line in your routes. See Mounting and Registering resources.