Merge pull request #2837 from atomoc/master

Add parameters for create categories
v1.18.x
Julian Lam 10 years ago
commit f8fb5a1d9f

@ -20,19 +20,19 @@ module.exports = function(Categories) {
var category = {
cid: cid,
name: data.name,
description: data.description,
icon: data.icon,
description: ( data.description ? data.description : '' ),
icon: ( data.icon ? data.icon : '' ),
bgColor: data.bgColor || colours[0],
color: data.color || colours[1],
slug: slug,
parentCid: 0,
parentCid: ( data.parentCid ? data.parentCid : 0 ),
topic_count: 0,
post_count: 0,
disabled: 0,
order: order,
link: '',
numRecentReplies: 1,
class: 'col-md-3 col-xs-12',
class: ( data.class ? data.class : 'col-md-3 col-xs-6' ),
imageClass: 'auto'
};

@ -135,10 +135,16 @@ adminController.categories.get = function(req, res, next) {
if (err) {
return next(err);
}
res.render('admin/manage/category', {
category: data.category[0],
privileges: data.privileges
plugins.fireHook('filter:admin.category.get', {req: req, res: res, category: data.category[0], privileges: data.privileges}, function(err, data) {
if (err) {
return next(err);
}
res.render('admin/manage/category', {
category: data.category,
privileges: data.privileges
});
});
});
};
@ -151,14 +157,20 @@ adminController.categories.getAll = function(req, res, next) {
if (err) {
return next(err);
}
categoryData.filter(Boolean).forEach(function(category) {
(category.disabled ? disabled : active).push(category);
});
res.render('admin/manage/categories', {
active: active,
disabled: disabled
plugins.fireHook('filter:admin.categories.get', {req: req, res: res, categories: categoryData}, function(err, data) {
if (err) {
return next(err);
}
data.categories.filter(Boolean).forEach(function(category) {
(category.disabled ? disabled : active).push(category);
});
res.render('admin/manage/categories', {
active: active,
disabled: disabled
});
});
});
};

Loading…
Cancel
Save