1
|
import {Component, Input} from '@angular/core';
|
2
|
import { ResultInfo } from './resultInfo';
|
3
|
import { CommunityInfo } from '../../utils/communityInfo';
|
4
|
|
5
|
@Component({
|
6
|
selector: 'results-comp',
|
7
|
template: `
|
8
|
<div *ngIf="results != null && results.length > 0">
|
9
|
<div class="uk-margin-remove-vertical uk-grid-match uk-child-width-1-1 uk-child-width-1-1@m uk-child-width-1-1@l uk-child-width-1-1@xl uk-grid-small uk-grid-divider uk-grid uk-grid-stack" uk-grid="">
|
10
|
<li *ngFor="let item of results; let i = index">
|
11
|
<div class="uk-first-column">
|
12
|
<div class="el-item uk-panel">
|
13
|
<h6 class="el-title uk-margin uk-h6 uk-text-primary uk-margin-remove-adjacent uk-margin-remove-bottom">
|
14
|
<div *ngIf="item.type == 'publication'">
|
15
|
<a [queryParams]="{articleId: item.id, community: community.communityId}" routerLinkActive="router-link-active" routerLink="/search/publication" >
|
16
|
{{item.title}} </a>
|
17
|
</div>
|
18
|
<div *ngIf="item.type == 'dataset'">
|
19
|
<a [queryParams]="{datasetId: item.id, community: community.communityId}" routerLinkActive="router-link-active" routerLink="/search/dataset" >
|
20
|
{{item.title}} </a>
|
21
|
</div>
|
22
|
<div *ngIf="item.type == 'software'">
|
23
|
<a [queryParams]="{softwareId: item.id, community: community.communityId}" routerLinkActive="router-link-active" routerLink="/search/software" >
|
24
|
{{item.title}} </a>
|
25
|
</div>
|
26
|
</h6>
|
27
|
<div class="el-content"><span class=" uk-label label-{{item.accessRights}}">{{item.accessRights}}</span><br></div>
|
28
|
<span *ngIf="item.authors != null" >
|
29
|
<span *ngFor='let author of item.authors; let i = index'>
|
30
|
<span *ngIf="i < 10">
|
31
|
<span class="el-meta uk-margin uk-text-meta">{{author}}</span>
|
32
|
</span>
|
33
|
<span *ngIf="i == 10">...</span>
|
34
|
</span>
|
35
|
</span>
|
36
|
<div class="el-meta uk-text-meta"> {{item.year}} </div>
|
37
|
<div class="text-justify descriptionText"> {{item.description}} </div>
|
38
|
</div>
|
39
|
</div>
|
40
|
</li>
|
41
|
</div>
|
42
|
</div>
|
43
|
|
44
|
<div *ngIf="results != null && results.length == 0" class=" uk-alert uk-alert-primary"> No results found </div>
|
45
|
|
46
|
<hr>
|
47
|
|
48
|
<div *ngIf="results != null && results.length > 0">
|
49
|
<div class="uk-margin">
|
50
|
<div *ngIf="resultType == 'publication'">
|
51
|
<a class="el-content uk-button uk-button-text" [queryParams]=params routerLinkActive="router-link-active" routerLink="/search/find/publications">
|
52
|
View all
|
53
|
</a>
|
54
|
</div>
|
55
|
<div *ngIf="resultType == 'dataset'">
|
56
|
<a class="el-content uk-button uk-button-text" [queryParams]=params routerLinkActive="router-link-active" routerLink="/search/find/datasets">
|
57
|
View all
|
58
|
</a>
|
59
|
</div>
|
60
|
<div *ngIf="resultType == 'software'">
|
61
|
<a class="el-content uk-button uk-button-text" [queryParams]=params routerLinkActive="router-link-active" routerLink="/search/find/software">
|
62
|
View all
|
63
|
</a>
|
64
|
</div>
|
65
|
</div>
|
66
|
</div>`
|
67
|
|
68
|
})
|
69
|
|
70
|
export class ResultsComponent {
|
71
|
|
72
|
@Input() public results : ResultInfo[];
|
73
|
@Input() public resultType: string;
|
74
|
@Input() public params: any;
|
75
|
@Input() public community: CommunityInfo;
|
76
|
}
|