Add funders cards in homepage
This commit is contained in:
parent
638cec68df
commit
317b7a19e1
|
@ -151,6 +151,29 @@
|
|||
<h3 class="uk-text-center uk-margin-medium-bottom">Our growing <span class="uk-text-bold">Community</span></h3>
|
||||
<numbers #numbersComponent [defaultInit]="false" backgroundClass="numbers-background"></numbers>
|
||||
</div>
|
||||
<!-- Funders Cards -->
|
||||
<div *ngIf="properties.environment == 'development'" 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 class="uk-margin-bottom">
|
||||
<h4>{{funder.name}}</h4>
|
||||
</div>
|
||||
<div class="uk-margin-bottom">
|
||||
<h5 class="uk-text-bold uk-margin-remove uk-link">{{funder.publications | number}}</h5> research outcomes found
|
||||
</div>
|
||||
<div>
|
||||
<h5 class="uk-text-bold uk-margin-remove uk-link">{{(funder.openAccessPublications / funder.publications) * 100 | number : '1.0-0'}}%</h5> Open Access
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!--<helper *ngIf="pageContents && pageContents['left'] && pageContents['left'].length > 0"-->
|
||||
<!-- [texts]="pageContents['left']"></helper>-->
|
||||
<!--<div class="uk-section-muted"-->
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import {Component, ViewChild} from '@angular/core';
|
||||
import {Subscription} from 'rxjs';
|
||||
import {Subscription, zip} from 'rxjs';
|
||||
import {ActivatedRoute, Router} from '@angular/router';
|
||||
import {Location} from '@angular/common';
|
||||
import {Meta, Title} from '@angular/platform-browser';
|
||||
|
@ -46,6 +46,9 @@ export class HomeComponent {
|
|||
properties: EnvProperties = properties;
|
||||
public readMore: boolean = false;
|
||||
|
||||
private noOfFunders = 3;
|
||||
public funders = [];
|
||||
|
||||
subs: Subscription[] = [];
|
||||
|
||||
resultsQuickFilter: { filter: Filter, selected: boolean, filterId: string, value: string } = {
|
||||
|
@ -140,6 +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();
|
||||
}
|
||||
},
|
||||
error => {
|
||||
|
@ -220,4 +224,33 @@ export class HomeComponent {
|
|||
}
|
||||
return params;
|
||||
}
|
||||
|
||||
getTopFunders() {
|
||||
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;
|
||||
}
|
||||
}
|
||||
});
|
||||
}))
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit 2f65202142d48bfd51508e20f9ac0d8cb4368990
|
||||
Subproject commit ca430fd89f7654bb71f52383bd52bf58e4c70e5f
|
Loading…
Reference in New Issue