JSPM

  • Created
  • Published
  • Downloads 30
  • Score
    100M100P100Q55049F
  • License MIT

Admin GUI addon for mongoose and non mongoose projects on Express.js

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 Mongoose, originally forked from mongoose-admin.

Usage

npm install formage

var admin = require('formage').init(app, express);

Also, look at \example directory.

Some Options

// model options
model.label = 'My Songs';
model.singular = 'Song';
model.static = {
   js: [ '/js/songs.js' ],
   css: ['/css/songs.css' ]
};
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']
};

// one-document models
model.single = true;

// field options
field.label = 'Song Title';

License

MIT