Hide property is added to menu item meta and create sub sub menu is implemented

pull/382/head
Selman Ahatlı 2018-03-07 00:44:59 +03:00
parent 1f81f3b1c1
commit fe01322335
1 changed files with 13 additions and 2 deletions

View File

@ -22,14 +22,24 @@
this.getMenuItems = function() {
var states = defineMenuItemStates();
var menuItems = states.filter(function(item) {
return item.level == 0;
return item.level == 0 && !item.hide;
});
menuItems.forEach(function(item) {
var children = states.filter(function(child) {
return child.level == 1 && child.name.indexOf(item.name) === 0;
return child.level == 1 && child.name.indexOf(item.name) === 0 && !child.hide;
});
item.subMenu = children.length ? children : null;
if (item.subMenu) {
item.subMenu.forEach(function (subItem) {
var grandChildren = states.filter(function (grandChild) {
return grandChild.level == 2 && grandChild.name.indexOf(subItem.name) === 0 && !grandChild.hide;
});
subItem.subMenu = grandChildren.length ? grandChildren : null;
});
}
});
return menuItems.concat(staticMenuItems);
@ -77,6 +87,7 @@
order: meta.order,
icon: meta.icon,
stateRef: s.name,
hide: meta.hide,
};
})
.sort(function(a, b) {