Merge branch 'master' of ssh://numinibsd/git/base/enigma-bbs

This commit is contained in:
Bryan Ashby 2016-01-16 19:04:57 -07:00
commit ed3eaea0d5
3 changed files with 34 additions and 6 deletions

View File

@ -152,8 +152,8 @@ function MenuModule(options) {
self.prevMenu();
}
}
if(!_.isObject(self.menuConfig.form) && !_.isString(self.menuConfig.prompt)) {
if(_.has(self.menuConfig, 'runtime.autoNext') && true === self.menuConfig.runtime.autoNext) {
/*
If 'next' is supplied, we'll use it. Otherwise, utlize fallback which
may be explicit (supplied) or non-explicit (previous menu)

View File

@ -22,8 +22,6 @@ exports.loadMenu = loadMenu;
exports.getFormConfigByIDAndMap = getFormConfigByIDAndMap;
exports.handleAction = handleAction;
exports.handleNext = handleNext;
//exports.applyGeneralThemeCustomization = applyGeneralThemeCustomization;
//exports.applyMciThemeCustomization = applyMciThemeCustomization;
function getMenuConfig(client, name, cb) {
var menuConfig;

View File

@ -205,15 +205,21 @@ function getMergedTheme(menuConfig, promptConfig, theme) {
[ 'menus', 'prompts' ].forEach(function areaEntry(areaName) {
_.keys(mergedTheme[areaName]).forEach(function menuEntry(menuName) {
var createdFormSection = false;
var mergedThemeMenu = mergedTheme[areaName][menuName];
if(_.has(theme, [ 'customization', areaName, menuName ])) {
if('telnetConnected' === menuName || 'mainMenuLastCallers' === menuName) {
console.log('break me')
}
var menuTheme = theme.customization[areaName][menuName];
var mergedThemeMenu = mergedTheme[areaName][menuName];
// config block is direct assign/overwrite
// :TODO: should probably be _.merge()
if(menuTheme.config) {
mergedThemeMenu.config = _.assign(mergedThemeMenu || {}, menuTheme.config);
mergedThemeMenu.config = _.assign(mergedThemeMenu.config || {}, menuTheme.config);
}
if('menus' === areaName) {
@ -221,12 +227,36 @@ function getMergedTheme(menuConfig, promptConfig, theme) {
getFormKeys(mergedThemeMenu.form).forEach(function formKeyEntry(formKey) {
applyToForm(mergedThemeMenu.form[formKey], menuTheme, formKey);
});
} else {
if(_.isObject(menuTheme.mci)) {
//
// Not specified at menu level means we apply anything from the
// theme to form.0.mci{}
//
mergedThemeMenu.form = { 0 : { mci : { } } };
mergeMciProperties(mergedThemeMenu.form[0], menuTheme);
createdFormSection = true;
}
}
} else if('prompts' === areaName) {
// no 'form' or form keys for prompts -- direct to mci
applyToForm(mergedThemeMenu, menuTheme);
}
}
//
// Finished merging for this menu/prompt
//
// If the following conditions are true, set runtime.autoNext to true:
// * This is a menu
// * There is/was no explicit 'form' section
// * There is no 'prompt' specified
//
if('menus' === areaName && !_.isString(mergedThemeMenu.prompt) &&
(createdFormSection || !_.isObject(mergedThemeMenu.form)))
{
mergedThemeMenu.runtime = _.merge(mergedThemeMenu.runtime || {}, { autoNext : true } );
}
});
});