mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-10-26 08:36:12 +01:00
fix: custom navigation item not showing groups
This commit is contained in:
@@ -63,7 +63,7 @@ define('admin/general/navigation', ['translator', 'iconSelect', 'benchpress', 'j
|
||||
function drop(ev, ui) {
|
||||
var id = ui.helper.attr('data-id');
|
||||
var el = $('#active-navigation [data-id="' + id + '"]');
|
||||
var data = id === 'custom' ? { iconClass: 'fa-navicon' } : available[id];
|
||||
var data = id === 'custom' ? { iconClass: 'fa-navicon', groups: available[0].groups } : available[id];
|
||||
|
||||
data.enabled = false;
|
||||
data.index = (parseInt($('#enabled').children().last().attr('data-index'), 10) || 0) + 1;
|
||||
|
||||
@@ -17,17 +17,23 @@ navigationController.get = function (req, res, next) {
|
||||
}, next);
|
||||
},
|
||||
function (result) {
|
||||
result.groups.sort((a, b) => b.system - a.system);
|
||||
result.groups = result.groups.map(group => ({ name: group.name, displayName: group.displayName }));
|
||||
|
||||
result.admin.enabled.forEach(function (enabled, index) {
|
||||
enabled.index = index;
|
||||
enabled.selected = index === 0;
|
||||
const groupData = _.cloneDeep(result.groups);
|
||||
|
||||
enabled.groups = groupData.map(function (group) {
|
||||
group.selected = enabled.groups.includes(group.name);
|
||||
return group;
|
||||
enabled.groups = result.groups.map(function (group) {
|
||||
return {
|
||||
displayName: group.displayName,
|
||||
selected: enabled.groups.includes(group.name),
|
||||
};
|
||||
});
|
||||
});
|
||||
|
||||
enabled.groups.sort((a, b) => b.system - a.system);
|
||||
result.admin.available.forEach(function (available) {
|
||||
available.groups = result.groups;
|
||||
});
|
||||
|
||||
result.admin.navigation = result.admin.enabled.slice();
|
||||
|
||||
Reference in New Issue
Block a user