filter:templates.get_virtual for ajaxifying to virtual templates

v1.18.x
psychobunny 11 years ago
parent b648e84836
commit c5b8a7b163

@ -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);
});
}

Loading…
Cancel
Save