81901: Enable spacebar toggling for admin sidebar items

This commit is contained in:
Yura Bondarenko
2021-08-16 09:37:10 +02:00
parent b32226c5ed
commit 129ea726e8
6 changed files with 27 additions and 4 deletions

View File

@@ -4,6 +4,7 @@ import { MenuItemType } from '../initial-menus-state';
import { rendersMenuItemForType } from '../menu-item.decorator';
import { isNotEmpty } from '../../empty.util';
import { environment } from '../../../../environments/environment';
import { Router } from '@angular/router';
/**
* Component that renders a menu section of type LINK
@@ -16,7 +17,10 @@ import { environment } from '../../../../environments/environment';
export class LinkMenuItemComponent implements OnInit {
item: LinkMenuItemModel;
hasLink: boolean;
constructor(@Inject('itemModelProvider') item: LinkMenuItemModel) {
constructor(
@Inject('itemModelProvider') item: LinkMenuItemModel,
private router: Router,
) {
this.item = item;
}
@@ -31,4 +35,11 @@ export class LinkMenuItemComponent implements OnInit {
return undefined;
}
navigate(event: any) {
event.stopPropagation();
if (this.getRouterLink()) {
this.router.navigate([this.getRouterLink()]);
}
}
}