1
|
import {Component, Input} from '@angular/core';
|
2
|
import {ActivatedRoute} from "@angular/router";
|
3
|
import {HelperFunctions} from '../HelperFunctions.class';
|
4
|
import {RouterHelper} from "../routerHelper.class";
|
5
|
import {EnvProperties} from '../properties/env-properties';
|
6
|
|
7
|
@Component({
|
8
|
selector: 'showAuthors',
|
9
|
template: `
|
10
|
<span *ngIf="authors != undefined">
|
11
|
<div *ngIf="showAll && numberOfAuthors > authorsLimit">
|
12
|
<a (click)="numberOfAuthors = authorsLimit;">View less authors</a>
|
13
|
</div>
|
14
|
|
15
|
<span *ngFor="let author of authors.slice(0,numberOfAuthors) let i=index">
|
16
|
<i *ngIf="!author.orcid || (properties.environment != 'beta' && properties.environment != 'development')">{{author.fullName}}</i
|
17
|
><a *ngIf="author.orcid && (properties.environment == 'beta' || properties.environment == 'development')"><i>{{author.fullName}}</i></a
|
18
|
><div *ngIf="author.orcid && (properties.environment == 'beta' || properties.environment == 'development')" class=" default-dropdown uk-margin-remove-top uk-padding-medium"
|
19
|
uk-dropdown="pos: bottom-left; mode:hover" style="min-width: 70px !important;">
|
20
|
<b class="uk-margin-top">{{author.fullName}}</b>
|
21
|
|
22
|
<div>
|
23
|
<div class="uk-text-muted">ORCID</div>
|
24
|
<span><code class="uk-padding-small" [id]="'orcid_clipboard_auhtor_'+i">{{author.orcid}}</code></span>
|
25
|
<span>
|
26
|
<button [class]="'uk-icon-clipboard uk-button uk-button-primary uk-button-small orcid_clipboard_btn_auhtor_'+i"
|
27
|
[attr.data-clipboard-target]="'#orcid_clipboard_auhtor_'+i" title="Copy to clipboard">
|
28
|
Copy
|
29
|
</button>
|
30
|
<a class="uk-button uk-button-primary uk-button-small" title="Visit author in Orcid"
|
31
|
[href]="properties.orcidURL+author.orcid" target="_blank">
|
32
|
Visit
|
33
|
</a>
|
34
|
</span>
|
35
|
</div>
|
36
|
|
37
|
<hr>
|
38
|
<div class="uk-margin-top">
|
39
|
Search <b>{{author.fullName}}</b> by <b>ORCID</b> in OpenAIRE's
|
40
|
</div>
|
41
|
<div class="uk-text-center uk-margin-small uk-margin-large-left uk-margin-large-right">
|
42
|
<a class="uk-button uk-button-small portal-button uk-padding uk-padding-remove-top uk-padding-remove-bottom uk-width-1-1"
|
43
|
[queryParams]="routerHelper.createQueryParams(['orcid','oc'],[quote(author['orcid']),'and'])" routerLinkActive="router-link-active" routerLink="/search/advanced/publications">
|
44
|
Publications
|
45
|
</a>
|
46
|
</div>
|
47
|
<div class="uk-text-center uk-margin-small uk-margin-large-left uk-margin-large-right">
|
48
|
<a class="uk-button uk-button-small portal-button uk-padding uk-padding-remove-top uk-padding-remove-bottom uk-width-1-1"
|
49
|
[queryParams]="routerHelper.createQueryParams(['orcid','oc'],[quote(author['orcid']),'and'])" routerLinkActive="router-link-active" routerLink="/search/advanced/datasets">
|
50
|
Research Data
|
51
|
</a>
|
52
|
</div>
|
53
|
<div class="uk-text-center uk-margin-small uk-margin-large-left uk-margin-large-right">
|
54
|
<a class="uk-button uk-button-small portal-button uk-padding uk-padding-remove-top uk-padding-remove-bottom uk-width-1-1"
|
55
|
[queryParams]="routerHelper.createQueryParams(['orcid','oc'],[quote(author['orcid']),'and'])" routerLinkActive="router-link-active" routerLink="/search/advanced/software">
|
56
|
Software
|
57
|
</a>
|
58
|
</div>
|
59
|
<div class="uk-text-center uk-margin-small uk-margin-large-left uk-margin-large-right">
|
60
|
<a class="uk-button uk-button-small portal-button uk-padding uk-padding-remove-top uk-padding-remove-bottom uk-width-1-1"
|
61
|
[queryParams]="routerHelper.createQueryParams(['orcid','oc'],[quote(author['orcid']),'and'])" routerLinkActive="router-link-active" routerLink="/search/advanced/other">
|
62
|
Other Research Products
|
63
|
</a>
|
64
|
</div>
|
65
|
</div
|
66
|
><span>;</span>
|
67
|
</span>
|
68
|
<span *ngIf="numberOfAuthors == authorsLimit && authors.length > authorsLimit"> ... </span>
|
69
|
<span *ngIf="showAll && numberOfAuthors == authorsLimit && authors.length > authorsLimit">
|
70
|
<a (click)="numberOfAuthors = authors.length;">
|
71
|
view all {{authors.length | number}} authors
|
72
|
</a>
|
73
|
</span>
|
74
|
<span *ngIf="showAll && numberOfAuthors > authorsLimit">
|
75
|
<a (click)="numberOfAuthors = authorsLimit; scroll()">View less authors</a>
|
76
|
</span>
|
77
|
</span>
|
78
|
`
|
79
|
|
80
|
})
|
81
|
|
82
|
export class ShowAuthorsComponent {
|
83
|
@Input() authors: {"fullName": string, "orcid": string}[];
|
84
|
@Input() authorsLimit: number = 30;
|
85
|
@Input() showAll: boolean = true;
|
86
|
|
87
|
public numberOfAuthors: number;
|
88
|
public properties:EnvProperties;
|
89
|
public routerHelper:RouterHelper = new RouterHelper();
|
90
|
|
91
|
constructor (private route: ActivatedRoute) {}
|
92
|
|
93
|
ngOnInit() {
|
94
|
this.route.data.subscribe((data: { envSpecific: EnvProperties }) => {
|
95
|
this.properties = data.envSpecific;
|
96
|
});
|
97
|
this.numberOfAuthors = this.authorsLimit;
|
98
|
|
99
|
if(typeof window !== 'undefined') {
|
100
|
let orcid_clipboard;
|
101
|
let Clipboard;
|
102
|
Clipboard = require('clipboard');
|
103
|
if(this.authors) {
|
104
|
this.authors.forEach((author, index) => {
|
105
|
if (author && author.orcid) {
|
106
|
orcid_clipboard = new Clipboard('.orcid_clipboard_btn_auhtor_' + index);
|
107
|
}
|
108
|
});
|
109
|
}
|
110
|
}
|
111
|
}
|
112
|
|
113
|
public quote(params: string):string {
|
114
|
return '"'+params+'"';
|
115
|
}
|
116
|
|
117
|
public scroll() {
|
118
|
HelperFunctions.scroll();
|
119
|
}
|
120
|
}
|