1
|
import {Component, Input,Output, EventEmitter} from '@angular/core';
|
2
|
import {ClaimContext} from '../../claim-utils/claimEntities.class';
|
3
|
|
4
|
@Component({
|
5
|
selector: 'claim-selected-contexts',
|
6
|
template: `
|
7
|
|
8
|
<!-- Contexts -->
|
9
|
|
10
|
<div class="uk-accordion" data-uk-accordion="{showfirst:true}">
|
11
|
<h3 class="uk-accordion-title"><i class="uk-icon-caret-square-o-right"></i> {{title}} ({{(contexts.length)}})</h3>
|
12
|
<div class="uk-accordion-content" ><!--(contextSelected)="contextSelected($event)"-->
|
13
|
<div class="uk-clearfix"><button *ngIf=" !showsearch " (click)="showsearch = true;" class="uk-button uk-animation uk-float-right">Add more <i class="uk-icon-plus"></i></button></div>
|
14
|
<claim-contexts-search-form *ngIf=" showsearch " [selectedList]="contexts" [projects]="projects" [results]="results" [inlineEntity]="inlineEntity" > </claim-contexts-search-form>
|
15
|
<ul class="uk-list uk-list-line">
|
16
|
<li class="list-group-item" *ngFor="let context of contexts" >
|
17
|
<span *ngIf="context.community != context.concept.label">{{context.community }} > {{context.category}} ></span><span> {{context.concept.label}} </span>
|
18
|
<span (click)="removeContext(context)" aria-hidden="true" class="uk-button "><i class="uk-icon-remove"></i></span>
|
19
|
|
20
|
</li>
|
21
|
</ul>
|
22
|
<div *ngIf="contexts.length == 0 " class="uk-alert uk-alert-primary">There are no communities</div>
|
23
|
</div>
|
24
|
</div>
|
25
|
|
26
|
|
27
|
`
|
28
|
})
|
29
|
export class ClaimSelectedContextsComponent {
|
30
|
ngOnInit() {
|
31
|
var myDate = new Date();
|
32
|
this.todayDate=( myDate.getFullYear()+ "-" +myDate.getMonth() + 1) + "-" + myDate.getDate() ;
|
33
|
this.nextDate= ( (myDate.getFullYear()+100)+ "-" +myDate.getMonth() + 1) + "-" + myDate.getDate() ;
|
34
|
//2015-05-01
|
35
|
// if(this.linkType == "context"){
|
36
|
this.showsearch = true
|
37
|
// }else{
|
38
|
// this.showsearch = false;
|
39
|
// }
|
40
|
}
|
41
|
|
42
|
|
43
|
@Input() contexts:ClaimContext[];
|
44
|
//The following need to be kept in case we have to save the current state
|
45
|
@Input() public projects;
|
46
|
@Input() public results;
|
47
|
@Input() public inlineEntity;
|
48
|
@Input() componentClass:string = ""; //"" or "col-sm-6" for horizontal display (besides projects)
|
49
|
@Input() show='home';
|
50
|
@Input() title='Communities';
|
51
|
@Input() linkType:string = "project";
|
52
|
|
53
|
@Input() hideType;
|
54
|
@Input() bulkMode:boolean = false;
|
55
|
@Output() showChange = new EventEmitter();
|
56
|
|
57
|
showsearch:boolean = false;
|
58
|
|
59
|
todayDate = '';
|
60
|
nextDate = '';
|
61
|
|
62
|
showType(type){
|
63
|
if(type != this.show){
|
64
|
this.show = type;
|
65
|
this.showChange.emit({
|
66
|
value: this.show
|
67
|
});
|
68
|
}
|
69
|
}
|
70
|
|
71
|
|
72
|
removeContext(item:any){
|
73
|
var index:number =this.contexts.indexOf(item);
|
74
|
if (index > -1) {
|
75
|
this.contexts.splice(index, 1);
|
76
|
}
|
77
|
|
78
|
}
|
79
|
contextSelected($event) {
|
80
|
// this.showsearch = false;
|
81
|
}
|
82
|
|
83
|
}
|