Skip to content

Instantly share code, notes, and snippets.

@Bardyl
Created March 30, 2014 14:37
Show Gist options
  • Save Bardyl/9873629 to your computer and use it in GitHub Desktop.
Save Bardyl/9873629 to your computer and use it in GitHub Desktop.
showThemes: function (req, res, next) {
var themes = JSON.parse(fs.readFileSync('content/api/settings/themeSettings.json', 'utf8'));
var currentTheme = themes.backOfficeActiveTheme;
console.log(currentTheme);
var backOfficeThemes = [];
var frontOfficeThemes = [];
fs.readdir('content/themes/backoffice', function (err, files) {
files.forEach(function (folder) {
if(fs.lstatSync('content/themes/backoffice/'+folder).isDirectory()) {
var themeOptions = JSON.parse(fs.readFileSync('content/themes/backoffice/'+folder+'/package.json', 'utf8'));
backOfficeThemes.push(themeOptions);
}
});
});
fs.readdir('content/themes/frontoffice', function (err, files) {
files.forEach(function (folder) {
if(fs.lstatSync('content/themes/frontoffice/'+folder).isDirectory()) {
var themeOptions = JSON.parse(fs.readFileSync('content/themes/frontoffice/'+folder+'/package.json', 'utf8'));
frontOfficeThemes.push(themeOptions);
}
});
});
res.view('backoffice/default/views/themes/index', {
layout: 'backoffice/default/views/layout',
currentTheme: currentTheme,
backOfficeThemes: backOfficeThemes,
frontOfficeThemes: frontOfficeThemes
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment