42 lines
1.4 KiB
TypeScript
42 lines
1.4 KiB
TypeScript
import {Component} from '@angular/core';
|
|
import {Router} from "@angular/router";
|
|
import {Subscription} from "rxjs";
|
|
import {ConfigurationService} from "../../openaireLibrary/utils/configuration/configuration.service";
|
|
import {Portal} from "../../openaireLibrary/utils/entities/adminTool/portal";
|
|
import {Page} from "../../openaireLibrary/utils/entities/adminTool/page";
|
|
|
|
@Component({
|
|
selector: 'featured',
|
|
template: `
|
|
<div class="uk-container uk-container-large uk-section uk-section-small uk-padding-remove-bottom">
|
|
<!-- <div class="uk-padding-small uk-padding-remove-horizontal">-->
|
|
<!-- <breadcrumbs [breadcrumbs]="breadcrumbs"></breadcrumbs>-->
|
|
<!-- </div>-->
|
|
<html-page [description]="page ? page.name : 'Featured'" [pageTitle]="page ? page.name : 'Featured'"></html-page>
|
|
</div>
|
|
`
|
|
})
|
|
export class FeaturedPageComponent {
|
|
// public breadcrumbs: Breadcrumb[] = [{name: 'home', route: '/'}, {name: 'about - National Bulletins'}];
|
|
public page: Page;
|
|
subs: Subscription[] = [];
|
|
|
|
constructor(private config: ConfigurationService, private _router: Router) {
|
|
}
|
|
|
|
ngOnInit() {
|
|
this.subs.push(this.config.portalAsObservable.subscribe((portal: Portal) => {
|
|
if (portal) {
|
|
let pages: Page[] = <Page[]>portal.pages;
|
|
this.page = pages.find(page => (page.route == this._router.url));
|
|
}
|
|
}));
|
|
}
|
|
|
|
ngOnDestroy() {
|
|
for (let sub of this.subs) {
|
|
sub.unsubscribe();
|
|
}
|
|
}
|
|
}
|