up'ing templates.js

v1.18.x
psychobunny 11 years ago committed by Julian Lam
parent 1e5c172f5e
commit 2b5d0e89a5

@ -92,6 +92,9 @@ module.exports = function(Meta) {
themeData['theme:src'] = '';
db.setObject('config', themeData, next);
// Re-set the themes path (for when NodeBB is reloaded)
Meta.themes.setPath(config);
}
], callback);
@ -104,4 +107,17 @@ module.exports = function(Meta) {
}
};
Meta.themes.setPath = function(themeObj) {
console.log(themeObj);
// Theme's templates path
var themePath = nconf.get('base_templates_path'),
fallback = path.join(nconf.get('themes_path'), themeObj.id, 'templates');
if (themeObj.templates) {
themePath = path.join(nconf.get('themes_path'), themeObj.id, themeObj.templates);
} else if (fs.existsSync(fallback)) {
themePath = fallback;
}
nconf.set('theme_templates_path', themePath);
};
};
Loading…
Cancel
Save