Project

General

Profile

1 61381 k.triantaf
import {Component, Input} from '@angular/core';
2
3
@Component({
4
  selector: 'showSubjects',
5
  template: `
6
    <div class="uk-text-muted">
7
      Subjects
8
    </div>
9
    <div class="uk-margin-small-top">
10
      <div>
11
        <ng-container *ngIf="classifiedSubjects && classifiedSubjects.size > 0">
12
          <div *ngFor="let key of getKeys(classifiedSubjects)" style="line-height: 20px">
13
            <span uk-icon="tag"></span>
14
            <span class="uk-text-bold uk-text-uppercase"> {{key}}: </span>
15
            <ng-container *ngFor="let subject of classifiedSubjects.get(key)">
16
              <span class="uk-display-inline-block label-classified">{{subject}}</span>
17
            </ng-container>
18
          </div>
19
        </ng-container>
20
        <div *ngIf="(subjects && subjects.length > 0) || (otherSubjects && otherSubjects.size > 0)" class="uk-text-break">
21
          <span uk-icon="tag"></span>
22
          <span class="uk-text-bold uk-text-uppercase"> free text keywords: </span>
23
          <span *ngIf="subjects && subjects.length > 0">{{subjects.join(', ')}}</span>
24
          <span *ngIf="(subjects && subjects.length > 0) && (otherSubjects && otherSubjects.size > 0)">, </span>
25
          <span *ngIf="otherSubjects && otherSubjects.size > 0">
26
          <span *ngFor="let key of getKeys(otherSubjects); let i=index">
27
          <span *ngIf="otherSubjects.get(key).length > 0">
28
            <span>{{otherSubjects.get(key).join(', ')}}</span>
29
            <span *ngIf="i < (otherSubjects.size - 1)">, </span>
30
          </span>
31
        </span>
32
      </span>
33
        </div>
34
      </div>
35
    </div>
36
  `
37
})
38
39
export class ShowSubjectsComponent {
40
  @Input() subjects: string[];
41
  @Input() otherSubjects: Map<string, string[]>;
42
  @Input() classifiedSubjects: Map<string, string[]>;
43
44
  // private showClassifiedSbj: boolean = false;
45
46
  constructor() {
47
  }
48
49
  ngOnInit() {
50
  }
51
52
  public getKeys(map) {
53
    return Array.from(map.keys());
54
  }
55
}