From fe013223351125d3374323157c2b52bdfd3e3462 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Selman=20Ahatl=C4=B1?= Date: Wed, 7 Mar 2018 00:44:59 +0300 Subject: [PATCH] Hide property is added to menu item meta and create sub sub menu is implemented --- .../components/baSidebar/baSidebar.service.js | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/app/theme/components/baSidebar/baSidebar.service.js b/src/app/theme/components/baSidebar/baSidebar.service.js index 3c19627..7aa2785 100644 --- a/src/app/theme/components/baSidebar/baSidebar.service.js +++ b/src/app/theme/components/baSidebar/baSidebar.service.js @@ -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) {