|
|
|
@ -61,9 +61,10 @@
|
|
|
|
|
function loadServer() {
|
|
|
|
|
var loaded = templatesToLoad.length;
|
|
|
|
|
|
|
|
|
|
function getTemplates(directory) {
|
|
|
|
|
for (var t in templatesToLoad) {
|
|
|
|
|
(function (file) {
|
|
|
|
|
fs.readFile((customTemplateDir ? customTemplateDir : __dirname + '/../templates') + '/' + file + '.tpl', function (err, html) {
|
|
|
|
|
fs.readFile(directory + '/' + file + '.tpl', function (err, html) {
|
|
|
|
|
var template = function () {
|
|
|
|
|
this.toString = function () {
|
|
|
|
|
return this.html;
|
|
|
|
@ -82,6 +83,16 @@
|
|
|
|
|
}(templatesToLoad[t]));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (customTemplateDir) {
|
|
|
|
|
fs.exists(customTemplateDir, function (exists) {
|
|
|
|
|
var directory = (exists ? customTemplateDir : __dirname + '/../templates');
|
|
|
|
|
getTemplates(customTemplateDir);
|
|
|
|
|
});
|
|
|
|
|
} else {
|
|
|
|
|
getTemplates(__dirname + '/../templates');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function loadClient() {
|
|
|
|
|
jQuery.when(jQuery.getJSON(RELATIVE_PATH + '/templates/config.json'), jQuery.getJSON(RELATIVE_PATH + '/api/get_templates_listing')).done(function (config_data, templates_data) {
|
|
|
|
|