From faad25e780f8421f71a19ac71c3ff0fec611d7db Mon Sep 17 00:00:00 2001 From: "konstantina.galouni" Date: Thu, 20 Jun 2024 16:23:51 +0300 Subject: [PATCH] [develop | DONE | ADDED]: package.json: Added on dependencies "flag-icons": "^7.2.1" (library to show flag icon according to country code) | funders.component.less: Import "flag-icons/css/flag-icons.min.css" | funders.component.ts: Added for funders fields "websiteUrl", "country", "registered" & added sorting option by country (asc) | funders.component.html: Display new fundes info ("websiteUrl", "country", "registered"). --- explore/package.json | 1 + .../src/app/funders/funders.component.html | 28 +++++---- .../src/app/funders/funders.component.less | 2 +- explore/src/app/funders/funders.component.ts | 63 ++++++++++++------- 4 files changed, 59 insertions(+), 35 deletions(-) diff --git a/explore/package.json b/explore/package.json index 6b878b15..4c4c7078 100644 --- a/explore/package.json +++ b/explore/package.json @@ -39,6 +39,7 @@ "clipboard": "^1.5.16", "core-js": "^2.5.4", "express": "^4.15.2", + "flag-icons": "^7.2.1", "jquery": "^3.4.1", "ng-recaptcha": "^12.0.2", "prom-client": "^11.3.0", diff --git a/explore/src/app/funders/funders.component.html b/explore/src/app/funders/funders.component.html index d45e11c3..0ee945d6 100644 --- a/explore/src/app/funders/funders.component.html +++ b/explore/src/app/funders/funders.component.html @@ -126,17 +126,18 @@
- - + +
+
Registered
-
--> +
@@ -156,11 +157,11 @@ {{funder.name}}
- +
@@ -237,6 +238,7 @@
+
{{funder.name}} @@ -310,19 +312,19 @@
- +
diff --git a/explore/src/app/funders/funders.component.less b/explore/src/app/funders/funders.component.less index 7da80274..df313bbc 100644 --- a/explore/src/app/funders/funders.component.less +++ b/explore/src/app/funders/funders.component.less @@ -1,5 +1,5 @@ @import (reference) "~src/assets/openaire-theme/less/color.less"; - +@import "flag-icons/css/flag-icons.min.css"; .custom-coins-dot:after { content: ""; diff --git a/explore/src/app/funders/funders.component.ts b/explore/src/app/funders/funders.component.ts index 29a587cd..a9ea2a88 100644 --- a/explore/src/app/funders/funders.component.ts +++ b/explore/src/app/funders/funders.component.ts @@ -59,22 +59,25 @@ export class FundersComponent implements OnInit { "projects": number, "monitorDashboard": string, "monitorDashboardStatus": string, - "logoUrl": string + "logoUrl": string, + "websiteUrl": string, + "country": string, + "registered": boolean }>(); - staticLogos: Set = new Set([ - "arc_________::ARC||Australian Research Council (ARC)||ARC", - "asap________::ASAP||Aligning Science Across Parkinson's||ASAP", - "cihr________::CIHR||Canadian Institutes of Health Research||CIHR", - "euenvagency_::EEA||European Environment Agency||EEA", - "inca________::INCA||Institut National du Cancer||INCa", - "nhmrc_______::NHMRC||National Health and Medical Research Council (NHMRC)||NHMRC", - "nih_________::NIH||National Institutes of Health||NIH", - "nserc_______::NSERC||Natural Sciences and Engineering Research Council of Canada||NSERC", - "nsf_________::NSF||National Science Foundation||NSF", - "sshrc_______::SSHRC||Social Sciences and Humanities Research Council||SSHRC", - "taraexp_____::tara||Tara Expeditions Foundation||TARA", - "ukri________::UKRI||UK Research and Innovation||UKRI", - "wt__________::WT||Wellcome Trust||WT" + staticLogos: Map = new Map([ + ["arc_________::ARC", "ARC"], + ["asap________::ASAP", "ASAP"], + ["cihr________::CIHR", "CIHR"], + ["euenvagency_::EEA", "EEA"], + ["inca________::INCA", "INCa"], + ["nhmrc_______::NHMRC", "NHMRC"], + ["nih_________::NIH", "NIH"], + ["nserc_______::NSERC", "NSERC"], + ["nsf_________::NSF", "NSF"], + ["sshrc_______::SSHRC", "SSHRC"], + ["taraexp_____::tara", "TARA"], + ["ukri________::UKRI", "UKRI"], + ["wt__________::WT", "WT"] ]); constructor(private router: Router, @@ -111,7 +114,8 @@ export class FundersComponent implements OnInit { this.sortOptions = [ {value: 'alphAsc', label: 'Alphabetically Asc. (A-Z)'}, {value: 'alphDsc', label: 'Alphabetically Dsc. (Z-A)'}, - {value: 'oaDsc', label: '"Open Access %" Dsc.'} + {value: 'oaDsc', label: '"Open Access %" Dsc.'}, + {value: 'countryAsc', label: 'Country Asc. (A-Z)'} ]; this.getFunders(); this.keywordControl = this.fb.control(''); @@ -160,7 +164,10 @@ export class FundersComponent implements OnInit { "projects": +queriedFunder.projects, "monitorDashboard": '', "monitorDashboardStatus": '', - "logoUrl": '' + "logoUrl": '', + "websiteUrl": '', + "country": queriedFunder.country, + "registered": queriedFunder.registered }; if((!funder.researchProducts || funder.researchProducts == 0) && (!funder.projects || funder.projects == 0)) { @@ -172,7 +179,10 @@ export class FundersComponent implements OnInit { funder.alias = stakeholder.alias; funder.monitorDashboard = stakeholder.alias; funder.monitorDashboardStatus = stakeholder.visibility; - funder.logoUrl = (stakeholder.isUpload ? properties.utilsService + "/download/" : "")+ (stakeholder.logoUrl); + if(stakeholder.logoUrl) { + funder.logoUrl = (stakeholder.isUpload ? properties.utilsService + "/download/" : "") + (stakeholder.logoUrl); + } + funder.websiteUrl = stakeholder.websiteUrl; } if(funder.openAccessResearchProducts && funder.researchProducts) { @@ -180,9 +190,7 @@ export class FundersComponent implements OnInit { } if(!funder.logoUrl && this.staticLogos.has(funder.id)) { - let split = funder.id.split("||"); - let shortname = (split && split.length==3) ? funder.id.split("||")[2] : funder.id; - funder.logoUrl = "assets/explore-assets/funders/logos/"+shortname+".png"; + funder.logoUrl = "assets/explore-assets/funders/logos/"+this.staticLogos.get(funder.id)+".png"; } this.fundersMap.set(queriedFunder.id, funder); @@ -335,6 +343,19 @@ export class FundersComponent implements OnInit { case 'oaDsc': this.funders = this.funders.sort((a, b) => b['openAccessPercentage'] - a['openAccessPercentage']); break; + case 'countryAsc': + this.funders = this.funders.sort((a, b) => { + if(a['country'] && b['country']) { + return a['country'].localeCompare(b['country']) + } else if(!a['country'] && !b['country']) { + return 0; + } else if(!a['country']) { + return 1; + } else { + return -1; + } + }); + break; } this.filtering(); }