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 = { var category = {
cid: cid, cid: cid,
name: data.name, name: data.name,
description: data.description, description: ( data.description ? data.description : '' ),
icon: data.icon, icon: ( data.icon ? data.icon : '' ),
bgColor: data.bgColor || colours[0], bgColor: data.bgColor || colours[0],
color: data.color || colours[1], color: data.color || colours[1],
slug: slug, slug: slug,
parentCid: 0, parentCid: ( data.parentCid ? data.parentCid : 0 ),
topic_count: 0, topic_count: 0,
post_count: 0, post_count: 0,
disabled: 0, disabled: 0,
order: order, order: order,
link: '', link: '',
numRecentReplies: 1, numRecentReplies: 1,
class: 'col-md-3 col-xs-12', class: ( data.class ? data.class : 'col-md-3 col-xs-6' ),
imageClass: 'auto' imageClass: 'auto'
}; };

@ -135,10 +135,16 @@ adminController.categories.get = function(req, res, next) {
if (err) { if (err) {
return next(err); return next(err);
} }
res.render('admin/manage/category', { plugins.fireHook('filter:admin.category.get', {req: req, res: res, category: data.category[0], privileges: data.privileges}, function(err, data) {
category: data.category[0], if (err) {
privileges: data.privileges 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) { if (err) {
return next(err); return next(err);
} }
categoryData.filter(Boolean).forEach(function(category) { plugins.fireHook('filter:admin.categories.get', {req: req, res: res, categories: categoryData}, function(err, data) {
(category.disabled ? disabled : active).push(category); if (err) {
}); return next(err);
}
res.render('admin/manage/categories', {
active: active, data.categories.filter(Boolean).forEach(function(category) {
disabled: disabled (category.disabled ? disabled : active).push(category);
});
res.render('admin/manage/categories', {
active: active,
disabled: disabled
});
}); });
}); });
}; };

Loading…
Cancel
Save