Package Exports
- formage
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (formage) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
Formage 
Bootstraped Admin Forms for MongoDB via Mongoose, originally forked from mongoose-admin.
Usage
var express = require('express'),
app = express();
require('formage').init(app, express [, models, options]);
Look at \example
directory.
Options
// Site-wide options, and their default values
require('formage').init(app, express, models, {
title: 'Admin',
root: '/admin',
default_section: 'main',
username: 'admin',
password: 'admin'
);
Model options
var model = new mongoose.model('songs', schema);
model.label = 'My Songs';
model.singular = 'Song';
// external files specific to this model
model.static = {
js: [ '/js/songs.js' ],
css: ['/css/songs.css' ]
};
// one-document models
model.single = true;
model.formage = {
filters: ['artist', 'year'],
// additional actions on this model
actions: [
{
value: 'release',
label: 'Release',
func: function (user, ids, callback) {
console.log('You just released songs ' + ids);
callback();
}
}
],
// list of fields to be displayed by formage for this model
list: ['number', 'title', 'album', 'artist', 'year'],
// list of order fields
order_by: ['-year', 'album', 'number'],
// list of fields that must be populated
// (see http://mongoosejs.com/docs/api.html#document_Document-populate)
list_populate: ['album'],
// list of fields on which full-text search is available
search: ['title', 'album', 'artist']
};
Field options
var schema = new mongoose.Schema({
artist: { type: String, label: 'Who made it?' },
// lang is a two letter ISO 639-1 code as recognized by google
location: { type: Schema.Types.GeoPoint, widget_options: {lang: 'nl'}}
});
License
MIT