openaire-library/sharedComponents/menu.ts

40 lines
1.3 KiB
TypeScript

export class MenuItem {
id: string = ""; // for root menu in order to close the dropdown when clicked
title: string = "";
url: string = ""; // external url
route: string = ""; // internal url - using angular routing and components
needsAuthorization: boolean = false; // needs admin rights - mainly for user menu at this point
entitiesRequired: string[] = []; // openaire entities used in page "publication, dataset, organization, software, project, datasource"
routeRequired: string[] = []; // the routes that if aren't enable the menu item doesn't make sense
params: any = {};
markAsActive:boolean;
constructor(id: string, title: string, url: string, route: string, needsAuthorization: boolean, entitiesRequired: string[], routeRequired: string[], params) {
this.id = id;
this.title = title;
this.url = url;
this.route = route;
this.needsAuthorization = needsAuthorization;
this.entitiesRequired = entitiesRequired;
this.routeRequired = routeRequired;
this.params = params;
this.markAsActive = true;
}
public setMarkAsActive(showActive:boolean){
this.markAsActive = showActive;
}
}
export class RootMenuItem {
rootItem: MenuItem;
items: MenuItem[] = [];
}
export class SideMenuItem {
rootItem: MenuItem;
items: RootMenuItem[] = [];
ukIcon: string = '';
}