[develop | DONE | FIXED]: [BUG FIX] fundedBy.component.ts: Provenance should always get the label from the respective vocabulary - calculate everything in ngOnInit.
This commit is contained in:
parent
ec57ba0dcc
commit
da4a5f3321
|
@ -20,14 +20,16 @@ import {RouterHelper} from "../../utils/routerHelper.class";
|
|||
</div>
|
||||
<div *ngIf="!isMobile">
|
||||
<span *ngFor="let item of fundedByProjects.slice(0, viewAll?fundedByProjects.length:threshold) let i=index">
|
||||
<span class="uk-text-emphasis">
|
||||
<span class="uk-text-emphasis" (click)="dropClicked=true">
|
||||
<a class="uk-link uk-link-text">
|
||||
<ng-container *ngTemplateOutlet="funder; context: {item: item}"></ng-container>
|
||||
</a>
|
||||
</span>
|
||||
<div class="default-dropdown uk-margin-remove-top uk-dropdown"
|
||||
uk-dropdown="pos: bottom-left; mode:click">
|
||||
<ng-container *ngTemplateOutlet="dropInfo; context: { item: item}"></ng-container>
|
||||
<ng-container *ngIf="dropClicked">
|
||||
<ng-container *ngTemplateOutlet="dropInfo; context: { item: item, index: i}"></ng-container>
|
||||
</ng-container>
|
||||
</div>
|
||||
<span *ngIf="i < (fundedByProjects.slice(0, viewAll?fundedByProjects.length:threshold).length - 1)">, </span>
|
||||
</span>
|
||||
|
@ -35,13 +37,13 @@ import {RouterHelper} from "../../utils/routerHelper.class";
|
|||
<div *ngIf="isMobile">
|
||||
<div *ngFor="let item of fundedByProjects.slice(0, viewAll?fundedByProjects.length:threshold) let i=index"
|
||||
class="uk-flex uk-flex-middle uk-margin-small-bottom">
|
||||
<span class="uk-text-emphasis uk-width-expand">
|
||||
<span class="uk-text-emphasis uk-width-expand" (click)="dropClicked=true">
|
||||
<ng-container *ngTemplateOutlet="funder; context: {item: item}"></ng-container>
|
||||
</span>
|
||||
<a #toggle><icon name="info" visuallyHidden="info" [type]="'outlined'"></icon></a>
|
||||
<mobile-dropdown [toggle]="toggle">
|
||||
<div class="uk-margin-remove-top">
|
||||
<ng-container *ngTemplateOutlet="dropInfo; context: { item: item}"></ng-container>
|
||||
<div *ngIf="dropClicked" class="uk-margin-remove-top">
|
||||
<ng-container *ngTemplateOutlet="dropInfo; context: { item: item, index: i}"></ng-container>
|
||||
</div>
|
||||
</mobile-dropdown>
|
||||
</div>
|
||||
|
@ -54,7 +56,7 @@ import {RouterHelper} from "../../utils/routerHelper.class";
|
|||
<span *ngIf="item['acronym'] || item['title']">| {{ item['acronym'] ? item['acronym'] : item['title']}}</span>
|
||||
</ng-template>
|
||||
|
||||
<ng-template #dropInfo let-item=item>
|
||||
<ng-template #dropInfo let-item=item let-index=index>
|
||||
<div class="uk-padding-small">
|
||||
<span>Project</span>
|
||||
<div class="uk-margin-bottom">
|
||||
|
@ -84,7 +86,7 @@ import {RouterHelper} from "../../utils/routerHelper.class";
|
|||
<span class="uk-text-meta">Funding stream: </span>{{item.funding}}
|
||||
</li>
|
||||
</ul>
|
||||
<div *ngIf="getVocabularyLabel(item, provenanceActionVocabulary, i) || item.validated" class="uk-text-meta">
|
||||
<div *ngIf="item.provenanceAction || item.validated" class="uk-text-meta">
|
||||
<span *ngIf="item.validated">Validated by funder</span>
|
||||
<span *ngIf="item.provenanceAction && item.validated"> | </span>
|
||||
<span *ngIf="item.provenanceAction">{{item.provenanceAction}}</span>
|
||||
|
@ -105,8 +107,15 @@ export class FundedByComponent {
|
|||
public url = properties.searchLinkToProject.split('?')[0];
|
||||
public title: string = "Funded by";
|
||||
@Input() provenanceActionVocabulary = null;
|
||||
public provenancesCalculated: boolean[] = [];
|
||||
// public provenancesCalculated: boolean[] = [];
|
||||
public routerHelper:RouterHelper = new RouterHelper();
|
||||
public dropClicked: boolean = false;
|
||||
|
||||
public ngOnInit() {
|
||||
this.fundedByProjects.forEach((project, index) => {
|
||||
this.getVocabularyLabel(project, this.provenanceActionVocabulary, index);
|
||||
})
|
||||
}
|
||||
|
||||
public viewAllClick() {
|
||||
if(this.fundedByProjects.length <= this.threshold*2) {
|
||||
|
@ -124,11 +133,11 @@ export class FundedByComponent {
|
|||
}
|
||||
|
||||
public getVocabularyLabel(item: any, vocabulary: any, index: number) {
|
||||
if(!this.provenancesCalculated[index]) {
|
||||
this.provenancesCalculated[index] = true;
|
||||
// if(!this.provenancesCalculated[index]) {
|
||||
// this.provenancesCalculated[index] = true;
|
||||
item.provenanceAction = HelperFunctions.getVocabularyLabel(item.provenanceAction, vocabulary, false);
|
||||
}
|
||||
return item.provenanceAction;
|
||||
// }
|
||||
// return item.provenanceAction;
|
||||
}
|
||||
|
||||
public addEoscPrevInParams(obj) {
|
||||
|
|
Loading…
Reference in New Issue