* Lots of WIP around menu.json handlinge/etc.

This commit is contained in:
Bryan Ashby 2015-03-29 21:47:48 -06:00
parent 8c9b0e729f
commit d6ffa2b26e
6 changed files with 162 additions and 42 deletions

View file

@ -66,6 +66,13 @@ function loadMenu(name, client, cb) {
function getFormConfig(menuConfig, mciMap, cb) {
assert(menuConfig);
if(!menuConfig.form) {
cb(new Error('No form section specified for menu'));
return;
}
async.filter(
menuConfig.form,
function check(form, callback) {
@ -75,12 +82,14 @@ function getFormConfig(menuConfig, mciMap, cb) {
}
var count = form.mciReq.length;
for(var i = 0; i < count; ++i) {
if(!mciMap[form.mciReq[i]]) {
callback(false);
if(Object.keys(mciMap).length === count) {
for(var i = 0; i < count; ++i) {
if(!mciMap[form.mciReq[i]]) {
callback(false);
}
}
callback(true);
}
callback(true);
},
function filtered(form) {
if(form.length > 0) {