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

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

    
73
export class FundedByComponent {
74
  @Input() fundedByProjects: Project[];
75
  
76
  public threshold: number = 5;
77
  public showNum: number = 5;
78
  
79
  public scroll() {
80
    HelperFunctions.scroll();
81
  }
82
}
(3-3/19)