mirror of https://github.com/akveo/blur-admin
Fix Sidebar Service
Fix Sidebar Service not getting second level state menu itempull/337/head
parent
1f81f3b1c1
commit
1d3b60437a
|
@ -19,20 +19,24 @@
|
|||
function _factory() {
|
||||
var isMenuCollapsed = shouldMenuBeCollapsed();
|
||||
|
||||
this.getMenuItems = function() {
|
||||
this.getMenuItems = function () {
|
||||
var states = defineMenuItemStates();
|
||||
var menuItems = states.filter(function(item) {
|
||||
return item.level == 0;
|
||||
});
|
||||
|
||||
menuItems.forEach(function(item) {
|
||||
var children = states.filter(function(child) {
|
||||
return child.level == 1 && child.name.indexOf(item.name) === 0;
|
||||
var zeroLevels = states.filter(function (zeroLevelStateItem) {
|
||||
return zeroLevelStateItem.level == 0;
|
||||
});
|
||||
item.subMenu = children.length ? children : null;
|
||||
});
|
||||
|
||||
return menuItems.concat(staticMenuItems);
|
||||
zeroLevels.forEach(function (zeroLevel) {
|
||||
var firstLevels = states.filter(function (firstLevelStateItem) {
|
||||
return firstLevelStateItem.level == 1 && firstLevelStateItem.name.indexOf(zeroLevel.name) === 0;
|
||||
});
|
||||
firstLevels.forEach(function (firstLevel) {
|
||||
var secondLevel = states.filter(function (secondLevelStateItem) {
|
||||
return secondLevelStateItem.level == 2 && secondLevelStateItem.name.indexOf(firstLevel.name) === 0;
|
||||
});
|
||||
firstLevel.subMenu = secondLevel.length ? secondLevel : null;
|
||||
});
|
||||
zeroLevel.subMenu = firstLevels.length ? firstLevels : null;
|
||||
});
|
||||
return zeroLevels.concat(staticMenuItems);
|
||||
};
|
||||
|
||||
this.shouldMenuBeCollapsed = shouldMenuBeCollapsed;
|
||||
|
|
Loading…
Reference in New Issue