Project

General

Profile

1
import {Component, Input} from '@angular/core';
2
import {HelperFunctions} from "../../utils/HelperFunctions.class";
3
import {Project} from "../../utils/result-preview/result-preview";
4
import {properties} from "../../../../environments/environment";
5

    
6
@Component({
7
  selector: 'fundedBy',
8
  template: `
9
    <div class="uk-text-muted">Funded by</div>
10
    <span *ngFor="let item of fundedByProjects.slice(0, showNum) let i=index">
11
          <a>
12
            <mark *ngIf="item.inline">
13
              <span
14
                  *ngIf="item['funderShortname'] || item['funderName']">{{item['funderShortname'] ? item['funderShortname'] : item['funderName']}}</span>
15
              <span *ngIf="!item['funderShortname'] && !item['funderName']">[no funder available]</span>
16
              <span
17
                  *ngIf="item['acronym'] || item['title']">| {{ item['acronym'] ? item['acronym'] : item['title']}}</span>
18
            </mark>
19
            <span *ngIf="!item.inline">
20
              <span
21
                  *ngIf="item['funderShortname'] || item['funderName']">{{item['funderShortname'] ? item['funderShortname'] : item['funderName']}}</span>
22
              <span *ngIf="!item['funderShortname'] && !item['funderName']">[no funder available]</span>
23
              <span
24
                  *ngIf="item['acronym'] || item['title']">| {{ item['acronym'] ? item['acronym'] : item['title']}}</span>
25
            </span>
26
          </a>
27
          <div class="default-dropdown uk-margin-remove-top uk-padding-small uk-dropdown"
28
               uk-dropdown="pos: bottom-left; mode:click">
29
            <span>Project</span>
30
            <div class="uk-margin-bottom">
31
              <a *ngIf="item.id" class="uk-h6 uk-margin-remove portal-link"
32
                 [queryParams]="{projectId: item.id}" [routerLink]="url">
33
                {{item['acronym'] ? item['acronym'] : item['title']}}
34
              </a>
35
              <span *ngIf="!item.id" class="uk-h6 uk-margin-remove">
36
                {{item['acronym'] ? item['acronym'] : item['title']}}
37
              </span>
38
              <div *ngIf="item.acronym && item.title">
39
                {{item.title}}
40
              </div>
41
            </div>
42
            <ul class="uk-list uk-padding-remove-left uk-margin-bottom">
43
              <li *ngIf="item.funderShortname || item.funderName">
44
                <span class="uk-text-muted">Funder: </span>
45
                {{item.funderName ? item.funderName : item.funderShortname}}
46
                <span *ngIf="item.funderShortname && item.funderName">
47
                  ({{item.funderShortname}})
48
                </span>
49
              </li>
50
              <li *ngIf="item.code">
51
                <span class="uk-text-muted">Project Code: </span>{{item.code}}
52
              </li>
53
              <li *ngIf="item.funding">
54
                <span class="uk-text-muted">Funding stream: </span>{{item.funding}}
55
              </li>
56
            </ul>
57
            <div *ngIf="item.provenanceAction" class="uk-text-muted">
58
              {{item.provenanceAction}}
59
            </div>
60
          </div>
61
          <span *ngIf="i < (fundedByProjects.slice(0, showNum).length - 1)">, </span>
62
        </span>
63
    <div *ngIf="showNum > threshold" class="uk-text-right uk-margin-bottom">
64
      <a (click)="showNum = threshold; scroll()">
65
        View less
66
      </a>
67
    </div>
68
    <div *ngIf="showNum == threshold && fundedByProjects && fundedByProjects.length > threshold"
69
         class="uk-text-right uk-margin-bottom">
70
      <a (click)="showNum = fundedByProjects.length;">
71
        View more
72
      </a>
73
    </div>
74
  `
75
})
76

    
77
export class FundedByComponent {
78
  @Input() fundedByProjects: Project[];
79
  
80
  public threshold: number = 5;
81
  public showNum: number = 5;
82
  public url = properties.searchLinkToProject.split('?')[0];
83
  
84
  public scroll() {
85
    HelperFunctions.scroll();
86
  }
87
}
(3-3/17)