explore-services/src/app/linking/selected/selected.component.ts

67 lines
2.5 KiB
TypeScript

import {Component, Input,Output} from '@angular/core';
import {PublicationTitleFormatter} from '../../common/publicationTitleFormatter.component';
@Component({
selector: 'claim-selected',
template: `
<div *ngIf="publications.length > 0 " class="publications" >
<h5>Selected Publications:</h5>
<i *ngFor="let pub of publications" >Source: {{pub.source}} - Title: <publication-title [title]="pub.title" [url]="pub.url" > </publication-title>
<p *ngIf="showAccessRights== 'true'" >
<select [(ngModel)]="pub.accessRights">
<option *ngFor="let type of accessTypes" [value]="type">{{type}}</option>
</select>
<!--<div class="dropdown">
<button class="btn btn-default dropdown-toggle" type="button" id="dropdownMenu1" data-toggle="dropdown" aria-haspopup="true" aria-expanded="true">
{{pub.accessRights}}
<span class="caret"></span>
</button>
<ul class="dropdown-menu" aria-labelledby="dropdownMenu1">
<li *ngFor="let type of accessTypes" ><a href="#" (click)="pub.accessRights = type " >{{type}} </a></li>
</ul>
</div>-->
</p>
</i>
</div>
<div *ngIf="contexts.length > 0 " class="concepts" >
<h5>Selected Concepts:</h5>
<i *ngFor="let context of contexts" >Community: {{context.community}} - Category: {{context.category}} </i>
</div>
<div *ngIf="projects.length > 0 " class="conprojectscepts" >
<h5>Selected projects:</h5>
<i *ngFor="let project of projects" >{{project.projectAcronym}} - {{project.projectName}} </i>
</div>
<div *ngIf="datasets.length > 0 " class="datasets" >
<h5>Selected datasets:</h5>
<i *ngFor="let dataset of datasets" > Datasets: Source: {{dataset.source}} - Title: <publication-title [title]="dataset.title" [url]="dataset.url" > </publication-title> </i>
</div>
<i>TODO: add more types</i>
`,
directives: [ PublicationTitleFormatter]
})
export class ClaimSelectedComponent {
ngOnInit() {
console.info("Show accessRights selection? :"+this.showAccessRights);
}
@Input() contexts=[];
@Input() projects=[];
@Input() publications=[];
@Input() datasets=[];
@Input() showAccessRights=false;
accessTypes = ["OPEN","CLOSED","EMBARGO","RESTRICTED"];
}