86 lines
3.2 KiB
TypeScript
86 lines
3.2 KiB
TypeScript
import {Component, Input} from '@angular/core';
|
|
import {properties} from "../../../../environments/environment";
|
|
|
|
@Component({
|
|
selector: 'showSubjects',
|
|
template: `
|
|
<div class="uk-text-muted">
|
|
Subjects
|
|
</div>
|
|
<div class="uk-margin-small-top">
|
|
<div>
|
|
<ng-container *ngIf="classifiedSubjects && classifiedSubjects.size > 0">
|
|
<div *ngFor="let key of getKeys(classifiedSubjects)" style="line-height: 20px">
|
|
<span uk-icon="tag"></span>
|
|
<span class="uk-text-bold"> {{key}}: </span>
|
|
<ng-container *ngFor="let subject of classifiedSubjects.get(key)">
|
|
<span class="uk-display-inline-block label-classified">
|
|
<span *ngIf="specialSubjects.indexOf(subject) == -1 ">{{subject}}</span>
|
|
<a class="uk-link-reset" *ngIf="specialSubjects.indexOf(subject) != -1" [href]="properties.domain + properties.searchLinkToAdvancedResults +'?f0=resultsubject&fv0='+getSubjectParameter(subject) ">{{subject}}</a>
|
|
</span>
|
|
</ng-container>
|
|
</div>
|
|
</ng-container>
|
|
<div *ngIf="(subjects && subjects.length > 0) || (otherSubjects && otherSubjects.size > 0)" class="uk-text-break">
|
|
<span uk-icon="tag"></span>
|
|
<span class="uk-text-bold"> free text keywords: </span>
|
|
<span *ngIf="subjects && subjects.length > 0">{{subjects.join(', ')}}</span>
|
|
<span *ngIf="(subjects && subjects.length > 0) && (otherSubjects && otherSubjects.size > 0)">, </span>
|
|
<span *ngIf="otherSubjects && otherSubjects.size > 0">
|
|
<span *ngFor="let key of getKeys(otherSubjects); let i=index">
|
|
<span *ngIf="otherSubjects.get(key).length > 0">
|
|
<span>{{otherSubjects.get(key).join(', ')}}</span>
|
|
<span *ngIf="i < (otherSubjects.size - 1)">, </span>
|
|
</span>
|
|
</span>
|
|
</span>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
`
|
|
})
|
|
|
|
export class ShowSubjectsComponent {
|
|
@Input() subjects: string[];
|
|
@Input() otherSubjects: Map<string, string[]>;
|
|
@Input() classifiedSubjects: Map<string, string[]>;
|
|
properties = properties;
|
|
specialSubjects = [];
|
|
// private showClassifiedSbj: boolean = false;
|
|
|
|
constructor() {
|
|
if(properties.environment == 'development'){
|
|
this.specialSubjects = [
|
|
"Physics::Optics",
|
|
"Astrophysics::Cosmology and Extragalactic Astrophysics",
|
|
"Computer Science::Information Theory",
|
|
"Physics::Accelerator Physics",
|
|
"Condensed Matter::Superconductivity",
|
|
"Physics::Atomic Physics",
|
|
"Computer Science::Robotics",
|
|
"Computer Science::Computer Science and Game Theory",
|
|
"Computer Science::Neural and Evolutionary Computation",
|
|
"Mathematics::Combinatorics",
|
|
"Mathematics::Probability",
|
|
"Computer Science::Operating Systems",
|
|
"lcsh:Medicine",
|
|
"lcsh:Science",
|
|
"lcsh:Biology (General)",
|
|
"lcsh:Chemistry",
|
|
"lcsh:Engineering (General). Civil engineering (General)",
|
|
"lcsh:Technology"
|
|
];
|
|
}
|
|
}
|
|
|
|
ngOnInit() {
|
|
}
|
|
|
|
public getKeys(map) {
|
|
return Array.from(map.keys());
|
|
}
|
|
getSubjectParameter(param){
|
|
return '"' +encodeURIComponent(param)+'"';
|
|
}
|
|
}
|