Created
March 30, 2014 14:37
-
-
Save Bardyl/9873629 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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