From 63b466fdaf4fb9b4af00e84f5e6d03361bce31a8 Mon Sep 17 00:00:00 2001 From: "k.triantafyllou" Date: Wed, 22 Feb 2023 14:43:31 +0200 Subject: [PATCH] 1. Fix uk-drop in available on. 2. Entity metadata: Add bullet with css in order to avoid empty content. 3. Add Deposit and embed in actions of entity-actions. --- .../landing-utils/availableOn.component.ts | 2 +- .../entity-metadata.component.less | 11 + .../entity-metadata.component.ts | 197 ++++++++---------- .../landing-utils/showPublisher.component.ts | 3 +- .../entity-actions.component.ts | 115 +++++++++- utils/entity-actions/entity-actions.module.ts | 5 +- .../result-preview.component.html | 6 +- .../result-preview.component.ts | 21 +- 8 files changed, 234 insertions(+), 126 deletions(-) create mode 100644 landingPages/landing-utils/entity-metadata.component.less diff --git a/landingPages/landing-utils/availableOn.component.ts b/landingPages/landing-utils/availableOn.component.ts index 2f71be7b..a693d576 100644 --- a/landingPages/landing-utils/availableOn.component.ts +++ b/landingPages/landing-utils/availableOn.component.ts @@ -26,7 +26,7 @@ declare var UIkit;
+ class="uk-drop download-drop uk-card uk-card-default uk-padding-small uk-padding-remove-horizontal uk-text-small">
diff --git a/landingPages/landing-utils/entity-metadata.component.less b/landingPages/landing-utils/entity-metadata.component.less new file mode 100644 index 00000000..9f8db1b5 --- /dev/null +++ b/landingPages/landing-utils/entity-metadata.component.less @@ -0,0 +1,11 @@ +@import (reference) "~src/assets/openaire-theme/less/_import-variables"; + +.entity-metadata { + + & > *:not(:last-child):not(.other-separator)::after { + content: "\2022"; + font-weight: normal; + margin-left: @global-xsmall-margin; + margin-right: @global-xsmall-margin; + } +} diff --git a/landingPages/landing-utils/entity-metadata.component.ts b/landingPages/landing-utils/entity-metadata.component.ts index be45b2ef..b446f758 100644 --- a/landingPages/landing-utils/entity-metadata.component.ts +++ b/landingPages/landing-utils/entity-metadata.component.ts @@ -7,83 +7,78 @@ import {Organization, Project} from "../../utils/result-preview/result-preview"; @Component({ selector: 'entity-metadata', template: ` -
+ - ` + `, + styleUrls: ['entity-metadata.component.less'] }) export class EntityMetadataComponent { @Input() entityType: string; @@ -269,4 +226,28 @@ export class EntityMetadataComponent { tooltipContent += "
"; return tooltipContent; } + + get projectNames(): string[] { + if (this.projects && this.projects.length > 0) { + return this.projects.map(project => { + let value = project.funderShortname ? project.funderShortname : project.funderName; + if (project.acronym || project.title) { + value = value + ' | ' + (project.acronym ? project.acronym : + (project.title.length > 25 ? (project.title.slice(0, 25) + '...'): project.title)); + } + if(project.code) { + value = value + ' (' + project.code + ')'; + } + return value; + }); + } + return []; + } + + get organizationNames(): string[] { + if (this.organizations && this.organizations.length > 0) { + return this.organizations.map(organization => organization.name); + } + return []; + } } diff --git a/landingPages/landing-utils/showPublisher.component.ts b/landingPages/landing-utils/showPublisher.component.ts index b480018f..004c146a 100644 --- a/landingPages/landing-utils/showPublisher.component.ts +++ b/landingPages/landing-utils/showPublisher.component.ts @@ -8,7 +8,6 @@ import {EnvProperties} from "../../utils/properties/env-properties"; || journal['volume'] || journal['eissn'] || journal['issue'])"> - {{journal['journal']}} , @@ -65,9 +64,9 @@ import {EnvProperties} from "../../utils/properties/env-properties"; ) + - {{publisher}} ` diff --git a/utils/entity-actions/entity-actions.component.ts b/utils/entity-actions/entity-actions.component.ts index 7894e41e..de1a2fca 100644 --- a/utils/entity-actions/entity-actions.component.ts +++ b/utils/entity-actions/entity-actions.component.ts @@ -1,17 +1,21 @@ -import {Component, Input, ViewChild} from "@angular/core"; +import {Component, Input, OnInit, ViewChild} from "@angular/core"; import {StringUtils} from "../string-utils.class"; import {RouterHelper} from "../routerHelper.class"; import {properties} from "../../../../environments/environment"; +import {Router} from "@angular/router"; +import {Option} from "../../sharedComponents/input/input.component"; +import {OpenaireEntities} from "../properties/searchFields"; +import {EnvProperties} from "../properties/env-properties"; @Component({ selector: 'entity-actions', template: `
- Link to @@ -26,34 +30,87 @@ import {properties} from "../../../../environments/environment"; Cite + + + Deposit + + + + Embed +
+ [type]="getTypeName().toLowerCase()" [piwikSiteId]="properties.piwikSiteId"> + +
+
+
+
+
{{getDynamicContent(embed_research_results_type)}}
+ +
+ +
+ For further information contact us at + {{properties.helpdeskEmail}} +
+
+
+
` }) -export class EntityActionsComponent { +export class EntityActionsComponent implements OnInit { @Input() result: any; @Input() type: string; @Input() id: string; @Input() linking: boolean = false; @Input() share: boolean = false; @Input() cite: boolean = false; + @Input() deposit: boolean = false; + @Input() embed: boolean = false; @Input() url: string; - public piwikSiteId = properties.piwikSiteId; public citeThisClicked: boolean; public routerHelper: RouterHelper = new RouterHelper(); @ViewChild('citeModal') citeModal; + @ViewChild('embedResultsModal') embedResultsModal; + @ViewChild('downloadReportModal') downloadReportModal; @ViewChild('addThisModal') addThisModal; - - constructor() { + properties: EnvProperties = properties; + + + /* Embed */ + public embed_research_results_type: string = "result"; + public clipboard; + public resultTypesForEmbedding: Option[]=[ + {label: "All "+OpenaireEntities.RESULTS, value: "result"}, + {label: OpenaireEntities.PUBLICATIONS, value: "publication"}, + {label: OpenaireEntities.DATASETS, value: "dataset"}, + {label: OpenaireEntities.SOFTWARE, value: "software"}, + {label: OpenaireEntities.OTHER, value: "other"}]; + + constructor(private router: Router) { } - + + ngOnInit() { + this.createClipboard(); + } + get linkTo():string { return this.type === 'project'?'result':'project'; } @@ -71,10 +128,48 @@ export class EntityActionsComponent { } public openAddThisModal() { - console.log(this.url); this.addThisModal.cancelButton = false; this.addThisModal.okButton = false; this.addThisModal.alertTitle = "Share this " + this.getTypeName() + " in your social networks"; this.addThisModal.open(); } + + public openEmbedResultsModal() { + this.embedResultsModal.cancelButton = false; + this.embedResultsModal.okButton = false; + this.embedResultsModal.alertTitle = "Embed results"; + this.embedResultsModal.open(); + } + + private createClipboard() { + if (typeof window !== 'undefined') { + delete this.clipboard; + let Clipboard; + Clipboard = require('clipboard'); + this.clipboard = new Clipboard('.clipboard_btn'); + } + } + + getDynamicContent(type: string) { + return ""; + } + + isRouteAvailable(routeToCheck: string) { + for (let i = 0; i < this.router.config.length; i++) { + let routePath: string = this.router.config[i].path; + if (routePath == routeToCheck) { + return true; + } + } + return false; + } } diff --git a/utils/entity-actions/entity-actions.module.ts b/utils/entity-actions/entity-actions.module.ts index 5a49c744..b90cd9b3 100644 --- a/utils/entity-actions/entity-actions.module.ts +++ b/utils/entity-actions/entity-actions.module.ts @@ -1,14 +1,15 @@ import {NgModule} from "@angular/core"; import {CommonModule} from "@angular/common"; import {EntityActionsComponent} from "./entity-actions.component"; -import {RouterLinkWithHref} from "@angular/router"; +import {RouterModule} from "@angular/router"; import {IconsModule} from "../icons/icons.module"; import {AlertModalModule} from "../modal/alertModal.module"; import {CiteThisModule} from "../../landingPages/landing-utils/citeThis/citeThis.module"; import {LandingModule} from "../../landingPages/landing-utils/landing.module"; +import {InputModule} from "../../sharedComponents/input/input.module"; @NgModule({ - imports: [CommonModule, RouterLinkWithHref, IconsModule, AlertModalModule, CiteThisModule, LandingModule], + imports: [CommonModule, IconsModule, AlertModalModule, CiteThisModule, LandingModule, RouterModule, InputModule], declarations: [EntityActionsComponent], exports: [EntityActionsComponent] }) diff --git a/utils/result-preview/result-preview.component.html b/utils/result-preview/result-preview.component.html index 9e4e1132..08009fda 100644 --- a/utils/result-preview/result-preview.component.html +++ b/utils/result-preview/result-preview.component.html @@ -171,8 +171,10 @@
- 0; } + + projectActions() { + this.linking = true; + this.share = true; + this.deposit = true; + this.embed = true; + } + + organizationActions() { + this.share = true; + } + + contentProviderActions() { + this.share = true; + } ngOnChanges(changes: SimpleChanges) { if (changes.result && this.hasLink) {