v1.18.x
barisusakli 11 years ago
parent 2bb5918b6c
commit 175230e337

@ -11,7 +11,8 @@ var async = require('async'),
plugins = require('./../plugins'),
widgets = require('./../widgets'),
groups = require('./../groups'),
pkg = require('./../../package.json');
pkg = require('./../../package.json'),
validator = require('validator');
@ -39,24 +40,26 @@ adminController.home = function(req, res, next) {
};
adminController.categories.active = function(req, res, next) {
categories.getAllCategories(0, function (err, data) {
data.categories = data.categories.filter(function (category) {
return !category.disabled;
});
res.render('admin/categories', data);
});
filterAndRenderCategories(req, res, next, true);
};
adminController.categories.disabled = function(req, res, next) {
filterAndRenderCategories(req, res, next, false);
};
function filterAndRenderCategories(req, res, next, active) {
categories.getAllCategories(0, function (err, data) {
data.categories = data.categories.filter(function (category) {
return category.disabled;
return active ? !category.disabled : category.disabled;
});
data.categories.forEach(function(category) {
category.description = validator.escape(category.description);
});
res.render('admin/categories', data);
});
};
}
adminController.database.get = function(req, res, next) {
db.info(function (err, data) {

Loading…
Cancel
Save