|
|
|
@ -11,7 +11,7 @@ categoriesController.get = async function (req, res, next) {
|
|
|
|
|
const [categoryData, parent, allCategories] = await Promise.all([
|
|
|
|
|
categories.getCategories([req.params.category_id], req.uid),
|
|
|
|
|
categories.getParents([req.params.category_id]),
|
|
|
|
|
categories.buildForSelectAll(['text', 'value']),
|
|
|
|
|
categories.buildForSelectAll(),
|
|
|
|
|
]);
|
|
|
|
|
|
|
|
|
|
const category = categoryData[0];
|
|
|
|
@ -22,9 +22,10 @@ categoriesController.get = async function (req, res, next) {
|
|
|
|
|
category.parent = parent[0];
|
|
|
|
|
allCategories.forEach(function (category) {
|
|
|
|
|
if (category) {
|
|
|
|
|
category.selected = parseInt(category.value, 10) === parseInt(req.params.category_id, 10);
|
|
|
|
|
category.selected = parseInt(category.cid, 10) === parseInt(req.params.category_id, 10);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
const selectedCategory = allCategories.find(c => c.selected);
|
|
|
|
|
|
|
|
|
|
const data = await plugins.fireHook('filter:admin.category.get', {
|
|
|
|
|
req: req,
|
|
|
|
@ -38,7 +39,8 @@ categoriesController.get = async function (req, res, next) {
|
|
|
|
|
|
|
|
|
|
res.render('admin/manage/category', {
|
|
|
|
|
category: data.category,
|
|
|
|
|
allCategories: data.allCategories,
|
|
|
|
|
categories: data.allCategories,
|
|
|
|
|
selectedCategory: selectedCategory,
|
|
|
|
|
customClasses: data.customClasses,
|
|
|
|
|
});
|
|
|
|
|
};
|
|
|
|
|