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> <numbers #numbersComponent [defaultInit]="false" backgroundClass="numbers-background"></numbers>
</div> </div>
<!-- Funders Cards --> <!-- 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> <h3 class="uk-text-center uk-margin-medium-bottom">Our Canadian <span class="uk-text-bold">Funders</span></h3>
<!-- TODO: individual component --> <!-- TODO: individual component -->
<div class="uk-section uk-container uk-container-large"> <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 class="uk-grid uk-child-width-1-3" uk-grid uk-height-match="target: > div > .uk-card">
<div *ngFor="let funder of funders"> <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"> <div class="uk-margin-bottom">
<h4>{{funder.name}}</h4> <h4>{{funder.name}}</h4>
</div> </div>

View File

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