Administrator base logic component for EdenJS
@edenjs/admin
creates all the base administrator logic that any normal system should require. This module also creates configuratble dashboards.
npm i --save @edenjs/admin
No configuration is required for this module
Dashboard
Usage
Dashboard model consists of a single configurable dashboard instance. These are created in the frontend through the api.
// load model
const Dashboard = model('dashboard');
// get first dashboard
const dashboard = await Dashboard.findOne();
// dashboard used in frontend
const data = await dashboard.sanitise();
No hooks created in this module
<dashboard>
Usage
The dashboard view creates an instance of a dashboard container, this provides a fully configurable dashboard area.
In the controller Usage
// require helper
const blockHelper = helper('cms/block');
// get dashboards
const dashboards = await Dashboard.find();
// sanitise data
const data = await Promise.all(dashboards.map(dash => dash.sanitise()));
// render dashboard/home.tag view
res.render('dashboard/home', {
blocks : blockHelper.renderBlocks('admin'), // render blocks can be namespaced
dashboards : data,
});
In the view dashboard/home.tag
Usage
<dashboard-home-page>
<dashboard dashboards={ opts.dashboards } blocks={ opts.blocks } type="my.dashboard" name="My Dashboard" />
</dashboard-home-page>
<admin-header>
Usage
The admin header view creates a common admin header component for use in admin layout pages.
In the view
<admin-header title="Admin Header Title" />