Add logos for funders

This commit is contained in:
Alex Martzios 2021-12-06 16:36:24 +02:00
parent 317b7a19e1
commit d1cec59bae
5 changed files with 51 additions and 21 deletions

View File

@ -152,13 +152,16 @@
<numbers #numbersComponent [defaultInit]="false" backgroundClass="numbers-background"></numbers>
</div>
<!-- Funders Cards -->
<div *ngIf="properties.environment == 'development'" class="uk-section uk-padding-remove-bottom">
<div *ngIf="properties.environment == 'development' && funders.length" class="uk-section uk-padding-remove-bottom">
<h3 class="uk-text-center uk-margin-medium-bottom">Our Canadian <span class="uk-text-bold">Funders</span></h3>
<!-- TODO: individual component -->
<div class="uk-section uk-container uk-container-large">
<div class="uk-grid uk-child-width-1-3" uk-grid uk-height-match="target: > div > .uk-card">
<div *ngFor="let funder of funders">
<div [routerLink]="properties.searchLinkToResults" [queryParams]="funder.params" class="uk-card uk-card-default uk-card-body uk-text-center">
<div [routerLink]="properties.searchLinkToResults" [queryParams]="funder.params" class="uk-card uk-card-default uk-card-body uk-text-center uk-link">
<div class="uk-margin-bottom">
<img *ngIf="funder.logo" src={{funder.logo}} style="max-height: 80px;">
</div>
<div class="uk-margin-bottom">
<h4>{{funder.name}}</h4>
</div>

View File

@ -143,7 +143,7 @@ export class HomeComponent {
this.numbersComponent.init(false, false, this.showPublications, this.showDatasets,
this.showSoftware, this.showOrp, this.showProjects, this.showDataProviders,
StringUtils.URIEncode(this.customFilter.queryFieldName + " exact " + StringUtils.quote((this.customFilter.valueId ))));
this.getTopFunders();
this.getFunders();
}
},
error => {
@ -225,32 +225,59 @@ export class HomeComponent {
return params;
}
getTopFunders() {
getFunders() {
let refineParams1 = '&fq=country%20exact%20%22CA%22';
let refineParams2 = '&fq=resultbestaccessright%20exact%20%22Open%20Access%22&fq=country%20exact%20%22CA%22%20';
this.subs.push(zip(
this._refineFieldResultsService.getRefineFieldsResultsByEntityName(['relfunder'], 'result', this.properties, refineParams1),
this._refineFieldResultsService.getRefineFieldsResultsByEntityName(['relfunder'], 'result', this.properties, refineParams2)
).subscribe((data: any[]) => {
for(let i = 0; i < this.noOfFunders; i++) {
this.funders.push({
"id": data[0][1][0].values[i].id,
"name": data[0][1][0].values[i].name,
"publications": data[0][1][0].values[i].number,
"openAccessPublications": null,
"params": {
relfunder: '"'+encodeURIComponent(data[0][1][0].values[i].id)+'"'
}
});
}
let allFunders = data[1][1][0].values;
allFunders.forEach(funder => {
for(let topFunder of this.funders) {
if(funder.id == topFunder.id) {
topFunder.openAccessPublications = funder.number;
let queriedFunders1 = data[0][1][0].values;
queriedFunders1.forEach(queriedFunder => {
if(queriedFunder.id.includes('nserc')) {
this.funders.push({
"id": queriedFunder.id,
"name": queriedFunder.name,
"publications": queriedFunder.number,
"openAccessPublications": null,
"logo": 'assets/nserc_logo.png',
"params": {
relfunder: '"'+encodeURIComponent(queriedFunder.id)+'"'
}
});
} else if(queriedFunder.id.includes('cihr')) {
this.funders.push({
"id": queriedFunder.id,
"name": queriedFunder.name,
"publications": queriedFunder.number,
"openAccessPublications": null,
"logo": 'assets/cihr_logo.png',
"params": {
relfunder: '"'+encodeURIComponent(queriedFunder.id)+'"'
}
});
} else if(queriedFunder.id.includes('sshrc')) {
this.funders.push({
"id": queriedFunder.id,
"name": queriedFunder.name,
"publications": queriedFunder.number,
"openAccessPublications": null,
"logo": 'assets/sshrc_logo.png',
"params": {
relfunder: '"'+encodeURIComponent(queriedFunder.id)+'"'
}
});
}
});
let queriedFunders2 = data[1][1][0].values;
queriedFunders2.forEach(queriedFunder => {
for(let funder of this.funders) {
if(queriedFunder.id == funder.id) {
funder.openAccessPublications = queriedFunder.number;
}
}
});
}))
// console.log(this.funders);
}));
}
}

BIN
src/assets/cihr_logo.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 189 KiB

BIN
src/assets/nserc_logo.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 49 KiB

BIN
src/assets/sshrc_logo.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB