openaire-library/deposit/datasets/depositBySubject.component.ts

54 lines
2.3 KiB
TypeScript

import {Component, Input} from '@angular/core';
import {Observable} from 'rxjs/Observable';
import { Router, ActivatedRoute} from '@angular/router';
import {PiwikService} from '../../utils/piwik/piwik.service';
import{EnvProperties} from '../../utils/properties/env-properties';
import { Meta} from '../../sharedComponents/metaService';
@Component({
selector: 'deposit-by-subject',
template: `
<div class="uk-margin-top">
<h3>Or search for domain specific repositories</h3>
<form class= "uk-grid">
<input type="text" [(ngModel)]="subjectKeyword" class="uk-margin-medium-left uk-padding-remove-left uk-input" name="subject" placeholder="Type keywords (e.g Biology, Natural sciences, Social Sciences, Engineering Sciences... )" style="width: 580px;" />
<button class=" uk-button uk-button-default" type="submit" (click)="search()" >
Search
</button>
</form>
</div>
`
})
export class DepositBySubjectComponent {
@Input() subjectKeyword: string='';
@Input() piwikSiteId = null;
properties:EnvProperties;
constructor (private _router: Router,private route: ActivatedRoute, private _meta: Meta, private _piwikService:PiwikService) { }
ngOnInit() {
this.route.data
.subscribe((data: { envSpecific: EnvProperties }) => {
this.properties = data.envSpecific;
this._meta.setTitle("Deposit by Subjects" );
this._meta.updateProperty("og:title","Deposit by subjects");
this._meta.updateProperty("og:url", data.envSpecific.baseLink+this._router.url);
this._meta.updateMeta("description", "Openaire, repositories, open access, content provider, compatibility, organization, deposit by subject");
this._meta.updateProperty("og:description", "Openaire, repositories, open access, content provider, compatibility, organization, deposit by subject");
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 } } );
}
}