Commit e94a1056 by Tuukka Kivilahti

now it should work ,commit before logs

1 parent 0ecc70c5
......@@ -14,21 +14,41 @@ export class LeftMenuComponent implements OnInit {
styleClass: string;
searchableMenu() {
let searchMenu = [];
searchPath(path : string, menu : MenuGroup[]): boolean {
searchMenu.push(MENU.INFO.map(group => {
group.items.map()
menu.forEach(group => {
group.items.forEach(item => {
if(path.startsWith(item.path)) {
return true;
}
});
});
}
));
return false;
}
constructor(private route: ActivatedRoute) {
this.route.url.subscribe(segments => {
let path : string = segments.map(segment => segment.path).join("/");
if(this.searchPath(path, MENU.USER)) {
this.activateUser();
return;
}
if(this.searchPath(path, MENU.INFO)) {
this.activateInfo();
return;
}
if(this.searchPath(path, MENU.ADMIN)) {
this.activateAdmin();
return;
}
});
}
......@@ -36,8 +56,24 @@ export class LeftMenuComponent implements OnInit {
ngOnInit() {
}
activateInfo() {
this.menu = MENU.INFO;
this.styleClass = "infoMenu";
}
activateUser() {
this.menu = MENU.USER;
this.styleClass = "userMenu";
}
activateAdmin() {
this.menu = MENU.ADMIN;
this.styleClass = "adminMenu";
}
}
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!