2022-06-23 18:46:53 +02:00
|
|
|
import {Component, Inject, Input, PLATFORM_ID, ViewChild} from '@angular/core';
|
2020-01-28 17:20:54 +01:00
|
|
|
import {ActivatedRoute} from "@angular/router";
|
|
|
|
import {RouterHelper} from "../routerHelper.class";
|
|
|
|
import {EnvProperties} from '../properties/env-properties';
|
2019-10-02 16:17:31 +02:00
|
|
|
import {isPlatformBrowser} from "@angular/common";
|
2020-03-13 12:42:57 +01:00
|
|
|
import {Author} from "../result-preview/result-preview";
|
2020-03-16 14:09:46 +01:00
|
|
|
import {AlertModal} from "../modal/alert";
|
2020-07-13 16:42:34 +02:00
|
|
|
import {properties} from "../../../../environments/environment";
|
2019-05-29 14:24:43 +02:00
|
|
|
|
|
|
|
@Component({
|
|
|
|
selector: 'showAuthors',
|
|
|
|
template: `
|
2022-04-16 09:47:30 +02:00
|
|
|
<ng-template #author_template let-author="author" let-i="i">
|
2022-06-16 18:37:31 +02:00
|
|
|
<span *ngIf="isSticky || (!author.orcid && !author.orcid_pending) || !testBrowser" style="margin-right: 5px;">
|
2022-06-09 15:10:04 +02:00
|
|
|
{{author.fullName + ";"}}
|
2022-04-12 13:51:54 +02:00
|
|
|
</span>
|
2022-06-16 18:37:31 +02:00
|
|
|
<a *ngIf="!isSticky && (author.orcid || author.orcid_pending) && testBrowser" class="uk-flex-inline uk-flex-middle uk-link-text">
|
2022-06-09 15:10:04 +02:00
|
|
|
<img *ngIf="author.orcid" src="assets/common-assets/common/ORCIDiD_icon16x16.png" alt="orcid" loading="lazy" style="width:16px; height:16px; margin-right: 3px;">
|
|
|
|
<img *ngIf="!author.orcid && author.orcid_pending" src="assets/common-assets/common/ORCIDiD_iconbw16x16.png" alt="orcid bw" loading="lazy" style="margin-right: 3px;">
|
|
|
|
<span style="margin-right: 5px;">
|
|
|
|
{{author.fullName + ";"}}
|
|
|
|
</span>
|
2022-04-12 13:51:54 +02:00
|
|
|
</a>
|
2022-06-16 18:37:31 +02:00
|
|
|
<div *ngIf="!isSticky && (author.orcid || author.orcid_pending) && testBrowser"
|
2022-05-17 11:15:15 +02:00
|
|
|
class="default-dropdown uk-margin-remove-top uk-dropdown orcid-dropdown"
|
2022-04-16 09:47:30 +02:00
|
|
|
uk-dropdown="mode:click; offset: 4" style="min-width: 465px !important;">
|
2022-04-12 13:51:54 +02:00
|
|
|
<div class="uk-padding-small">
|
|
|
|
<h6 class="uk-margin-remove">{{author.fullName}}</h6>
|
|
|
|
<div>
|
|
|
|
<div class="uk-text-meta uk-margin-bottom">ORCID</div>
|
|
|
|
|
|
|
|
<div class="uk-text-meta uk-text-xsmall uk-margin-small-top uk-margin-small-bottom">
|
|
|
|
<img *ngIf="author.orcid" src="assets/common-assets/common/ORCIDiD_icon16x16.png" alt="" loading="lazy">{{" "}}
|
|
|
|
<img *ngIf="!author.orcid && author.orcid_pending" src="assets/common-assets/common/ORCIDiD_iconbw16x16.png" alt="" loading="lazy">{{" "}}
|
|
|
|
|
|
|
|
<i *ngIf="author.orcid">Harvested from ORCID Public Data File</i>
|
|
|
|
<i *ngIf="!author.orcid && author.orcid_pending">Derived by OpenAIRE algorithms or harvested from 3d party repositories</i>
|
|
|
|
</div>
|
|
|
|
<div>
|
2022-04-16 09:47:30 +02:00
|
|
|
<div class="clipboard-wrapper uk-width-1-1 uk-flex uk-flex-middle uk-flex-center"
|
|
|
|
style="min-height: 43px; min-width: 280px;">
|
2022-05-17 11:15:15 +02:00
|
|
|
<input #element class="uk-padding-small uk-text-emphasis uk-width-medium uk-disabled"
|
|
|
|
[value]="properties.orcidURL+(author.orcid ? author.orcid : author.orcid_pending)"/>
|
2022-04-16 09:47:30 +02:00
|
|
|
<a [class]="'uk-link copy orcid_clipboard_btn orcid_clipboard_btn_auhtor_'+i"
|
2022-05-17 11:15:15 +02:00
|
|
|
title="Copy to clipboard" (click)="copyToClipboard(element)">
|
2022-04-12 13:51:54 +02:00
|
|
|
COPY
|
|
|
|
</a>
|
2021-02-26 14:42:44 +01:00
|
|
|
</div>
|
2022-04-12 13:51:54 +02:00
|
|
|
<div class="uk-text-center uk-margin-small-top">
|
|
|
|
<a class="uk-button uk-button-text custom-external"
|
2021-02-20 10:20:05 +01:00
|
|
|
title="Visit author in ORCID" [href]="properties.orcidURL+(author.orcid ? author.orcid : author.orcid_pending)" target="_blank">
|
2022-04-12 13:51:54 +02:00
|
|
|
VISIT AUTHOR IN ORCID
|
2019-05-29 14:24:43 +02:00
|
|
|
</a>
|
2020-07-22 15:39:35 +02:00
|
|
|
</div>
|
2019-05-29 14:24:43 +02:00
|
|
|
</div>
|
2022-04-12 13:51:54 +02:00
|
|
|
</div>
|
|
|
|
|
|
|
|
<hr>
|
|
|
|
<div class="uk-margin-top uk-text-bold uk-text-emphasis uk-text-center">
|
|
|
|
{{author.fullName}} in OpenAIRE
|
|
|
|
</div>
|
|
|
|
<div class="uk-text-center uk-margin-top uk-margin-large-left uk-margin-large-right">
|
2022-06-23 18:46:53 +02:00
|
|
|
<a class="uk-button uk-button-primary uk-text-bold uk-padding-remove-top uk-padding-remove-bottom"
|
2022-04-12 13:51:54 +02:00
|
|
|
(click)="onClick()"
|
|
|
|
[queryParams]="routerHelper.createQueryParams(['orcid','oc'],[(author['orcid'] ? author['orcid'] : author['orcid_pending']),'and'])"
|
|
|
|
routerLinkActive="router-link-active" [routerLink]="properties.searchLinkToAdvancedResults">
|
|
|
|
<span class="space">Search</span>
|
|
|
|
</a>
|
|
|
|
</div>
|
2020-03-16 14:09:46 +01:00
|
|
|
</div>
|
2022-04-12 13:51:54 +02:00
|
|
|
</div>
|
|
|
|
</ng-template>
|
|
|
|
|
2022-06-09 15:10:04 +02:00
|
|
|
<div *ngIf="authors" class="uk-height-max-medium uk-overflow-auto uk-text-small uk-text-emphasis uk-flex uk-flex-wrap">
|
|
|
|
<ng-container *ngFor="let author of authors.slice(0, viewAll?authors.length:authorsLimit) let i=index">
|
2022-04-16 09:47:30 +02:00
|
|
|
<ng-container *ngTemplateOutlet="author_template; context: { author: author, i:i}"></ng-container>
|
2022-06-09 15:10:04 +02:00
|
|
|
</ng-container>
|
2023-02-20 15:59:07 +01:00
|
|
|
<span *ngIf="!showAll && authors && authors.length > authorsLimit" class="uk-text-meta">
|
|
|
|
+{{authors.length-authorsLimit | number}} more
|
|
|
|
</span>
|
2022-04-16 09:47:30 +02:00
|
|
|
<span *ngIf="showAll && authors && authors.length > authorsLimit && !viewAll">
|
2022-04-12 13:51:54 +02:00
|
|
|
<a (click)="viewAllClick();">
|
|
|
|
+{{authors.length-authorsLimit | number}} Authors
|
|
|
|
</a>
|
|
|
|
</span>
|
2023-02-20 15:59:07 +01:00
|
|
|
<div *ngIf="viewAll && lessBtn" class="uk-text-small">
|
|
|
|
<a (click)="viewAll = !viewAll; lessBtn=false;">View less</a>
|
|
|
|
</div>
|
2020-01-28 17:20:54 +01:00
|
|
|
</div>
|
2022-04-12 13:51:54 +02:00
|
|
|
|
2022-04-20 16:40:18 +02:00
|
|
|
<modal-alert #authorsModal>
|
2022-06-10 10:17:46 +02:00
|
|
|
<div class="uk-text-small uk-text-emphasis uk-grid uk-grid-column-collapse uk-grid-row-small" uk-grid>
|
|
|
|
<ng-container *ngFor="let author of authors; let i=index">
|
|
|
|
<ng-container *ngTemplateOutlet="author_template; context: { author: author, i:i}"></ng-container>
|
|
|
|
</ng-container>
|
|
|
|
</div>
|
2022-04-12 13:51:54 +02:00
|
|
|
</modal-alert>
|
2020-01-28 17:20:54 +01:00
|
|
|
`
|
2020-02-07 14:05:07 +01:00
|
|
|
|
2019-05-29 14:24:43 +02:00
|
|
|
})
|
|
|
|
|
|
|
|
export class ShowAuthorsComponent {
|
2020-02-07 14:05:07 +01:00
|
|
|
@Input() authors: Author[];
|
2022-06-16 18:37:31 +02:00
|
|
|
@Input() isSticky: boolean = false;
|
2022-04-16 09:47:30 +02:00
|
|
|
@Input() authorsLimit: number = 7;
|
2019-05-29 14:24:43 +02:00
|
|
|
@Input() showAll: boolean = true;
|
2020-03-16 14:09:46 +01:00
|
|
|
@Input() modal: AlertModal;
|
2022-04-12 13:51:54 +02:00
|
|
|
@Input() viewAll: boolean = false;
|
|
|
|
public lessBtn: boolean = false;
|
|
|
|
@ViewChild('authorsModal') authorsModal;
|
|
|
|
|
2020-07-13 16:42:34 +02:00
|
|
|
public properties: EnvProperties = properties;
|
2020-02-07 14:05:07 +01:00
|
|
|
public routerHelper: RouterHelper = new RouterHelper();
|
|
|
|
|
2019-10-02 16:17:31 +02:00
|
|
|
testBrowser: boolean;
|
2022-04-16 09:47:30 +02:00
|
|
|
public clipboard;
|
|
|
|
|
2020-02-07 14:05:07 +01:00
|
|
|
constructor(private route: ActivatedRoute, @Inject(PLATFORM_ID) private platformId: string) {
|
2019-10-02 16:17:31 +02:00
|
|
|
this.testBrowser = isPlatformBrowser(platformId);
|
|
|
|
}
|
2020-02-07 14:05:07 +01:00
|
|
|
|
2022-05-17 11:15:15 +02:00
|
|
|
ngOnInit() {}
|
2020-02-07 14:05:07 +01:00
|
|
|
|
2020-03-16 14:09:46 +01:00
|
|
|
public onClick() {
|
2020-07-22 15:39:35 +02:00
|
|
|
if (this.modal) {
|
2020-03-16 14:09:46 +01:00
|
|
|
this.modal.cancel();
|
|
|
|
}
|
|
|
|
}
|
2022-04-12 13:51:54 +02:00
|
|
|
|
|
|
|
public viewAllClick() {
|
|
|
|
if(this.authors.length <= this.authorsLimit*2) {
|
|
|
|
this.viewAll = true;
|
|
|
|
this.lessBtn = true;
|
|
|
|
} else {
|
|
|
|
this.openAuthorsModal();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public openAuthorsModal() {
|
|
|
|
this.authorsModal.cancelButton = false;
|
|
|
|
this.authorsModal.okButton = false;
|
|
|
|
this.authorsModal.alertTitle = "Authors";
|
|
|
|
this.authorsModal.open();
|
|
|
|
}
|
2022-04-16 09:47:30 +02:00
|
|
|
|
2022-05-17 11:15:15 +02:00
|
|
|
copyToClipboard(element: HTMLInputElement) {
|
|
|
|
element.select();
|
|
|
|
if (typeof document !== 'undefined') {
|
|
|
|
document.execCommand('copy');
|
2022-04-16 09:47:30 +02:00
|
|
|
}
|
|
|
|
}
|
2019-05-29 14:24:43 +02:00
|
|
|
}
|