import {Component, Input} from '@angular/core';
import {Router, ActivatedRoute} from '@angular/router';
import {Title, Meta} from '@angular/platform-browser';
import {Observable} from 'rxjs';
import {EnvProperties} from '../../utils/properties/env-properties';
import {PiwikService} from '../../utils/piwik/piwik.service';
@Component({
selector: 'deposit-by-subject',
template: `
Or search for domain specific repositories
`
})
export class DepositBySubjectComponent {
@Input() subjectKeyword: string='';
@Input() piwikSiteId = null;
properties:EnvProperties;
constructor (private _router: Router,private route: ActivatedRoute,
private _meta: Meta, private _title: Title,
private _piwikService: PiwikService) { }
ngOnInit() {
this.route.data
.subscribe((data: { envSpecific: EnvProperties }) => {
this.properties = data.envSpecific;
var title = "Deposit by Subjects";
var description = "Openaire, repositories, open access, content provider, compatibility, organization, deposit by subject"
var url = data.envSpecific.baseLink+this._router.url;
this._title.setTitle(title);
this._meta.updateTag({content:title},"property='og:title'");
this._meta.updateTag({content:description},"name='description'");
this._meta.updateTag({content:description},"property='og:description'");
this._meta.updateTag({content:url},"property='og:url'");
if(this.properties.enablePiwikTrack && (typeof document !== 'undefined')){
this._piwikService.trackView(this.properties, "Deposit by subjects" , this.piwikSiteId).subscribe();
}
});
}
public search() {
this._router.navigate( ['participate/deposit-subject-result'], { queryParams: { "subject": this.subjectKeyword } } );
}
}