mongoose-manager
Advanced tools
Comparing version 0.1.6 to 0.1.7
@@ -8,7 +8,12 @@ var Admin = require('../lib/admin').Admin, | ||
var Artist = require('./models/Artist').Artist; | ||
var models = [ | ||
{ | ||
model: require('./models/Artist').Artist, | ||
model: Artist, | ||
// the name of the property to be used as label when an Artist is displayed embedded in another document | ||
label: 'name' | ||
label: 'name', | ||
actions: { | ||
'Toggle grammy': toggleGrammy | ||
} | ||
}, | ||
@@ -25,2 +30,12 @@ { | ||
function toggleGrammy(req, res, next){ | ||
var ids = req.body.ids; | ||
Artist.find().where('_id').in(ids).exec(function(err, artists){ | ||
async.each(artists, function(artist, cb){ | ||
artist.wonGrammy = !artist.wonGrammy; | ||
artist.save(cb); | ||
}, next); | ||
}); | ||
} | ||
var admin = new Admin(models, { | ||
@@ -27,0 +42,0 @@ pageSize: 20 |
@@ -51,7 +51,9 @@ var utils = require('../utils'), | ||
if (action){ | ||
action.call(action, req, res, next); | ||
} else { | ||
if (!action) return res.redirect('back'); | ||
action.call(action, req, res, function(err){ | ||
if (err) return res.send(404, err); | ||
res.redirect('back'); | ||
} | ||
}); | ||
} | ||
@@ -58,0 +60,0 @@ |
{ | ||
"name": "mongoose-manager", | ||
"version": "0.1.6", | ||
"version": "0.1.7", | ||
"scripts": { | ||
@@ -5,0 +5,0 @@ "example": "supervisor --force-watch -i public,views example/app.js" |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
46114
798