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