Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F60157303
content-view-tab-component.component.ts
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Sat, Apr 27, 22:46
Size
2 KB
Mime Type
text/x-java
Expires
Mon, Apr 29, 22:46 (1 d, 23 h)
Engine
blob
Format
Raw Data
Handle
17310161
Attached To
rSVGTESTAPP svg-test-app
content-view-tab-component.component.ts
View Options
import {Component, OnInit} from '@angular/core';
import {ActivatedRoute, Params, Router} from '@angular/router';
import {Subscription} from "rxjs/index";
import {NavigationEntity} from "../models/models";
import {NavigationServiceService} from "../services/navigation-service.service";
@Component({
selector: 'app-content-view-tab-component',
templateUrl: './content-view-tab-component.component.html',
styleUrls: ['./content-view-tab-component.component.scss']
})
export class ContentViewTabComponentComponent implements OnInit {
// navigation tab (manuscript, page, rhizome)
navTabLinks: any[];
// navbar on th left for navigating
navBarOpenState: boolean;
navBarOpenMode = 'push'; // side || over || push
navTreeData: Array<NavigationEntity>;
// listening to whats going on
queryParamSubscription: Subscription;
activeViewSubscription: Subscription;
navTreeSubscription: Subscription;
// only for accessing params in the template TODO: maybe not needed.
manQueryParam: string;
pageQueryParam: string;
wordQueryParam: string;
constructor(private router: Router,
private activatedRoute: ActivatedRoute,
private naviService: NavigationServiceService) {
this.navTabLinks = [
{
label: 'Manuskripte',
link: 'manuscript',
index: 0
}, {
label: 'Seitenansicht',
link: 'page',
index: 1
}, {
label: 'Rhizome-Ansicht',
link: 'rhizome',
index: 2
},
];
}
ngOnInit(): void {
// TODO: This must trigger into 1) queries, 2) infobox
this.naviService.createManuscriptNavTree();
// TODO: trigger here changes into service like selectManuscript(man)
// resetting the chosen things according to the query params of the url
this.queryParamSubscription = this.activatedRoute.queryParams.subscribe( (queryparams: Params ) => {
this.manQueryParam = queryparams['man'];
this.pageQueryParam = queryparams['page'];
this.wordQueryParam = queryparams['word'];
}
);
// subscribe to activated route/chosen tab and set the navTreeData accordingly
this.activeViewSubscription = this.activatedRoute.firstChild.url.subscribe(actualView =>
this.naviService.setActiveNavigationTree(actualView[0].path));
// always subscribe to new navigation tree. Might change due to change of activeViewSubscription
this.navTreeSubscription = this.naviService.navTreeDataChange.subscribe(tree => {
this.navTreeData = tree;
});
}
toggleDrawer() {
this.navBarOpenState = !this.navBarOpenState;
}
}
Event Timeline
Log In to Comment