import { Component, AfterViewInit, Input, OnInit } from '@angular/core';
import { ApplicationService } from '../../services/application.service';
import { Router } from '@angular/router';
declare var jQuery: any;
@Component({
selector: 'site-menu',
template: `
`
})
export class SiteMenuComponent implements AfterViewInit {
@Input('type')
type: string = 'fixed';
@Input('hidden')
hidden: boolean = true;
constructor(public application: ApplicationService, private router: Router) { }
hiddenClass(): string {
if (this.hidden)
return "hidden";
else
"";
}
ngAfterViewInit(): void {
setTimeout(() => this.attachSideBar(), 2000);
}
getMenuIconOrText(menuItem: any): string {
if (menuItem.icon == null)
return menuItem.name;
else
return "";
}
makeActive(index: number): string {
if (index == 0)
return "active";
else
return "";
}
attachSideBar(): void {
if (jQuery != null) {
jQuery('.ui.sidebar')
.sidebar('attach events', '.toc.item');
jQuery('.ui.dropdown')
.dropdown();
}
}
navigateToUrl(url: string): void {
this.router.navigate([url]);
}
}