Project

General

Profile

1 43769 argiro.kok
import {Component, Input} from '@angular/core';
2
3
@Component({
4
    selector: 'showSubjects',
5
    template: `
6 45058 konstantin
        <span class="uk-description-list-horizontal" *ngIf="subjects != undefined">
7 44406 konstantin
8
            <dt *ngIf="(subjects != undefined && subjects.length > 0) ||
9
                       (otherSubjects != undefined && otherSubjects.size > 0)">
10 43769 argiro.kok
                Subjects:
11
            </dt>
12 44406 konstantin
            <dt *ngIf="(subjects == undefined || subjects.length == 0) &&
13
                       (otherSubjects == undefined || otherSubjects.size == 0) &&
14
                       (classifiedSubjects != undefined && classifiedSubjects.size > 0)">
15
                Subjects:
16
            </dt>
17
18 43769 argiro.kok
            <dd>
19 44406 konstantin
                <div *ngIf="subjects != undefined && subjects.length > 0"> {{subjects}} </div>
20
                <div *ngIf="otherSubjects != undefined && otherSubjects.size > 0">
21
                    <div *ngFor="let key of otherSubjects.keys()">
22
                        {{key}}: {{otherSubjects.get(key)}}
23
                    </div>
24
                </div>
25
                <div *ngIf="(subjects == undefined || subjects.length == 0) &&
26
                           (otherSubjects == undefined || otherSubjects.size == 0) &&
27
                           classifiedSubjects != undefined && classifiedSubjects.size > 0">
28
                    -
29
                </div>
30 43769 argiro.kok
            </dd>
31
32 45390 konstantin
            <dd *ngIf="classifiedSubjects != undefined && classifiedSubjects.size > 0">
33
                <a (click)="showClassifiedSbj = !showClassifiedSbj;">
34
                    <div *ngIf="!showClassifiedSbj">
35
                        Show additional classifications
36 47131 argiro.kok
                      <span uk-icon="icon: plus"></span>
37 45390 konstantin
                    </div>
38
                    <div *ngIf="showClassifiedSbj">
39
                        Hide additional classifications
40 47131 argiro.kok
                        <span uk-icon="icon: minus"></span>
41 45390 konstantin
                    </div>
42
                </a>
43 43769 argiro.kok
44 47131 argiro.kok
                <div class="uk-panel uk-padding uk-background-muted" *ngIf="showClassifiedSbj">
45 45390 konstantin
                    <div *ngFor="let key of classifiedSubjects.keys()">
46
                        Classified by OpenAIRE into
47
                        <div>
48
                            {{key}}: {{classifiedSubjects.get(key)}}
49 43769 argiro.kok
                        </div>
50
                    </div>
51 45058 konstantin
                </div>
52 43769 argiro.kok
            </dd>
53 45058 konstantin
        </span>
54 43769 argiro.kok
    `
55
56
    })
57
58
export class ShowSubjectsComponent {
59
    @Input() subjects: string[];
60 44406 konstantin
    @Input() otherSubjects: Map<string, string[]>;
61 43769 argiro.kok
    @Input() classifiedSubjects: Map<string, string[]>;
62
    private showClassifiedSbj: boolean = false;
63
64
    constructor () {
65
    }
66
67
    ngOnInit() {
68
    }
69
}