80 lines
3.0 KiB
TypeScript
80 lines
3.0 KiB
TypeScript
import {Component, Input} from '@angular/core';
|
|
import {ClaimEntity} from '../../claim-utils/claimHelper.class';
|
|
import {StringUtils} from "../../../utils/string-utils.class";
|
|
|
|
@Component({
|
|
selector: 'claim-title',
|
|
template:
|
|
`
|
|
<div class="uk-grid uk-flex uk-flex-middle">
|
|
<span *ngIf="showIcon" >
|
|
<span *ngIf=" entity.result" class="material-icons uk-text-small uk-text-meta" >insert_drive_file
|
|
</span>
|
|
<span *ngIf=" entity.project"
|
|
class="material-icons uk-text-small uk-text-meta">assignment_turned_in
|
|
</span>
|
|
<span *ngIf="entity.type=='community'" style="margin-right: 2px;"
|
|
class="material-icons uk-text-small uk-text-meta">people
|
|
</span></span>
|
|
<div class="uk-width-expand " style="word-break: break-word;" [class.uk-h6]="!shortVersion" [class.uk-text-bold]="shortVersion" [class.uk-text-truncate]="shortVersion" [class.uk-margin-bottom]="!shortVersion" [class.uk-padding-remove-left]="showIcon">
|
|
|
|
<a *ngIf="entity.result && entity.result.url" target="_blank" [href]="entity.result.url"
|
|
class="uk-link uk-link-heading">{{entity.title ? sliceString(entity.title) : '[No title available]'}}</a>
|
|
<span
|
|
*ngIf="(entity.result && !entity.result.url)">{{entity.title ? sliceString(entity.title) : '[No title available]'}}</span>
|
|
<span *ngIf="entity.type=='project' && entity.project">
|
|
<a *ngIf="entity.project && entity.project.url" target="_blank" [href]="entity.project.url"
|
|
class="uk-text-link">
|
|
<span *ngIf="!shortVersion">
|
|
{{(entity.project.acronym ? '[' + entity.project.acronym + '] ' : '') + entity.title}}
|
|
</span>
|
|
<span *ngIf="shortVersion">
|
|
{{(entity.project.acronym ? sliceString(entity.project.acronym):sliceString(entity.title))}}
|
|
</span>
|
|
</a>
|
|
<span
|
|
*ngIf="(entity.project && !entity.project.url)">
|
|
<span *ngIf="!shortVersion">
|
|
{{(entity.project.acronym ? '[' + entity.project.acronym + '] ' : '') + entity.title}}
|
|
</span>
|
|
<span *ngIf="shortVersion">
|
|
{{(entity.project.acronym ? sliceString(entity.project.acronym):sliceString(entity.title))}}
|
|
</span>
|
|
</span>
|
|
|
|
|
|
</span>
|
|
<span *ngIf="entity.type=='community' && entity.context">
|
|
<span *ngIf=" entity.context.community != entity.context.concept.label">
|
|
{{entity.context.community }} > {{entity.context.category}} >
|
|
</span>
|
|
<span> {{entity.context.concept.label}}</span>
|
|
</span>
|
|
</div>
|
|
</div>
|
|
`
|
|
|
|
|
|
})
|
|
export class ClaimEntityTitleComponent {
|
|
|
|
|
|
@Input() entity: ClaimEntity;
|
|
@Input() slice:boolean = false;
|
|
@Input() sliceSize:number = 45;
|
|
@Input() shortVersion: boolean = false;
|
|
@Input() showIcon: boolean = false;
|
|
|
|
ngOnInit() {
|
|
|
|
|
|
}
|
|
sliceString(mystr:string): string {
|
|
if(this.slice){
|
|
// return StringUtils.sliceString(mystr,this.sliceSize);
|
|
}
|
|
return mystr;
|
|
}
|
|
|
|
}
|