2
0
Fork 0
tcrud/lib/plugin/server/config/config-tmenu.js

29 lines
759 B
JavaScript
Raw Normal View History

2017-06-10 14:53:29 +00:00
var configRegistry = require('./../../../config-registry');
module.exports = (function () {
return function ServerConfigTMenuPlugin() {
this.configPlugin = function (ctx) {
ctx.key = 'serverConfigTMenu';
ctx.description = 'Exports tmenu.';
ctx.localDir = __dirname;
ctx.localConfigTemplate = 'config-tmenu.json';
};
this.configServer = function(ctx) {
ctx.server.get(ctx.createSlugApiServerBase(),ctx.renderFunctionJSON(function() {
var result = {};
for (var key in configRegistry.getMasterConfig().rootTMenu) {
var value = configRegistry.getMasterConfig().rootTMenu[key];
if (value.items.length > 0) {
result[key] = value; // remove empty menus
}
}
return result;
}));
};
};
})();