"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "src/app/shared/menu/menu-item/link-menu-item.component.ts" between
dspace-angular-dspace-7.0.tar.gz and dspace-angular-dspace-7.1.tar.gz

About: dspace-angular is the Angular-based frontend of DSpace, a digital repository system to capture, store, index, preserve and redistribute an organization’s research material in digital formats.

link-menu-item.component.ts  (dspace-angular-dspace-7.0):link-menu-item.component.ts  (dspace-angular-dspace-7.1)
import { Component, Inject, Input, OnInit } from '@angular/core'; import { Component, Inject, Input, OnInit } from '@angular/core';
import { LinkMenuItemModel } from './models/link.model'; import { LinkMenuItemModel } from './models/link.model';
import { MenuItemType } from '../initial-menus-state'; import { MenuItemType } from '../initial-menus-state';
import { rendersMenuItemForType } from '../menu-item.decorator'; import { rendersMenuItemForType } from '../menu-item.decorator';
import { isNotEmpty } from '../../empty.util'; import { isNotEmpty } from '../../empty.util';
import { environment } from '../../../../environments/environment'; import { environment } from '../../../../environments/environment';
import { Router } from '@angular/router';
/** /**
* Component that renders a menu section of type LINK * Component that renders a menu section of type LINK
*/ */
@Component({ @Component({
selector: 'ds-link-menu-item', selector: 'ds-link-menu-item',
templateUrl: './link-menu-item.component.html' templateUrl: './link-menu-item.component.html'
}) })
@rendersMenuItemForType(MenuItemType.LINK) @rendersMenuItemForType(MenuItemType.LINK)
export class LinkMenuItemComponent implements OnInit { export class LinkMenuItemComponent implements OnInit {
item: LinkMenuItemModel; item: LinkMenuItemModel;
hasLink: boolean; hasLink: boolean;
constructor(@Inject('itemModelProvider') item: LinkMenuItemModel) { constructor(
@Inject('itemModelProvider') item: LinkMenuItemModel,
private router: Router,
) {
this.item = item; this.item = item;
} }
ngOnInit(): void { ngOnInit(): void {
this.hasLink = isNotEmpty(this.item.link); this.hasLink = isNotEmpty(this.item.link);
} }
getRouterLink() { getRouterLink() {
if (this.hasLink) { if (this.hasLink) {
return environment.ui.nameSpace + this.item.link; return environment.ui.nameSpace + this.item.link;
} }
return undefined; return undefined;
} }
navigate(event: any) {
event.preventDefault();
if (this.getRouterLink()) {
this.router.navigate([this.getRouterLink()]);
}
event.stopPropagation();
}
} }
 End of changes. 3 change blocks. 
1 lines changed or deleted 13 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)