mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-07 22:45:46 +01:00
fix for admin templates
This commit is contained in:
@@ -89,6 +89,7 @@
|
|||||||
jQuery.when(jQuery.getJSON(RELATIVE_PATH + '/templates/config.json'), jQuery.getJSON(RELATIVE_PATH + '/api/get_templates_listing')).done(function(config_data, templates_data) {
|
jQuery.when(jQuery.getJSON(RELATIVE_PATH + '/templates/config.json'), jQuery.getJSON(RELATIVE_PATH + '/api/get_templates_listing')).done(function(config_data, templates_data) {
|
||||||
config = config_data[0];
|
config = config_data[0];
|
||||||
available_templates = templates_data[0];
|
available_templates = templates_data[0];
|
||||||
|
console.log(config, available_templates);
|
||||||
|
|
||||||
templates.ready();
|
templates.ready();
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -18,7 +18,9 @@
|
|||||||
//Adapted from http://stackoverflow.com/questions/5827612/node-js-fs-readdir-recursive-directory-search
|
//Adapted from http://stackoverflow.com/questions/5827612/node-js-fs-readdir-recursive-directory-search
|
||||||
walk: function(dir, done) {
|
walk: function(dir, done) {
|
||||||
var results = [],
|
var results = [],
|
||||||
templateExtract = /\/([\w\d\-_]+)\.tpl$/;
|
path = require('path'),
|
||||||
|
main_dir = path.join(__dirname, '..', 'templates');
|
||||||
|
|
||||||
fs.readdir(dir, function(err, list) {
|
fs.readdir(dir, function(err, list) {
|
||||||
if (err) return done(err);
|
if (err) return done(err);
|
||||||
var pending = list.length;
|
var pending = list.length;
|
||||||
@@ -32,10 +34,7 @@
|
|||||||
if (!--pending) done(null, results);
|
if (!--pending) done(null, results);
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
var templateMatch = file.match(templateExtract);
|
results.push(file.replace(main_dir + '/', '').replace('.tpl', ''));
|
||||||
|
|
||||||
if (templateMatch) results.push(templateMatch[1]);
|
|
||||||
// results.push(file.replace(main_dir, '').replace('.tpl', ''));
|
|
||||||
if (!--pending) done(null, results);
|
if (!--pending) done(null, results);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user