+ asset.getModuleAsset()

* Menus can specify built in menu modules: @systemModule:XXXXX
This commit is contained in:
Bryan Ashby 2015-08-08 15:52:47 -06:00
parent b8d4741c18
commit dbb3e04166
4 changed files with 28 additions and 8 deletions

View File

@ -9,6 +9,7 @@ var assert = require('assert');
exports.parseAsset = parseAsset; exports.parseAsset = parseAsset;
exports.getArtAsset = getArtAsset; exports.getArtAsset = getArtAsset;
exports.getModuleAsset = getModuleAsset;
exports.resolveConfigAsset = resolveConfigAsset; exports.resolveConfigAsset = resolveConfigAsset;
exports.getViewPropertyAsset = getViewPropertyAsset; exports.getViewPropertyAsset = getViewPropertyAsset;
@ -17,6 +18,7 @@ var ALL_ASSETS = [
'menu', 'menu',
'method', 'method',
'systemMethod', 'systemMethod',
'systemModule',
'prompt', 'prompt',
'config', 'config',
]; ];
@ -58,6 +60,24 @@ function getArtAsset(art) {
} }
} }
function getModuleAsset(module) {
if(!_.isString(module)) {
return null;
}
if('@' === module[0]) {
var modAsset = parseAsset(module);
assert('module' === modAsset.type || 'systemModule' === modAsset.type);
return modAsset;
} else {
return {
type : 'module',
asset : module,
}
}
}
function resolveConfigAsset(from) { function resolveConfigAsset(from) {
var asset = parseAsset(from); var asset = parseAsset(from);
if(asset) { if(asset) {

View File

@ -81,13 +81,13 @@ function loadMenu(options, cb) {
}); });
}, },
function loadMenuModule(menuConfig, callback) { function loadMenuModule(menuConfig, callback) {
var modAsset = asset.getModuleAsset(menuConfig.module);
var modSupplied = _.isString(menuConfig.module); var modSupplied = null !== modAsset;
var modLoadOpts = { var modLoadOpts = {
name : modSupplied ? menuConfig.module : 'standard_menu', name : modSupplied ? modAsset.asset : 'standard_menu',
path : modSupplied ? Config.paths.mods : __dirname, path : (!modSupplied || 'systemModule' === modAsset.type) ? __dirname : Config.paths.mods,
category : modSupplied ? 'mods' : null, category : (!modSupplied || 'systemModule' === modAsset.type) ? null : 'mods',
}; };
moduleUtil.loadModuleEx(modLoadOpts, function moduleLoaded(err, mod) { moduleUtil.loadModuleEx(modLoadOpts, function moduleLoaded(err, mod) {
@ -99,7 +99,7 @@ function loadMenu(options, cb) {
callback(err, modData); callback(err, modData);
}); });
}, },
function createModuleInstance(modData, callback) { function createModuleInstance(modData, callback) {
Log.debug( Log.debug(
{ moduleName : modData.name, args : options.args, config : modData.config, info : modData.mod.modInfo }, { moduleName : modData.name, args : options.args, config : modData.config, info : modData.mod.modInfo },

View File

@ -661,8 +661,8 @@
"options" : { "cls" : true } "options" : { "cls" : true }
}, },
"demoFullScreenEditor" : { "demoFullScreenEditor" : {
"module" : "fse", "module" : "@systemModule:fse",
"art" : "demo_fse_local_user.ans", //"art" : "demo_fse_local_user.ans",
"options" : { "cls" : true }, "options" : { "cls" : true },
"config" : { "config" : {
"editorType" : "netMail", "editorType" : "netMail",