
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
monad-crud
Advanced tools
Easy support for CRUD-style operations for the Monad CMS
$ npm i monad-crud
Define routes and components for all pages of your admin that need CRUD
support. This example uses foo:
"use strict";
import list from '/path/to/list.html';
import schema from '/path/to/schema.html';
angular.module('my-admin', [])
.config(['$routeProvider', $routeProvider => {
$routeProvider.when('/foo/', {
template: '<foo-list resource="$resolve.resource" count="$resolve.count"></foo-list>',
resolve: {
resource: ['monadResource', monadResource => monadResource('/api/foo/')],
count: ['$http', $http => $http.get('/api/foo/count/').then(result => result.data.count)]
}
});
$routeProvider.when('/foo/:id/', {
template: '<foo-detail data="$resolve.data" clients="$resolve.clients"></foo-detail>',
resolve: {
data: ['monadResource', '$route', (monadResource, $route) => {
const res = monadResource('/api/foo/:id/', {id: '@id'});
if ($route.current.params.id == 'create') {
return {item: res};
} else {
return {item: res.get({id: $route.current.params.id})};
}
}],
}
});
}])
.component('fooList', {
template: list,
bindings: {resource: '<', count: '<'},
controller: 'monadListCtrl'
})
.component('fooDetail', {
template: schema,
bindings: {data: '<'}
});
Anything in $resolve.data will be watched by monad-crud to determine whether
or not to show the "save" button (it is hidden when the form is pristine).
The HTML for the list will typically look something like this:
<div class="container-fluid">
<monad-list-header create="'/admin/foo/create/'">Invoice</monad-list-header>
<monad-list-table rows="$ctrl.items" update="'/admin/foo/:id/'">
<table><tr>
<!--
These should specify the fields you want shown in the list
(typically, not everything is relevant for an overview).
The `property` attribute specifies the property on the JSON
objects in the list. `row` is the placeholder for the current
item in the list.
-->
<th property="row.id">ID</th>
<th property="row.subject">Subject</th>
</tr></table>
</monad-list-table>
<div class="text-center" ng-if="$ctrl.count > 10">
<ul uib-pagination total-items="$ctrl.count" ng-model="$ctrl.page" boundary-links="true" max-size="10"></ul>
</div>
</div>
The HTML for the "schema" should contain form fields for everything you want to
show or be editable. By convention, we use $ctrl.data.item as the main thing
being edited, but really the name is irrelevant as long as it's placed on
$ctrl.data.
Wrap the fields in the monadUpdate component:
<monad-update list="/admin/foo/" data="$ctrl.data" type="foo">
<!-- your form fields -->
</monad-update>
...and that's basically it!
FAQs
CRUD component for Monad CMS
We found that monad-crud demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.