-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
move content field into separate component
- Loading branch information
1 parent
8258a2b
commit 51daf2f
Showing
3 changed files
with
26 additions
and
19 deletions.
There are no files selected for viewing
18 changes: 17 additions & 1 deletion
18
frontend/src/app/document/content-field/content-field.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,17 @@ | ||
<p>content-field works!</p> | ||
<div *ngIf="showEntities && document.entityAnnotations$ | async as annotations ; else showHighlights" | ||
class="content" | ||
[attr.lang]="document.language(field)"> | ||
<div *ngIf="annotations[field.name]; else plainText" | ||
[innerHtml]="annotations[field.name] | entity | paragraph"> | ||
</div> | ||
<ng-template #plainText> | ||
<div [innerHtml]="document.fieldValues[field.name] | paragraph"></div> | ||
</ng-template> | ||
<ia-entity-legend *ngIf="showEntities" [entityAnnotations]="annotations[field.name]"></ia-entity-legend> | ||
</div> | ||
<ng-template #showHighlights> | ||
<div class="content" | ||
[attr.lang]="document.language(field)" | ||
[innerHtml]="field | elasticsearchHighlight:document | paragraph"> | ||
</div> | ||
</ng-template> |
7 changes: 5 additions & 2 deletions
7
frontend/src/app/document/content-field/content-field.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,13 @@ | ||
import { Component } from '@angular/core'; | ||
import { Component, Input } from '@angular/core'; | ||
import { CorpusField, FoundDocument } from '@models'; | ||
|
||
@Component({ | ||
selector: 'ia-content-field', | ||
templateUrl: './content-field.component.html', | ||
styleUrl: './content-field.component.scss' | ||
}) | ||
export class ContentFieldComponent { | ||
|
||
@Input() field: CorpusField; | ||
@Input() document: FoundDocument; | ||
@Input() showEntities: boolean; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters