mirror of
https://github.com/NodeBB/NodeBB.git
synced 2026-03-04 11:31:23 +01:00
feat: #7023
- add category selector to privileges and category create modals - allow category selector to work for multiple selectors on same page
This commit is contained in:
@@ -19,7 +19,7 @@ privilegesController.get = function (req, res, callback) {
|
||||
privileges.categories.list(cid, next);
|
||||
}
|
||||
},
|
||||
allCategories: function (next) {
|
||||
categories: function (next) {
|
||||
async.waterfall([
|
||||
function (next) {
|
||||
categories.getAllCidsFromSet('categories:cid', next);
|
||||
@@ -36,7 +36,12 @@ privilegesController.get = function (req, res, callback) {
|
||||
}, next);
|
||||
},
|
||||
function (data) {
|
||||
data.allCategories.forEach(function (category) {
|
||||
data.categories.unshift({
|
||||
cid: 0,
|
||||
name: '[[admin/manage/privileges:global]]',
|
||||
icon: 'fa-list',
|
||||
});
|
||||
data.categories.forEach(function (category) {
|
||||
if (category) {
|
||||
category.selected = category.cid === cid;
|
||||
|
||||
@@ -48,8 +53,8 @@ privilegesController.get = function (req, res, callback) {
|
||||
|
||||
res.render('admin/manage/privileges', {
|
||||
privileges: data.privileges,
|
||||
allCategories: data.allCategories,
|
||||
selected: data.selected ? data.selected.name : '[[admin/manage/privileges:global]]',
|
||||
categories: data.categories,
|
||||
selectedCategory: data.selected,
|
||||
cid: cid,
|
||||
});
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user