- Add
mfactory:admin-base
- Add
mfactory:admin-blaze
ormfactory:admin-react
- Add
mfactory:iron-router
ormfactory:admin-flow-router
Go to /admin
and there's your admin dashboard!
Admin will automatically configure itself with the default settings. It's designed to work straight out of the box.
By default, it will:
- Set up an admin route on
/admin
- Allow the first user to visit
/admin
to declare themselves as admin - Set up CRUD routes for all of your collections
If you're using Collection2, admin will use your schemas to generate the forms.
If not, admin will try and guess the schemas based on the data structure of your mongo docs.
Defaults are shown
Admin.config({
homeRoute: '/admin',
...
})
CRUD (Create, Read, Update, Delete) will let you manage your collection docs.
A global key value storage that's can be managed by an admin and used anywhere.
.... more packages to come
#### Add a collection with admin crud
Admin.crud.addCollection(Posts)
or with options
Admin.crud.addCollection Posts,
sidebarItem:
icon: 'fa-book'
#### Add a single crud route
Admin.crud.addView Posts,
type: 'view' # ['view', 'create', 'update', 'delete']
label: "View all posts"
sidebarItem:
icon: 'fa-book'
template: 'adminViewPosts'
# Specific to view
pagination: true
subscription: ->
# Must return an array of cursors
data: ->
docs: Posts.find({}, {sort: createdAt: -1}})
A custom external link
Admin.sidebar.addItem
label: 'Zendesk'
name: 'zendesk-link
icon: 'fa-plus'
href: "http://zendesk.com"
Nested items
Admin.sidebar.addItem
label: 'Parent'
icon: 'fa-plus'
name: 'parent'
then...
Admin.sidebar.addItem
label: 'Child'
icon: 'fa-plus'
name: 'child'
parent: 'parent'
Creating a custom view:
Admin.routes.addRoute
name: 'my-route'
template: 'my-template'
sidebarItem:
icon: 'fa-books'
subscriptions: ->
# return cursor or array of cursors
data: ->
# return object