Project

General

Profile

1
import {Component, Input}        from '@angular/core';
2
import {Router, ActivatedRoute}  from '@angular/router';
3
import {Title, Meta}             from '@angular/platform-browser';
4

    
5
import {Observable}              from 'rxjs';
6

    
7
import {EnvProperties} from '../../utils/properties/env-properties';
8

    
9
import {PiwikService} from '../../utils/piwik/piwik.service';
10

    
11

    
12
@Component({
13
    selector: 'deposit-by-subject',
14
    template: `
15
        <div class="uk-margin-large-top">
16

    
17
                <h5>Or search for domain specific repositories</h5>
18

    
19
                <form class= "uk-grid">
20
                    <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;" />
21

    
22
                    <button class=" uk-button portal-button"  type="submit" (click)="search()" >
23
                        Search
24
                    </button>
25
                </form>
26
        </div>
27
    `
28
})
29

    
30
export class DepositBySubjectComponent {
31
    @Input() subjectKeyword: string='';
32
    @Input() piwikSiteId = null;
33
    properties:EnvProperties;
34

    
35
    constructor (private _router: Router,private  route: ActivatedRoute,
36
                 private _meta: Meta, private _title: Title,
37
                 private _piwikService: PiwikService) { }
38
    ngOnInit() {
39
      this.route.data
40
        .subscribe((data: { envSpecific: EnvProperties }) => {
41
           this.properties = data.envSpecific;
42

    
43
           var title = "Deposit by Subjects";
44
           var description = "Openaire,  repositories, open access,  content provider, compatibility, organization, deposit by subject"
45
           var url = data.envSpecific.baseLink+this._router.url;
46

    
47
           this._title.setTitle(title);
48
           this._meta.updateTag({content:title},"property='og:title'");
49
           this._meta.updateTag({content:description},"name='description'");
50
           this._meta.updateTag({content:description},"property='og:description'");
51
           this._meta.updateTag({content:url},"property='og:url'");
52

    
53
           if(this.properties.enablePiwikTrack && (typeof document !== 'undefined')){
54
             this._piwikService.trackView(this.properties, "Deposit by subjects" , this.piwikSiteId).subscribe();
55
           }
56

    
57
        });
58

    
59
    }
60
    public search() {
61
      this._router.navigate( ['participate/deposit-subject-result'], { queryParams: { "subject": this.subjectKeyword } } );
62
    }
63
}
(1-1/8)