misc fixes

This commit is contained in:
lotte
2019-05-08 16:32:32 +02:00
parent 8865d6e049
commit 22bd69ba13
7 changed files with 61 additions and 35 deletions

View File

@@ -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;
}
}