mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-18 15:33:04 +00:00
misc fixes
This commit is contained in:
@@ -1,8 +1,9 @@
|
||||
import { Component, Inject, Input } from '@angular/core';
|
||||
import { Component, Inject, Input, OnInit } from '@angular/core';
|
||||
import { LinkMenuItemModel } from './models/link.model';
|
||||
import { MenuItemType } from '../initial-menus-state';
|
||||
import { rendersMenuItemForType } from '../menu-item.decorator';
|
||||
import { GLOBAL_CONFIG, GlobalConfig } from '../../../../config';
|
||||
import { isNotEmpty } from '../../empty.util';
|
||||
|
||||
/**
|
||||
* Component that renders a menu section of type LINK
|
||||
@@ -12,13 +13,22 @@ import { GLOBAL_CONFIG, GlobalConfig } from '../../../../config';
|
||||
templateUrl: './link-menu-item.component.html'
|
||||
})
|
||||
@rendersMenuItemForType(MenuItemType.LINK)
|
||||
export class LinkMenuItemComponent {
|
||||
export class LinkMenuItemComponent implements OnInit {
|
||||
item: LinkMenuItemModel;
|
||||
hasLink: boolean;
|
||||
constructor(@Inject('itemModelProvider') item: LinkMenuItemModel, @Inject(GLOBAL_CONFIG) private EnvConfig: GlobalConfig) {
|
||||
this.item = item;
|
||||
}
|
||||
|
||||
getRouterLink() {
|
||||
return this.EnvConfig.ui.nameSpace + this.item.link;
|
||||
ngOnInit(): void {
|
||||
this.hasLink = isNotEmpty(this.item.link);
|
||||
}
|
||||
|
||||
getRouterLink() {
|
||||
if (this.hasLink) {
|
||||
return this.EnvConfig.ui.nameSpace + this.item.link;
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user