mirror of
https://github.com/NodeBB/NodeBB.git
synced 2026-01-08 16:42:48 +01:00
filter:templates.get_virtual for ajaxifying to virtual templates
This commit is contained in:
@@ -135,14 +135,27 @@ function getModerators(req, res, next) {
|
||||
}
|
||||
|
||||
function getTemplatesListing(req, res, next) {
|
||||
utils.walk(nconf.get('views_dir'), function (err, data) {
|
||||
data = data
|
||||
.filter(function(value, index, self) {
|
||||
return self.indexOf(value) === index;
|
||||
}).map(function(el) {
|
||||
return el.replace(nconf.get('views_dir') + '/', '');
|
||||
});
|
||||
var data = [];
|
||||
|
||||
async.parallel({
|
||||
views: function(next) {
|
||||
utils.walk(nconf.get('views_dir'), function (err, views) {
|
||||
data = data.concat(
|
||||
views.filter(function(value, index, self) {
|
||||
return self.indexOf(value) === index;
|
||||
}).map(function(el) {
|
||||
return el.replace(nconf.get('views_dir') + '/', '');
|
||||
}));
|
||||
|
||||
res.json(data);
|
||||
});
|
||||
},
|
||||
extended: function(next) {
|
||||
plugins.fireHook('filter:templates.get_virtual', [], function(err, virtual) {
|
||||
data = data.concat(virtual);
|
||||
});
|
||||
}
|
||||
}, function(err) {
|
||||
res.json(data);
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user