mirror of
https://github.com/Alfresco/alfresco-content-app.git
synced 2025-05-12 17:04:46 +00:00
generated menu active links
This commit is contained in:
parent
7f12841e5a
commit
94c088e7bd
@ -57,7 +57,10 @@
|
|||||||
<a
|
<a
|
||||||
class="sidenav-menu__item-link"
|
class="sidenav-menu__item-link"
|
||||||
[routerLink]="item.route.url"
|
[routerLink]="item.route.url"
|
||||||
[ngClass]="{ 'disabled': item.disabled }"
|
[ngClass]="{
|
||||||
|
'disabled': item.disabled,
|
||||||
|
'sidenav-menu__item-link--active': (currentRoute.includes(item.route.url))
|
||||||
|
}"
|
||||||
title="{{ item.title || '' | translate }}">
|
title="{{ item.title || '' | translate }}">
|
||||||
<md-icon>{{ item.icon }}</md-icon>
|
<md-icon>{{ item.icon }}</md-icon>
|
||||||
{{ item.label | translate }}
|
{{ item.label | translate }}
|
||||||
|
@ -23,6 +23,7 @@ import { MinimalNodeEntryEntity } from 'alfresco-js-api';
|
|||||||
import { AlfrescoContentService } from 'ng2-alfresco-core';
|
import { AlfrescoContentService } from 'ng2-alfresco-core';
|
||||||
|
|
||||||
import { BrowsingFilesService } from '../../common/services/browsing-files.service';
|
import { BrowsingFilesService } from '../../common/services/browsing-files.service';
|
||||||
|
import { Router, NavigationEnd } from '@angular/router';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-sidenav',
|
selector: 'app-sidenav',
|
||||||
@ -31,13 +32,17 @@ import { BrowsingFilesService } from '../../common/services/browsing-files.servi
|
|||||||
})
|
})
|
||||||
export class SidenavComponent implements OnInit, OnDestroy {
|
export class SidenavComponent implements OnInit, OnDestroy {
|
||||||
node: MinimalNodeEntryEntity = null;
|
node: MinimalNodeEntryEntity = null;
|
||||||
|
currentRoute = '';
|
||||||
|
|
||||||
onChangeParentSubscription: Subscription;
|
onChangeParentSubscription: Subscription;
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
|
private router: Router,
|
||||||
private browsingFilesService: BrowsingFilesService,
|
private browsingFilesService: BrowsingFilesService,
|
||||||
private contentService: AlfrescoContentService
|
private contentService: AlfrescoContentService
|
||||||
) {}
|
) {
|
||||||
|
this.currentRoute = this.router.routerState.snapshot.url;
|
||||||
|
}
|
||||||
|
|
||||||
get menus() {
|
get menus() {
|
||||||
const main = [
|
const main = [
|
||||||
@ -86,6 +91,12 @@ export class SidenavComponent implements OnInit, OnDestroy {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
|
this.router.events.subscribe((event) => {
|
||||||
|
if (event instanceof NavigationEnd ) {
|
||||||
|
this.currentRoute = event.url;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
this.onChangeParentSubscription = this.browsingFilesService.onChangeParent
|
this.onChangeParentSubscription = this.browsingFilesService.onChangeParent
|
||||||
.subscribe((node: MinimalNodeEntryEntity) => {
|
.subscribe((node: MinimalNodeEntryEntity) => {
|
||||||
this.node = node;
|
this.node = node;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user